From 52ab4af51f04528d6a98fc4869d1cba3f721861d Mon Sep 17 00:00:00 2001 From: Sergey Nikolaienkov Date: Tue, 14 Sep 2021 10:12:10 +0000 Subject: [PATCH] Use new constructor for CDM's Associations Bug: 197933995 Test: make SettingsRoboTests Change-Id: I6097053a9a58128366f5d12b918d3e0721d752f2 --- ...toothDetailsCompanionAppsControllerTest.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsCompanionAppsControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsCompanionAppsControllerTest.java index 92bfb38334f..0dc0208a78b 100644 --- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsCompanionAppsControllerTest.java +++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsCompanionAppsControllerTest.java @@ -24,6 +24,7 @@ import static org.mockito.Mockito.when; import android.companion.Association; import android.companion.CompanionDeviceManager; +import android.companion.DeviceId; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; @@ -97,8 +98,20 @@ public class BluetoothDetailsCompanionAppsControllerTest extends private void addFakeAssociation(String packageName, CharSequence appName) { setupFakeLabelAndInfo(packageName, appName); - Association association = new Association( - 0, mCachedDevice.getAddress(), packageName, "", true, System.currentTimeMillis()); + + final int associationId = mAssociations.size() + 1; + final DeviceId deviceId = + new DeviceId(DeviceId.TYPE_MAC_ADDRESS, mCachedDevice.getAddress()); + final Association association = new Association( + associationId, + /* userId */ 0, + packageName, + Arrays.asList(deviceId), + /* deviceProfile */ "", + /* managedByCompanionApp */ false, + /* notifyOnDeviceNearby */ true, + /* timeApprovedMs */ System.currentTimeMillis()); + mAssociations.add(association); showScreen(mController); }