Add FastPairTestDataProviderService#onManageFastPairAccountDevice logging.
FastPairAccountKeyDeviceMetadata do not support toString(),
this change log it as JSON string.
This change also resolve Kotlin list problems.
Test: go/ml-fp-dp-tool with NearbyFastPairProviderSimulatorApp
Bug: 214015364
Ignore-AOSP-First: nearby_not_in_aosp_yet
Change-Id: I039a58ecb6c8212b69ff4305b23793b168f08f66
diff --git a/nearby/tests/multidevices/clients/test_service/fastpair_seeker_data_provider/src/android/nearby/fastpair/seeker/data/FastPairTestDataManager.kt b/nearby/tests/multidevices/clients/test_service/fastpair_seeker_data_provider/src/android/nearby/fastpair/seeker/data/FastPairTestDataManager.kt
index ffc02a0..f226789 100644
--- a/nearby/tests/multidevices/clients/test_service/fastpair_seeker_data_provider/src/android/nearby/fastpair/seeker/data/FastPairTestDataManager.kt
+++ b/nearby/tests/multidevices/clients/test_service/fastpair_seeker_data_provider/src/android/nearby/fastpair/seeker/data/FastPairTestDataManager.kt
@@ -20,7 +20,13 @@
import android.content.Context
import android.content.Intent
import android.nearby.FastPairAccountKeyDeviceMetadata
-import android.nearby.fastpair.seeker.*
+import android.nearby.fastpair.seeker.ACTION_RESET_TEST_DATA_CACHE
+import android.nearby.fastpair.seeker.ACTION_SEND_ACCOUNT_KEY_DEVICE_METADATA
+import android.nearby.fastpair.seeker.ACTION_SEND_ANTISPOOF_KEY_DEVICE_METADATA
+import android.nearby.fastpair.seeker.ACTION_WRITE_ACCOUNT_KEY_DEVICE_METADATA
+import android.nearby.fastpair.seeker.DATA_JSON_STRING_KEY
+import android.nearby.fastpair.seeker.DATA_MODEL_ID_STRING_KEY
+import android.nearby.fastpair.seeker.FastPairTestDataCache
import android.util.Log
/** Manage local FastPairTestDataCache and receive/update the remote cache in test snippet. */
@@ -30,8 +36,11 @@
/** Writes a FastPairAccountKeyDeviceMetadata into local and remote cache.
*
* @param accountKeyDeviceMetadata the FastPairAccountKeyDeviceMetadata to write.
+ * @return a json object string of the accountKeyDeviceMetadata.
*/
- fun writeAccountKeyDeviceMetadata(accountKeyDeviceMetadata: FastPairAccountKeyDeviceMetadata) {
+ fun writeAccountKeyDeviceMetadata(
+ accountKeyDeviceMetadata: FastPairAccountKeyDeviceMetadata
+ ): String {
testDataCache.putAccountKeyDeviceMetadata(accountKeyDeviceMetadata)
val json =
@@ -41,6 +50,7 @@
intent.putExtra(DATA_JSON_STRING_KEY, json)
context.sendBroadcast(intent)
}
+ return json
}
/**
diff --git a/nearby/tests/multidevices/clients/test_service/fastpair_seeker_data_provider/src/android/nearby/fastpair/seeker/dataprovider/FastPairTestDataProviderService.kt b/nearby/tests/multidevices/clients/test_service/fastpair_seeker_data_provider/src/android/nearby/fastpair/seeker/dataprovider/FastPairTestDataProviderService.kt
index cec0607..3f5a803 100644
--- a/nearby/tests/multidevices/clients/test_service/fastpair_seeker_data_provider/src/android/nearby/fastpair/seeker/dataprovider/FastPairTestDataProviderService.kt
+++ b/nearby/tests/multidevices/clients/test_service/fastpair_seeker_data_provider/src/android/nearby/fastpair/seeker/dataprovider/FastPairTestDataProviderService.kt
@@ -114,9 +114,10 @@
"requestType: $requestTypeString,"
)
Log.d(TAG, "requestedBleAddress: $requestedBleAddress,")
- Log.d(TAG, "requestedAccountKeyDeviceMetadata: $requestedAccountKeyDeviceMetadata)")
- testDataManager.writeAccountKeyDeviceMetadata(requestedAccountKeyDeviceMetadata)
+ val requestedAccountKeyDeviceMetadataInJson =
+ testDataManager.writeAccountKeyDeviceMetadata(requestedAccountKeyDeviceMetadata)
+ Log.d(TAG, "requestedAccountKeyDeviceMetadata: $requestedAccountKeyDeviceMetadataInJson)")
callback.onSuccess()
}