Refactor package structure for scalability and resolve lint problems.
This change only refactor package structure without
changing any logic and resolve Kotlin list problems.
Test: atest -v CtsNearbyMultiDevicesTestSuite
Bug: 214015364
Ignore-AOSP-First: nearby_not_in_aosp_yet
Change-Id: Ic0b7c374e22891c2c4f494c0a617cba7f253e8de
diff --git a/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/provider/FastPairProviderSimulatorSnippet.kt b/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/provider/FastPairProviderSimulatorSnippet.kt
index 39edfe4..4a8a772 100644
--- a/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/provider/FastPairProviderSimulatorSnippet.kt
+++ b/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/provider/FastPairProviderSimulatorSnippet.kt
@@ -18,6 +18,8 @@
import android.annotation.TargetApi
import android.content.Context
+import android.nearby.multidevices.fastpair.provider.controller.FastPairProviderSimulatorController
+import android.nearby.multidevices.fastpair.provider.events.ProviderStatusEvents
import android.os.Build
import androidx.test.platform.app.InstrumentationRegistry
import com.google.android.mobly.snippet.Snippet
diff --git a/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/provider/ProviderStatusEvents.kt b/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/provider/ProviderStatusEvents.kt
deleted file mode 100644
index efa4f02..0000000
--- a/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/provider/ProviderStatusEvents.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.nearby.multidevices.fastpair.provider
-
-import com.google.android.mobly.snippet.util.postSnippetEvent
-
-/** The Mobly snippet events to report to the Python side. */
-class ProviderStatusEvents(private val callbackId: String) :
- FastPairProviderSimulatorController.EventListener {
-
- /** Reports the first onServiceConnected of A2DP sink profile. */
- override fun onA2DPSinkProfileConnected() {
- postSnippetEvent(callbackId, "onA2DPSinkProfileConnected") {}
- }
-
- /**
- * Indicates the Bluetooth scan mode of the Fast Pair provider simulator has changed.
- *
- * @param mode the current scan mode in String mapping by [FastPairSimulator#scanModeToString].
- */
- override fun onScanModeChange(mode: String) {
- postSnippetEvent(callbackId, "onScanModeChange") { putString("mode", mode) }
- }
-
- /**
- * Indicates the advertising state of the Fast Pair provider simulator has changed.
- *
- * @param isAdvertising the current advertising state, true if advertising otherwise false.
- */
- override fun onAdvertisingChange(isAdvertising: Boolean) {
- postSnippetEvent(callbackId, "onAdvertisingChange") {
- putBoolean("isAdvertising", isAdvertising)
- }
- }
-}
diff --git a/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/provider/FastPairProviderSimulatorController.kt b/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/provider/controller/FastPairProviderSimulatorController.kt
similarity index 98%
rename from nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/provider/FastPairProviderSimulatorController.kt
rename to nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/provider/controller/FastPairProviderSimulatorController.kt
index e700144..b591ae0 100644
--- a/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/provider/FastPairProviderSimulatorController.kt
+++ b/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/provider/controller/FastPairProviderSimulatorController.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.nearby.multidevices.fastpair.provider
+package android.nearby.multidevices.fastpair.provider.controller
import android.bluetooth.le.AdvertiseSettings
import android.content.Context
diff --git a/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/provider/events/ProviderStatusEvents.kt b/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/provider/events/ProviderStatusEvents.kt
new file mode 100644
index 0000000..2addd77
--- /dev/null
+++ b/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/provider/events/ProviderStatusEvents.kt
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.nearby.multidevices.fastpair.provider.events
+
+import android.nearby.multidevices.fastpair.provider.controller.FastPairProviderSimulatorController
+import com.google.android.mobly.snippet.util.postSnippetEvent
+
+/** The Mobly snippet events to report to the Python side. */
+class ProviderStatusEvents(private val callbackId: String) :
+ FastPairProviderSimulatorController.EventListener {
+
+ /** Reports the first onServiceConnected of A2DP sink profile. */
+ override fun onA2DPSinkProfileConnected() {
+ postSnippetEvent(callbackId, "onA2DPSinkProfileConnected") {}
+ }
+
+ /**
+ * Indicates the Bluetooth scan mode of the Fast Pair provider simulator has changed.
+ *
+ * @param mode the current scan mode in String mapping by [FastPairSimulator#scanModeToString].
+ */
+ override fun onScanModeChange(mode: String) {
+ postSnippetEvent(callbackId, "onScanModeChange") { putString("mode", mode) }
+ }
+
+ /**
+ * Indicates the advertising state of the Fast Pair provider simulator has changed.
+ *
+ * @param isAdvertising the current advertising state, true if advertising otherwise false.
+ */
+ override fun onAdvertisingChange(isAdvertising: Boolean) {
+ postSnippetEvent(callbackId, "onAdvertisingChange") {
+ putBoolean("isAdvertising", isAdvertising)
+ }
+ }
+}
\ No newline at end of file
diff --git a/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/seeker/FastPairSeekerSnippet.kt b/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/seeker/FastPairSeekerSnippet.kt
index 617eac1..65856d8 100644
--- a/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/seeker/FastPairSeekerSnippet.kt
+++ b/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/seeker/FastPairSeekerSnippet.kt
@@ -23,6 +23,7 @@
import android.nearby.ScanRequest
import android.nearby.fastpair.seeker.FAKE_TEST_ACCOUNT_NAME
import android.nearby.multidevices.fastpair.seeker.data.FastPairTestDataManager
+import android.nearby.multidevices.fastpair.seeker.events.ScanCallbackEvents
import android.nearby.multidevices.fastpair.seeker.ui.CheckNearbyHalfSheetUiTest
import android.nearby.multidevices.fastpair.seeker.ui.DismissNearbyHalfSheetUiTest
import androidx.test.core.app.ApplicationProvider
@@ -39,12 +40,12 @@
private lateinit var scanCallback: ScanCallback
/**
- * Starts scanning as a Fast Pair seeker to find Fast Pair provider devices.
+ * Starts scanning as a Fast Pair seeker to find provider devices.
*
* @param callbackId the callback ID corresponding to the {@link FastPairSeekerSnippet#startScan}
* call that started the scanning.
*/
- @AsyncRpc(description = "Starts scanning as Fast Pair seeker to find Fast Pair provider devices.")
+ @AsyncRpc(description = "Starts scanning as Fast Pair seeker to find provider devices.")
fun startScan(callbackId: String) {
val scanRequest = ScanRequest.Builder()
.setScanMode(ScanRequest.SCAN_MODE_LOW_LATENCY)
@@ -97,7 +98,10 @@
* @param modelId a string of model id to be associated with.
* @param json a string of FastPairAntispoofKeyDeviceMetadata JSON object.
*/
- @Rpc(description = "Puts a model id to FastPairAntispoofKeyDeviceMetadata pair into test data cache.")
+ @Rpc(
+ description =
+ "Puts a model id to FastPairAntispoofKeyDeviceMetadata pair into test data cache."
+ )
fun putAntispoofKeyDeviceMetadata(modelId: String, json: String) {
Log.i("Puts a model id to FastPairAntispoofKeyDeviceMetadata pair into test data cache.")
fastPairTestDataManager.sendAntispoofKeyDeviceMetadata(modelId, json)
diff --git a/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/seeker/ScanCallbackEvents.kt b/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/seeker/events/ScanCallbackEvents.kt
similarity index 95%
rename from nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/seeker/ScanCallbackEvents.kt
rename to nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/seeker/events/ScanCallbackEvents.kt
index 5385238..363355f 100644
--- a/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/seeker/ScanCallbackEvents.kt
+++ b/nearby/tests/multidevices/clients/src/android/nearby/multidevices/fastpair/seeker/events/ScanCallbackEvents.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.nearby.multidevices.fastpair.seeker
+package android.nearby.multidevices.fastpair.seeker.events
import android.nearby.NearbyDevice
import android.nearby.ScanCallback