From 7cbfb4eef3e8c3862133c3a7e42ac1062d514b37 Mon Sep 17 00:00:00 2001 From: baisheng Date: Wed, 11 Jul 2018 14:40:50 +0800 Subject: [PATCH] Remove not-required assertion in BluetoothTestUtils.disable/enable Those assertions will cause LE builds failed as BluetoothAdapter behaves a bit different on LE. And this removal should not have impacts on exiting tests because Semaphore will guarantee BT is disabled/enabled within timeout. Bug: 111329335 Test: Do Bluetooth Enable Stress test on LE and RoW builds. Change-Id: Ieedec90d21f4fd1aa3cdb4a6cb5849a9fa4fd864 --- .../src/android/bluetooth/BluetoothTestUtils.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/tests/bluetoothtests/src/android/bluetooth/BluetoothTestUtils.java b/core/tests/bluetoothtests/src/android/bluetooth/BluetoothTestUtils.java index ada03666b7ba0..b906d84adf529 100644 --- a/core/tests/bluetoothtests/src/android/bluetooth/BluetoothTestUtils.java +++ b/core/tests/bluetoothtests/src/android/bluetooth/BluetoothTestUtils.java @@ -446,7 +446,10 @@ public class BluetoothTestUtils extends Assert { final IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED); mContext.registerReceiver(receiver, filter); - assertTrue(adapter.enable()); + // Note: for Wear Local Edition builds, which have Permission Review Mode enabled to + // obey China CMIIT, BluetoothAdapter may not startup immediately on methods enable/disable. + // So no assertion applied here. + adapter.enable(); boolean success = false; try { success = completionSemaphore.tryAcquire(ENABLE_DISABLE_TIMEOUT, TimeUnit.MILLISECONDS); @@ -489,7 +492,10 @@ public class BluetoothTestUtils extends Assert { final IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED); mContext.registerReceiver(receiver, filter); - assertTrue(adapter.disable()); + // Note: for Wear Local Edition builds, which have Permission Review Mode enabled to + // obey China CMIIT, BluetoothAdapter may not startup immediately on methods enable/disable. + // So no assertion applied here. + adapter.disable(); boolean success = false; try { success = completionSemaphore.tryAcquire(ENABLE_DISABLE_TIMEOUT, TimeUnit.MILLISECONDS);