Loading android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceFactoryResetTest.java +9 −6 Original line number Diff line number Diff line Loading @@ -145,7 +145,7 @@ public class AdapterServiceFactoryResetTest { private int mForegroundUserId; private void configureEnabledProfiles() { Log.e("AdapterServiceTest", "configureEnabledProfiles"); Log.e(TAG, "configureEnabledProfiles"); Config.setProfileEnabled(PanService.class, true); Config.setProfileEnabled(BluetoothPbapService.class, true); Config.setProfileEnabled(GattService.class, true); Loading Loading @@ -176,7 +176,7 @@ public class AdapterServiceFactoryResetTest { @BeforeClass public static void setupClass() { Log.e("AdapterServiceTest", "setupClass"); Log.e(TAG, "setupClass"); // Bring native layer up and down to make sure config files are properly loaded if (Looper.myLooper() == null) { Looper.prepare(); Loading @@ -194,7 +194,7 @@ public class AdapterServiceFactoryResetTest { @Before public void setUp() throws PackageManager.NameNotFoundException { Log.e("AdapterServiceTest", "setUp()"); Log.e(TAG, "setUp()"); MockitoAnnotations.initMocks(this); if (Looper.myLooper() == null) { Looper.prepare(); Loading Loading @@ -327,7 +327,10 @@ public class AdapterServiceFactoryResetTest { @After public void tearDown() { Log.e("AdapterServiceTest", "tearDown()"); Log.e(TAG, "tearDown()"); // Enable the stack to re-create the config. Next tests rely on it. doEnable(0, false); // Restores the foregroundUserId to the ID prior to the test setup Utils.setForegroundUserId(mForegroundUserId); Loading @@ -351,7 +354,7 @@ public class AdapterServiceFactoryResetTest { } private void doEnable(int invocationNumber, boolean onlyGatt) { Log.e("AdapterServiceTest", "doEnable() start"); Log.e(TAG, "doEnable() start"); Assert.assertFalse(mAdapterService.getState() == BluetoothAdapter.STATE_ON); int startServiceCalls; Loading Loading @@ -398,7 +401,7 @@ public class AdapterServiceFactoryResetTest { || scanMode == BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE); Assert.assertTrue(mAdapterService.getState() == BluetoothAdapter.STATE_ON); Log.e("AdapterServiceTest", "doEnable() complete success"); Log.e(TAG, "doEnable() complete success"); } /** Loading android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceRestartTest.java +9 −4 Original line number Diff line number Diff line Loading @@ -131,7 +131,7 @@ public class AdapterServiceRestartTest { private int mForegroundUserId; private void configureEnabledProfiles() { Log.e("AdapterServiceTest", "configureEnabledProfiles"); Log.e(TAG, "configureEnabledProfiles"); Config.setProfileEnabled(PanService.class, true); Config.setProfileEnabled(BluetoothPbapService.class, true); Config.setProfileEnabled(GattService.class, true); Loading Loading @@ -162,7 +162,7 @@ public class AdapterServiceRestartTest { @BeforeClass public static void setupClass() { Log.e("AdapterServiceTest", "setupClass"); Log.e(TAG, "setupClass"); // Bring native layer up and down to make sure config files are properly loaded if (Looper.myLooper() == null) { Looper.prepare(); Loading @@ -180,7 +180,7 @@ public class AdapterServiceRestartTest { @Before public void setUp() throws PackageManager.NameNotFoundException { Log.e("AdapterServiceTest", "setUp()"); Log.e(TAG, "setUp()"); MockitoAnnotations.initMocks(this); if (Looper.myLooper() == null) { Looper.prepare(); Loading Loading @@ -309,7 +309,7 @@ public class AdapterServiceRestartTest { @After public void tearDown() { Log.e("AdapterServiceTest", "tearDown()"); Log.e(TAG, "tearDown()"); // Restores the foregroundUserId to the ID prior to the test setup Utils.setForegroundUserId(mForegroundUserId); Loading Loading @@ -341,6 +341,11 @@ public class AdapterServiceRestartTest { obfuscatedAddress1); tearDown(); setUp(); byte[] metricsSalt2 = AdapterServiceTest.getMetricsSalt(mAdapterConfig); Assert.assertNotNull(metricsSalt2); Assert.assertArrayEquals(metricsSalt, metricsSalt2); Assert.assertFalse(mAdapterService.getState() == BluetoothAdapter.STATE_ON); byte[] obfuscatedAddress2 = mAdapterService.obfuscateAddress(device); Assert.assertTrue(obfuscatedAddress2.length > 0); Loading system/btif/src/btif_config.cc +1 −1 Original line number Diff line number Diff line Loading @@ -112,7 +112,7 @@ static void read_or_set_metrics_salt() { metrics_salt.fill(0); } if (!AddressObfuscator::IsSaltValid(metrics_salt)) { LOG(INFO) << __func__ << ": Metrics salt is not invalid, creating new one"; LOG(INFO) << __func__ << ": Metrics salt is invalid, creating new one"; if (RAND_bytes(metrics_salt.data(), metrics_salt.size()) != 1) { LOG(FATAL) << __func__ << "Failed to generate salt for metrics"; } Loading Loading
android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceFactoryResetTest.java +9 −6 Original line number Diff line number Diff line Loading @@ -145,7 +145,7 @@ public class AdapterServiceFactoryResetTest { private int mForegroundUserId; private void configureEnabledProfiles() { Log.e("AdapterServiceTest", "configureEnabledProfiles"); Log.e(TAG, "configureEnabledProfiles"); Config.setProfileEnabled(PanService.class, true); Config.setProfileEnabled(BluetoothPbapService.class, true); Config.setProfileEnabled(GattService.class, true); Loading Loading @@ -176,7 +176,7 @@ public class AdapterServiceFactoryResetTest { @BeforeClass public static void setupClass() { Log.e("AdapterServiceTest", "setupClass"); Log.e(TAG, "setupClass"); // Bring native layer up and down to make sure config files are properly loaded if (Looper.myLooper() == null) { Looper.prepare(); Loading @@ -194,7 +194,7 @@ public class AdapterServiceFactoryResetTest { @Before public void setUp() throws PackageManager.NameNotFoundException { Log.e("AdapterServiceTest", "setUp()"); Log.e(TAG, "setUp()"); MockitoAnnotations.initMocks(this); if (Looper.myLooper() == null) { Looper.prepare(); Loading Loading @@ -327,7 +327,10 @@ public class AdapterServiceFactoryResetTest { @After public void tearDown() { Log.e("AdapterServiceTest", "tearDown()"); Log.e(TAG, "tearDown()"); // Enable the stack to re-create the config. Next tests rely on it. doEnable(0, false); // Restores the foregroundUserId to the ID prior to the test setup Utils.setForegroundUserId(mForegroundUserId); Loading @@ -351,7 +354,7 @@ public class AdapterServiceFactoryResetTest { } private void doEnable(int invocationNumber, boolean onlyGatt) { Log.e("AdapterServiceTest", "doEnable() start"); Log.e(TAG, "doEnable() start"); Assert.assertFalse(mAdapterService.getState() == BluetoothAdapter.STATE_ON); int startServiceCalls; Loading Loading @@ -398,7 +401,7 @@ public class AdapterServiceFactoryResetTest { || scanMode == BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE); Assert.assertTrue(mAdapterService.getState() == BluetoothAdapter.STATE_ON); Log.e("AdapterServiceTest", "doEnable() complete success"); Log.e(TAG, "doEnable() complete success"); } /** Loading
android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceRestartTest.java +9 −4 Original line number Diff line number Diff line Loading @@ -131,7 +131,7 @@ public class AdapterServiceRestartTest { private int mForegroundUserId; private void configureEnabledProfiles() { Log.e("AdapterServiceTest", "configureEnabledProfiles"); Log.e(TAG, "configureEnabledProfiles"); Config.setProfileEnabled(PanService.class, true); Config.setProfileEnabled(BluetoothPbapService.class, true); Config.setProfileEnabled(GattService.class, true); Loading Loading @@ -162,7 +162,7 @@ public class AdapterServiceRestartTest { @BeforeClass public static void setupClass() { Log.e("AdapterServiceTest", "setupClass"); Log.e(TAG, "setupClass"); // Bring native layer up and down to make sure config files are properly loaded if (Looper.myLooper() == null) { Looper.prepare(); Loading @@ -180,7 +180,7 @@ public class AdapterServiceRestartTest { @Before public void setUp() throws PackageManager.NameNotFoundException { Log.e("AdapterServiceTest", "setUp()"); Log.e(TAG, "setUp()"); MockitoAnnotations.initMocks(this); if (Looper.myLooper() == null) { Looper.prepare(); Loading Loading @@ -309,7 +309,7 @@ public class AdapterServiceRestartTest { @After public void tearDown() { Log.e("AdapterServiceTest", "tearDown()"); Log.e(TAG, "tearDown()"); // Restores the foregroundUserId to the ID prior to the test setup Utils.setForegroundUserId(mForegroundUserId); Loading Loading @@ -341,6 +341,11 @@ public class AdapterServiceRestartTest { obfuscatedAddress1); tearDown(); setUp(); byte[] metricsSalt2 = AdapterServiceTest.getMetricsSalt(mAdapterConfig); Assert.assertNotNull(metricsSalt2); Assert.assertArrayEquals(metricsSalt, metricsSalt2); Assert.assertFalse(mAdapterService.getState() == BluetoothAdapter.STATE_ON); byte[] obfuscatedAddress2 = mAdapterService.obfuscateAddress(device); Assert.assertTrue(obfuscatedAddress2.length > 0); Loading
system/btif/src/btif_config.cc +1 −1 Original line number Diff line number Diff line Loading @@ -112,7 +112,7 @@ static void read_or_set_metrics_salt() { metrics_salt.fill(0); } if (!AddressObfuscator::IsSaltValid(metrics_salt)) { LOG(INFO) << __func__ << ": Metrics salt is not invalid, creating new one"; LOG(INFO) << __func__ << ": Metrics salt is invalid, creating new one"; if (RAND_bytes(metrics_salt.data(), metrics_salt.size()) != 1) { LOG(FATAL) << __func__ << "Failed to generate salt for metrics"; } Loading