Merge tag 'android-13.0.0_r52' into int/13/fp3
Android 13.0.0 Release 52 (TQ3A.230605.012)
* tag 'android-13.0.0_r52': (1226 commits)
DO NOT MERGE Skip part of testRejectThenErrorFromForegroundActivity (acquired info)
[DO NOT MERGE] Disable ResumeOnRebootHostTest#resumeOnReboot_TwoUsers_BothUserUnlock_Success temporarily to unblock progress.
Fix flaky TaskFragmentOrganizerTest#testFinishActivity
Remove broken WindowUntrustedTouchTest tests
Disable test protocols requiring mic/speaker if not present on the device.
Add unified min area screening for preview & video
Camera: Relax verifyFpsNotSlowDown criteria
Set mean threshold based on resolution for auto
DO NOT MERGE: Bump CTS Verifier version to 10_R17
DO NOT MERGE: Bump CTS Verifier version to 11_R13
DO NOT MERGE: Bump CTS and CTS Verifier version to 12_R9
DO NOT MERGE: Bump CTS and CTS Verifier version to 12_R7
DO NOT MERGE: Bump CTS and CTS Verifier version to 13_R5
Makes AccessibilityEventTest and homeScreenOrBust more robust.
Add new CTS test to ensure the revert is cherry-picked
Revert intent filter matching enforcement.
Add "tablet_device" parameter in sensor_fusion_scene's config.yml and its_base_tests.py
Fix forward MediaSessionManagerTest mainline annotations
Fix cts failures of DisplayCutoutTests
Skip PermissionHistoryTests for wear
...
Change-Id: I045ec77882642fa6e98410214d5f4beb0ff06b58
diff --git a/apps/CameraITS/tests/scene4/test_preview_stabilization_fov.py b/apps/CameraITS/tests/scene4/test_preview_stabilization_fov.py
index c0d9f39..2306884 100644
--- a/apps/CameraITS/tests/scene4/test_preview_stabilization_fov.py
+++ b/apps/CameraITS/tests/scene4/test_preview_stabilization_fov.py
@@ -106,6 +106,11 @@
f'image_size[1]: {image_size[1]}, '
f'normalized_area: {normalized_area}')
+ if normalized_diagonal > 1 or normalized_diagonal < 0:
+ raise AssertionError(f'normalized diagonal > 1 or < 0!'
+ f' img_diag: {img_diagonal}, '
+ f' normalized_diagonal: {normalized_diagonal}')
+
# Threshold should be larger for images with smaller resolution
normalized_threshold_percent = ((1 - normalized_area) *
(_MAX_CENTER_THRESHOLD_PERCENT -
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothA2dpSinkTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothA2dpSinkTest.java
index a653bc5..27708a6 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothA2dpSinkTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothA2dpSinkTest.java
@@ -48,8 +48,8 @@
private BluetoothA2dpSink mBluetoothA2dpSink;
private boolean mIsA2dpSinkSupported;
private boolean mIsProfileReady;
- private Condition mConditionProfileConnection;
- private ReentrantLock mProfileConnectionlock;
+ private Condition mConditionProfileIsConnected;
+ private ReentrantLock mProfileConnectedlock;
@Override
public void setUp() throws Exception {
@@ -68,8 +68,8 @@
mAdapter = manager.getAdapter();
assertTrue(BTAdapterUtils.enableAdapter(mAdapter, mContext));
- mProfileConnectionlock = new ReentrantLock();
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
+ mProfileConnectedlock = new ReentrantLock();
+ mConditionProfileIsConnected = mProfileConnectedlock.newCondition();
mIsProfileReady = false;
mBluetoothA2dpSink = null;
@@ -92,18 +92,6 @@
mAdapter = null;
}
- public void test_closeProfileProxy() {
- if (!(mHasBluetooth && mIsA2dpSinkSupported)) return;
-
- assertTrue(waitForProfileConnect());
- assertNotNull(mBluetoothA2dpSink);
- assertTrue(mIsProfileReady);
-
- mAdapter.closeProfileProxy(BluetoothProfile.A2DP_SINK, mBluetoothA2dpSink);
- assertTrue(waitForProfileDisconnect());
- assertFalse(mIsProfileReady);
- }
-
public void test_getConnectedDevices() {
if (!(mHasBluetooth && mIsA2dpSinkSupported)) return;
@@ -201,11 +189,11 @@
}
private boolean waitForProfileConnect() {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
// Wait for the Adapter to be disabled
while (!mIsProfileReady) {
- if (!mConditionProfileConnection.await(
+ if (!mConditionProfileIsConnected.await(
PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
// Timeout
Log.e(TAG, "Timeout while waiting for Profile Connect");
@@ -215,55 +203,28 @@
} catch (InterruptedException e) {
Log.e(TAG, "waitForProfileConnect: interrrupted");
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
return mIsProfileReady;
}
- private boolean waitForProfileDisconnect() {
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
- mProfileConnectionlock.lock();
- try {
- while (mIsProfileReady) {
- if (!mConditionProfileConnection.await(
- PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
- // Timeout
- Log.e(TAG, "Timeout while waiting for Profile Disconnect");
- break;
- } // else spurious wakeups
- }
- } catch (InterruptedException e) {
- Log.e(TAG, "waitForProfileDisconnect: interrrupted");
- } finally {
- mProfileConnectionlock.unlock();
- }
- return !mIsProfileReady;
- }
-
private final class BluetoothA2dpSinkServiceListener implements
BluetoothProfile.ServiceListener {
@Override
public void onServiceConnected(int profile, BluetoothProfile proxy) {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
mBluetoothA2dpSink = (BluetoothA2dpSink) proxy;
mIsProfileReady = true;
try {
- mConditionProfileConnection.signal();
+ mConditionProfileIsConnected.signal();
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
}
@Override
public void onServiceDisconnected(int profile) {
- mProfileConnectionlock.lock();
- mIsProfileReady = false;
- try {
- mConditionProfileConnection.signal();
- } finally {
- mProfileConnectionlock.unlock();
- }
}
}
}
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothA2dpTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothA2dpTest.java
index 1d3c00a..21a5cad 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothA2dpTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothA2dpTest.java
@@ -49,8 +49,8 @@
private BluetoothA2dp mBluetoothA2dp;
private boolean mIsA2dpSupported;
private boolean mIsProfileReady;
- private ReentrantLock mProfileConnectionlock;
- private Condition mConditionProfileConnection;
+ private Condition mConditionProfileIsConnected;
+ private ReentrantLock mProfileConnectedlock;
@Override
public void setUp() throws Exception {
@@ -69,9 +69,8 @@
mAdapter = manager.getAdapter();
assertTrue(BTAdapterUtils.enableAdapter(mAdapter, mContext));
- mProfileConnectionlock = new ReentrantLock();
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
-
+ mProfileConnectedlock = new ReentrantLock();
+ mConditionProfileIsConnected = mProfileConnectedlock.newCondition();
mIsProfileReady = false;
mBluetoothA2dp = null;
@@ -94,18 +93,6 @@
mUiAutomation.dropShellPermissionIdentity();
}
- public void test_closeProfileProxy() {
- if (!(mHasBluetooth && mIsA2dpSupported)) return;
-
- assertTrue(waitForProfileConnect());
- assertNotNull(mBluetoothA2dp);
- assertTrue(mIsProfileReady);
-
- mAdapter.closeProfileProxy(BluetoothProfile.A2DP, mBluetoothA2dp);
- assertTrue(waitForProfileDisconnect());
- assertFalse(mIsProfileReady);
- }
-
public void test_getConnectedDevices() {
if (!(mHasBluetooth && mIsA2dpSupported)) return;
@@ -342,11 +329,11 @@
}
private boolean waitForProfileConnect() {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
// Wait for the Adapter to be disabled
while (!mIsProfileReady) {
- if (!mConditionProfileConnection.await(
+ if (!mConditionProfileIsConnected.await(
PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
// Timeout
Log.e(TAG, "Timeout while waiting for Profile Connect");
@@ -356,55 +343,28 @@
} catch (InterruptedException e) {
Log.e(TAG, "waitForProfileConnect: interrrupted");
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
return mIsProfileReady;
}
- private boolean waitForProfileDisconnect() {
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
- mProfileConnectionlock.lock();
- try {
- while (mIsProfileReady) {
- if (!mConditionProfileConnection.await(
- PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
- // Timeout
- Log.e(TAG, "Timeout while waiting for Profile Disconnect");
- break;
- } // else spurious wakeups
- }
- } catch (InterruptedException e) {
- Log.e(TAG, "waitForProfileDisconnect: interrrupted");
- } finally {
- mProfileConnectionlock.unlock();
- }
- return !mIsProfileReady;
- }
-
private final class BluetoothA2dpServiceListener implements
BluetoothProfile.ServiceListener {
@Override
public void onServiceConnected(int profile, BluetoothProfile proxy) {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
mBluetoothA2dp = (BluetoothA2dp) proxy;
mIsProfileReady = true;
try {
- mConditionProfileConnection.signal();
+ mConditionProfileIsConnected.signal();
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
}
@Override
public void onServiceDisconnected(int profile) {
- mProfileConnectionlock.lock();
- mIsProfileReady = false;
- try {
- mConditionProfileConnection.signal();
- } finally {
- mProfileConnectionlock.unlock();
- }
}
}
}
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothCsipSetCoordinatorTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothCsipSetCoordinatorTest.java
index bb4c2c1..799316d 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothCsipSetCoordinatorTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothCsipSetCoordinatorTest.java
@@ -21,19 +21,23 @@
import static org.junit.Assert.assertThrows;
+import android.app.UiAutomation;
import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothCsipSetCoordinator;
import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothCsipSetCoordinator;
import android.bluetooth.BluetoothManager;
import android.bluetooth.BluetoothProfile;
import android.bluetooth.BluetoothStatusCodes;
import android.bluetooth.BluetoothUuid;
import android.content.pm.PackageManager;
+import android.content.res.Resources;
import android.os.Build;
import android.os.ParcelUuid;
import android.test.AndroidTestCase;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+
import com.android.compatibility.common.util.ApiLevelUtil;
import java.util.List;
@@ -55,8 +59,8 @@
private BluetoothCsipSetCoordinator mBluetoothCsipSetCoordinator;
private boolean mIsCsipSetCoordinatorSupported;
private boolean mIsProfileReady;
- private Condition mConditionProfileConnection;
- private ReentrantLock mProfileConnectionlock;
+ private Condition mConditionProfileIsConnected;
+ private ReentrantLock mProfileConnectedlock;
private boolean mGroupLockCallbackCalled;
private TestCallback mTestCallback;
private Executor mTestExecutor;
@@ -90,8 +94,8 @@
mAdapter = manager.getAdapter();
assertTrue(BTAdapterUtils.enableAdapter(mAdapter, mContext));
- mProfileConnectionlock = new ReentrantLock();
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
+ mProfileConnectedlock = new ReentrantLock();
+ mConditionProfileIsConnected = mProfileConnectedlock.newCondition();
mIsProfileReady = false;
mBluetoothCsipSetCoordinator = null;
@@ -135,19 +139,6 @@
}
}
- public void testCloseProfileProxy() {
- if (!(mHasBluetooth && mIsCsipSetCoordinatorSupported)) return;
-
- assertTrue(waitForProfileConnect());
- assertNotNull(mBluetoothCsipSetCoordinator);
- assertTrue(mIsProfileReady);
-
- mAdapter.closeProfileProxy(
- BluetoothProfile.CSIP_SET_COORDINATOR, mBluetoothCsipSetCoordinator);
- assertTrue(waitForProfileDisconnect());
- assertFalse(mIsProfileReady);
- }
-
public void testGetConnectedDevices() {
if (!(mHasBluetooth && mIsCsipSetCoordinatorSupported)) return;
@@ -271,11 +262,11 @@
}
private boolean waitForProfileConnect() {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
// Wait for the Adapter to be disabled
while (!mIsProfileReady) {
- if (!mConditionProfileConnection.await(
+ if (!mConditionProfileIsConnected.await(
PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
// Timeout
Log.e(TAG, "Timeout while waiting for Profile Connect");
@@ -285,55 +276,28 @@
} catch (InterruptedException e) {
Log.e(TAG, "waitForProfileConnect: interrrupted");
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
return mIsProfileReady;
}
- private boolean waitForProfileDisconnect() {
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
- mProfileConnectionlock.lock();
- try {
- while (mIsProfileReady) {
- if (!mConditionProfileConnection.await(
- PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
- // Timeout
- Log.e(TAG, "Timeout while waiting for Profile Disconnect");
- break;
- } // else spurious wakeups
- }
- } catch (InterruptedException e) {
- Log.e(TAG, "waitForProfileDisconnect: interrrupted");
- } finally {
- mProfileConnectionlock.unlock();
- }
- return !mIsProfileReady;
- }
-
private final class BluetoothCsipServiceListener implements
BluetoothProfile.ServiceListener {
@Override
public void onServiceConnected(int profile, BluetoothProfile proxy) {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
mBluetoothCsipSetCoordinator = (BluetoothCsipSetCoordinator) proxy;
mIsProfileReady = true;
try {
- mConditionProfileConnection.signal();
+ mConditionProfileIsConnected.signal();
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
}
@Override
public void onServiceDisconnected(int profile) {
- mProfileConnectionlock.lock();
- mIsProfileReady = false;
- try {
- mConditionProfileConnection.signal();
- } finally {
- mProfileConnectionlock.unlock();
- }
}
}
}
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHapClientTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHapClientTest.java
index adebccb..3a8a9ae 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHapClientTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHapClientTest.java
@@ -20,7 +20,6 @@
import static android.Manifest.permission.BLUETOOTH_PRIVILEGED;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThrows;
@@ -70,8 +69,8 @@
private BluetoothHapClient mBluetoothHapClient;
private boolean mIsHapClientSupported;
private boolean mIsProfileReady;
- private Condition mConditionProfileConnection;
- private ReentrantLock mProfileConnectionlock;
+ private Condition mConditionProfileIsConnected;
+ private ReentrantLock mProfileConnectedlock;
private boolean mOnPresetSelected = false;
private boolean mOnPresetSelectionFailed = false;
@@ -108,8 +107,8 @@
mAdapter = TestUtils.getBluetoothAdapterOrDie();
assertTrue(BTAdapterUtils.enableAdapter(mAdapter, mContext));
- mProfileConnectionlock = new ReentrantLock();
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
+ mProfileConnectedlock = new ReentrantLock();
+ mConditionProfileIsConnected = mProfileConnectedlock.newCondition();
mIsProfileReady = false;
mBluetoothHapClient = null;
@@ -132,21 +131,6 @@
}
@Test
- public void test_closeProfileProxy() {
- if (shouldSkipTest()) {
- return;
- }
-
- assertTrue(waitForProfileConnect());
- assertNotNull(mBluetoothHapClient);
- assertTrue(mIsProfileReady);
-
- mAdapter.closeProfileProxy(BluetoothProfile.HAP_CLIENT, mBluetoothHapClient);
- assertTrue(waitForProfileDisconnect());
- assertFalse(mIsProfileReady);
- }
-
- @Test
public void testGetConnectedDevices() {
if (shouldSkipTest()) {
return;
@@ -479,11 +463,11 @@
}
private boolean waitForProfileConnect() {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
// Wait for the Adapter to be disabled
while (!mIsProfileReady) {
- if (!mConditionProfileConnection.await(
+ if (!mConditionProfileIsConnected.await(
PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
// Timeout
Log.e(TAG, "Timeout while waiting for Profile Connect");
@@ -493,55 +477,28 @@
} catch (InterruptedException e) {
Log.e(TAG, "waitForProfileConnect: interrupted");
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
return mIsProfileReady;
}
- private boolean waitForProfileDisconnect() {
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
- mProfileConnectionlock.lock();
- try {
- while (mIsProfileReady) {
- if (!mConditionProfileConnection.await(
- PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
- // Timeout
- Log.e(TAG, "Timeout while waiting for Profile Disconnect");
- break;
- } // else spurious wakeups
- }
- } catch (InterruptedException e) {
- Log.e(TAG, "waitForProfileDisconnect: interrrupted");
- } finally {
- mProfileConnectionlock.unlock();
- }
- return !mIsProfileReady;
- }
-
private final class BluetoothHapClientServiceListener implements
BluetoothProfile.ServiceListener {
@Override
public void onServiceConnected(int profile, BluetoothProfile proxy) {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
mBluetoothHapClient = (BluetoothHapClient) proxy;
mIsProfileReady = true;
try {
- mConditionProfileConnection.signal();
+ mConditionProfileIsConnected.signal();
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
}
@Override
public void onServiceDisconnected(int profile) {
- mProfileConnectionlock.lock();
- mIsProfileReady = false;
- try {
- mConditionProfileConnection.signal();
- } finally {
- mProfileConnectionlock.unlock();
- }
}
}
}
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHeadsetClientTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHeadsetClientTest.java
index bac21ae..439e217 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHeadsetClientTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHeadsetClientTest.java
@@ -49,8 +49,8 @@
private BluetoothHeadsetClient mBluetoothHeadsetClient;
private boolean mIsHeadsetClientSupported;
private boolean mIsProfileReady;
- private Condition mConditionProfileConnection;
- private ReentrantLock mProfileConnectionlock;
+ private Condition mConditionProfileIsConnected;
+ private ReentrantLock mProfileConnectedlock;
@Override
public void setUp() throws Exception {
@@ -69,8 +69,8 @@
mAdapter = manager.getAdapter();
assertTrue(BTAdapterUtils.enableAdapter(mAdapter, mContext));
- mProfileConnectionlock = new ReentrantLock();
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
+ mProfileConnectedlock = new ReentrantLock();
+ mConditionProfileIsConnected = mProfileConnectedlock.newCondition();
mIsProfileReady = false;
mBluetoothHeadsetClient = null;
@@ -93,18 +93,6 @@
mAdapter = null;
}
- public void test_closeProfileProxy() {
- if (!(mHasBluetooth && mIsHeadsetClientSupported)) return;
-
- assertTrue(waitForProfileConnect());
- assertNotNull(mBluetoothHeadsetClient);
- assertTrue(mIsProfileReady);
-
- mAdapter.closeProfileProxy(BluetoothProfile.HEADSET_CLIENT, mBluetoothHeadsetClient);
- assertTrue(waitForProfileDisconnect());
- assertFalse(mIsProfileReady);
- }
-
public void test_getConnectedDevices() {
if (!(mHasBluetooth && mIsHeadsetClientSupported)) return;
@@ -228,11 +216,11 @@
}
private boolean waitForProfileConnect() {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
// Wait for the Adapter to be disabled
while (!mIsProfileReady) {
- if (!mConditionProfileConnection.await(
+ if (!mConditionProfileIsConnected.await(
PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
// Timeout
Log.e(TAG, "Timeout while waiting for Profile Connect");
@@ -242,55 +230,28 @@
} catch (InterruptedException e) {
Log.e(TAG, "waitForProfileConnect: interrrupted");
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
return mIsProfileReady;
}
- private boolean waitForProfileDisconnect() {
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
- mProfileConnectionlock.lock();
- try {
- while (mIsProfileReady) {
- if (!mConditionProfileConnection.await(
- PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
- // Timeout
- Log.e(TAG, "Timeout while waiting for Profile Disconnect");
- break;
- } // else spurious wakeups
- }
- } catch (InterruptedException e) {
- Log.e(TAG, "waitForProfileDisconnect: interrrupted");
- } finally {
- mProfileConnectionlock.unlock();
- }
- return !mIsProfileReady;
- }
-
private final class BluetoothHeadsetClientServiceListener implements
BluetoothProfile.ServiceListener {
@Override
public void onServiceConnected(int profile, BluetoothProfile proxy) {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
mBluetoothHeadsetClient = (BluetoothHeadsetClient) proxy;
mIsProfileReady = true;
try {
- mConditionProfileConnection.signal();
+ mConditionProfileIsConnected.signal();
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
}
@Override
public void onServiceDisconnected(int profile) {
- mProfileConnectionlock.lock();
- mIsProfileReady = false;
- try {
- mConditionProfileConnection.signal();
- } finally {
- mProfileConnectionlock.unlock();
- }
}
}
}
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHeadsetTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHeadsetTest.java
index cf683b4..5315f33 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHeadsetTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHeadsetTest.java
@@ -49,8 +49,8 @@
private BluetoothHeadset mBluetoothHeadset;
private boolean mIsHeadsetSupported;
private boolean mIsProfileReady;
- private Condition mConditionProfileConnection;
- private ReentrantLock mProfileConnectionlock;
+ private Condition mConditionProfileIsConnected;
+ private ReentrantLock mProfileConnectedlock;
@Override
public void setUp() throws Exception {
@@ -69,8 +69,8 @@
mAdapter = manager.getAdapter();
assertTrue(BTAdapterUtils.enableAdapter(mAdapter, mContext));
- mProfileConnectionlock = new ReentrantLock();
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
+ mProfileConnectedlock = new ReentrantLock();
+ mConditionProfileIsConnected = mProfileConnectedlock.newCondition();
mIsProfileReady = false;
mBluetoothHeadset = null;
@@ -93,18 +93,6 @@
mUiAutomation.dropShellPermissionIdentity();
}
- public void test_closeProfileProxy() {
- if (!(mHasBluetooth && mIsHeadsetSupported)) return;
-
- assertTrue(waitForProfileConnect());
- assertNotNull(mBluetoothHeadset);
- assertTrue(mIsProfileReady);
-
- mAdapter.closeProfileProxy(BluetoothProfile.HEADSET, mBluetoothHeadset);
- assertTrue(waitForProfileDisconnect());
- assertFalse(mIsProfileReady);
- }
-
public void test_getConnectedDevices() {
if (!(mHasBluetooth && mIsHeadsetSupported)) return;
@@ -385,11 +373,11 @@
}
private boolean waitForProfileConnect() {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
// Wait for the Adapter to be disabled
while (!mIsProfileReady) {
- if (!mConditionProfileConnection.await(
+ if (!mConditionProfileIsConnected.await(
PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
// Timeout
Log.e(TAG, "Timeout while waiting for Profile Connect");
@@ -399,55 +387,28 @@
} catch (InterruptedException e) {
Log.e(TAG, "waitForProfileConnect: interrrupted");
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
return mIsProfileReady;
}
- private boolean waitForProfileDisconnect() {
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
- mProfileConnectionlock.lock();
- try {
- while (mIsProfileReady) {
- if (!mConditionProfileConnection.await(
- PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
- // Timeout
- Log.e(TAG, "Timeout while waiting for Profile Disconnect");
- break;
- } // else spurious wakeups
- }
- } catch (InterruptedException e) {
- Log.e(TAG, "waitForProfileDisconnect: interrrupted");
- } finally {
- mProfileConnectionlock.unlock();
- }
- return !mIsProfileReady;
- }
-
private final class BluetoothHeadsetServiceListener implements
BluetoothProfile.ServiceListener {
@Override
public void onServiceConnected(int profile, BluetoothProfile proxy) {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
mBluetoothHeadset = (BluetoothHeadset) proxy;
mIsProfileReady = true;
try {
- mConditionProfileConnection.signal();
+ mConditionProfileIsConnected.signal();
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
}
@Override
public void onServiceDisconnected(int profile) {
- mProfileConnectionlock.lock();
- mIsProfileReady = false;
- try {
- mConditionProfileConnection.signal();
- } finally {
- mProfileConnectionlock.unlock();
- }
}
}
}
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHidDeviceTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHidDeviceTest.java
index 030ee8d..f09ef85 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHidDeviceTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHidDeviceTest.java
@@ -59,8 +59,8 @@
private boolean mIsProfileReady;
private BluetoothAdapter mAdapter;
private UiAutomation mUiAutomation;
- private Condition mConditionProfileConnection;
- private ReentrantLock mProfileConnectionlock;
+ private Condition mConditionProfileIsConnected;
+ private ReentrantLock mProfileConnectedlock;
private BluetoothHidDevice mBluetoothHidDevice;
@@ -81,8 +81,8 @@
mAdapter = manager.getAdapter();
assertTrue(BTAdapterUtils.enableAdapter(mAdapter, mContext));
- mProfileConnectionlock = new ReentrantLock();
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
+ mProfileConnectedlock = new ReentrantLock();
+ mConditionProfileIsConnected = mProfileConnectedlock.newCondition();
mIsProfileReady = false;
mBluetoothHidDevice = null;
@@ -105,18 +105,6 @@
mUiAutomation.dropShellPermissionIdentity();
}
- public void test_closeProfileProxy() {
- if (!(mHasBluetooth && mIsHidSupported)) return;
-
- assertTrue(waitForProfileConnect());
- assertNotNull(mBluetoothHidDevice);
- assertTrue(mIsProfileReady);
-
- mAdapter.closeProfileProxy(BluetoothProfile.HID_DEVICE, mBluetoothHidDevice);
- assertTrue(waitForProfileDisconnect());
- assertFalse(mIsProfileReady);
- }
-
public void test_getDevicesMatchingConnectionStates() {
if (!(mHasBluetooth && mIsHidSupported)) return;
@@ -214,12 +202,13 @@
testDevice, BluetoothProfile.CONNECTION_POLICY_FORBIDDEN));
}
+
private boolean waitForProfileConnect() {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
// Wait for the Adapter to be disabled
while (!mIsProfileReady) {
- if (!mConditionProfileConnection.await(
+ if (!mConditionProfileIsConnected.await(
PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
// Timeout
Log.e(TAG, "Timeout while waiting for Profile Connect");
@@ -229,54 +218,28 @@
} catch (InterruptedException e) {
Log.e(TAG, "waitForProfileConnect: interrrupted");
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
return mIsProfileReady;
}
- private boolean waitForProfileDisconnect() {
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
- mProfileConnectionlock.lock();
- try {
- while (mIsProfileReady) {
- if (!mConditionProfileConnection.await(
- PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
- // Timeout
- Log.e(TAG, "Timeout while waiting for Profile Disconnect");
- break;
- } // else spurious wakeups
- }
- } catch (InterruptedException e) {
- Log.e(TAG, "waitForProfileDisconnect: interrrupted");
- } finally {
- mProfileConnectionlock.unlock();
- }
- return !mIsProfileReady;
- }
-
private final class BluetoothHidServiceListener implements
BluetoothProfile.ServiceListener {
@Override
public void onServiceConnected(int profile, BluetoothProfile proxy) {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
mBluetoothHidDevice = (BluetoothHidDevice) proxy;
mIsProfileReady = true;
try {
- mConditionProfileConnection.signal();
+ mConditionProfileIsConnected.signal();
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
}
@Override
public void onServiceDisconnected(int profile) {
- mProfileConnectionlock.lock();
- mIsProfileReady = false;
- try {
- mConditionProfileConnection.signal();
- } finally {
- mProfileConnectionlock.unlock();
- }
+
}
}
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHidHostTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHidHostTest.java
index c4fe6b6..f401ba7 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHidHostTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHidHostTest.java
@@ -50,8 +50,8 @@
private UiAutomation mUiAutomation;
private boolean mIsProfileReady;
- private Condition mConditionProfileConnection;
- private ReentrantLock mProfileConnectionlock;
+ private Condition mConditionProfileIsConnected;
+ private ReentrantLock mProfileConnectedlock;
@Override
public void setUp() throws Exception {
@@ -71,8 +71,8 @@
mAdapter = manager.getAdapter();
assertTrue(BTAdapterUtils.enableAdapter(mAdapter, mContext));
- mProfileConnectionlock = new ReentrantLock();
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
+ mProfileConnectedlock = new ReentrantLock();
+ mConditionProfileIsConnected = mProfileConnectedlock.newCondition();
mIsProfileReady = false;
mHidHost = null;
@@ -93,18 +93,6 @@
mAdapter = null;
}
- public void test_closeProfileProxy() {
- if (!(mHasBluetooth && mIsHidHostSupported)) return;
-
- assertTrue(waitForProfileConnect());
- assertNotNull(mHidHost);
- assertTrue(mIsProfileReady);
-
- mAdapter.closeProfileProxy(BluetoothProfile.HID_HOST, mHidHost);
- assertTrue(waitForProfileDisconnect());
- assertFalse(mIsProfileReady);
- }
-
public void test_getConnectedDevices() {
if (!(mHasBluetooth && mIsHidHostSupported)) return;
@@ -211,11 +199,11 @@
}
private boolean waitForProfileConnect() {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
// Wait for the Adapter to be disabled
while (!mIsProfileReady) {
- if (!mConditionProfileConnection.await(
+ if (!mConditionProfileIsConnected.await(
PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
// Timeout
Log.e(TAG, "Timeout while waiting for Profile Connect");
@@ -225,54 +213,28 @@
} catch (InterruptedException e) {
Log.e(TAG, "waitForProfileConnect: interrupted");
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
return mIsProfileReady;
}
- private boolean waitForProfileDisconnect() {
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
- mProfileConnectionlock.lock();
- try {
- while (mIsProfileReady) {
- if (!mConditionProfileConnection.await(
- PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
- // Timeout
- Log.e(TAG, "Timeout while waiting for Profile Disconnect");
- break;
- } // else spurious wakeups
- }
- } catch (InterruptedException e) {
- Log.e(TAG, "waitForProfileDisconnect: interrrupted");
- } finally {
- mProfileConnectionlock.unlock();
- }
- return !mIsProfileReady;
- }
-
private final class BluetoothHidHostListener implements BluetoothProfile.ServiceListener {
@Override
public void onServiceConnected(int profile, BluetoothProfile proxy) {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
mHidHost = (BluetoothHidHost) proxy;
mIsProfileReady = true;
- mConditionProfileConnection.signal();
+ mConditionProfileIsConnected.signal();
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
}
@Override
public void onServiceDisconnected(int profile) {
- mProfileConnectionlock.lock();
- mIsProfileReady = false;
- try {
- mConditionProfileConnection.signal();
- } finally {
- mProfileConnectionlock.unlock();
- }
+ // Do nothing
}
}
}
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeAudioTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeAudioTest.java
index 8e1905c..d5e42f2 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeAudioTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeAudioTest.java
@@ -54,8 +54,8 @@
private BluetoothLeAudio mBluetoothLeAudio;
private boolean mIsLeAudioSupported;
private boolean mIsProfileReady;
- private Condition mConditionProfileConnection;
- private ReentrantLock mProfileConnectionlock;
+ private Condition mConditionProfileIsConnected;
+ private ReentrantLock mProfileConnectedlock;
private Executor mTestExecutor;
private TestCallback mTestCallback;
private boolean mCodecConfigChangedCalled;
@@ -124,8 +124,8 @@
mAdapter = manager.getAdapter();
assertTrue(BTAdapterUtils.enableAdapter(mAdapter, mContext));
- mProfileConnectionlock = new ReentrantLock();
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
+ mProfileConnectedlock = new ReentrantLock();
+ mConditionProfileIsConnected = mProfileConnectedlock.newCondition();
mIsProfileReady = false;
mBluetoothLeAudio = null;
@@ -156,18 +156,6 @@
mAdapter = null;
}
- public void test_closeProfileProxy() {
- if (!(mHasBluetooth && mIsLeAudioSupported)) return;
-
- assertTrue(waitForProfileConnect());
- assertNotNull(mBluetoothLeAudio);
- assertTrue(mIsProfileReady);
-
- mAdapter.closeProfileProxy(BluetoothProfile.LE_AUDIO, mBluetoothLeAudio);
- assertTrue(waitForProfileDisconnect());
- assertFalse(mIsProfileReady);
- }
-
public void test_getConnectedDevices() {
if (!(mHasBluetooth && mIsLeAudioSupported)) return;
@@ -369,11 +357,11 @@
}
private boolean waitForProfileConnect() {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
// Wait for the Adapter to be disabled
while (!mIsProfileReady) {
- if (!mConditionProfileConnection.await(
+ if (!mConditionProfileIsConnected.await(
PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
// Timeout
Log.e(TAG, "Timeout while waiting for Profile Connect");
@@ -383,55 +371,28 @@
} catch (InterruptedException e) {
Log.e(TAG, "waitForProfileConnect: interrrupted");
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
return mIsProfileReady;
}
- private boolean waitForProfileDisconnect() {
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
- mProfileConnectionlock.lock();
- try {
- while (mIsProfileReady) {
- if (!mConditionProfileConnection.await(
- PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
- // Timeout
- Log.e(TAG, "Timeout while waiting for Profile Disconnect");
- break;
- } // else spurious wakeups
- }
- } catch (InterruptedException e) {
- Log.e(TAG, "waitForProfileDisconnect: interrrupted");
- } finally {
- mProfileConnectionlock.unlock();
- }
- return !mIsProfileReady;
- }
-
private final class BluetoothLeAudioServiceListener implements
BluetoothProfile.ServiceListener {
@Override
public void onServiceConnected(int profile, BluetoothProfile proxy) {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
mBluetoothLeAudio = (BluetoothLeAudio) proxy;
mIsProfileReady = true;
try {
- mConditionProfileConnection.signal();
+ mConditionProfileIsConnected.signal();
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
}
@Override
public void onServiceDisconnected(int profile) {
- mProfileConnectionlock.lock();
- mIsProfileReady = false;
- try {
- mConditionProfileConnection.signal();
- } finally {
- mProfileConnectionlock.unlock();
- }
}
}
}
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeBroadcastAssistantTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeBroadcastAssistantTest.java
index 09df2bb..bd49353 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeBroadcastAssistantTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeBroadcastAssistantTest.java
@@ -98,8 +98,8 @@
private BluetoothLeBroadcastAssistant mBluetoothLeBroadcastAssistant;
private boolean mIsBroadcastAssistantSupported;
private boolean mIsProfileReady;
- private Condition mConditionProfileConnection;
- private ReentrantLock mProfileConnectionlock;
+ private Condition mConditionProfileIsConnected;
+ private ReentrantLock mProfileConnectedLock;
@Mock
BluetoothLeBroadcastAssistant.Callback mCallbacks;
@@ -120,8 +120,8 @@
mAdapter = TestUtils.getBluetoothAdapterOrDie();
assertTrue(BTAdapterUtils.enableAdapter(mAdapter, mContext));
- mProfileConnectionlock = new ReentrantLock();
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
+ mProfileConnectedLock = new ReentrantLock();
+ mConditionProfileIsConnected = mProfileConnectedLock.newCondition();
mIsProfileReady = false;
mBluetoothLeBroadcastAssistant = null;
@@ -153,22 +153,6 @@
}
@Test
- public void testCloseProfileProxy() {
- if (shouldSkipTest()) {
- return;
- }
-
- assertTrue(waitForProfileConnect());
- assertNotNull(mBluetoothLeBroadcastAssistant);
- assertTrue(mIsProfileReady);
-
- mAdapter.closeProfileProxy(
- BluetoothProfile.LE_AUDIO_BROADCAST_ASSISTANT, mBluetoothLeBroadcastAssistant);
- assertTrue(waitForProfileDisconnect());
- assertFalse(mIsProfileReady);
- }
-
- @Test
public void testAddSource() {
if (shouldSkipTest()) {
return;
@@ -554,11 +538,11 @@
}
private boolean waitForProfileConnect() {
- mProfileConnectionlock.lock();
+ mProfileConnectedLock.lock();
try {
// Wait for the Adapter to be disabled
while (!mIsProfileReady) {
- if (!mConditionProfileConnection.await(
+ if (!mConditionProfileIsConnected.await(
PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
// Timeout
Log.e(TAG, "Timeout while waiting for Profile Connect");
@@ -568,54 +552,27 @@
} catch (InterruptedException e) {
Log.e(TAG, "waitForProfileConnect: interrrupted");
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedLock.unlock();
}
return mIsProfileReady;
}
- private boolean waitForProfileDisconnect() {
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
- mProfileConnectionlock.lock();
- try {
- while (mIsProfileReady) {
- if (!mConditionProfileConnection.await(
- PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
- // Timeout
- Log.e(TAG, "Timeout while waiting for Profile Disconnect");
- break;
- } // else spurious wakeups
- }
- } catch (InterruptedException e) {
- Log.e(TAG, "waitForProfileDisconnect: interrrupted");
- } finally {
- mProfileConnectionlock.unlock();
- }
- return !mIsProfileReady;
- }
-
private final class ServiceListener implements BluetoothProfile.ServiceListener {
@Override
public void onServiceConnected(int profile, BluetoothProfile proxy) {
- mProfileConnectionlock.lock();
+ mProfileConnectedLock.lock();
mBluetoothLeBroadcastAssistant = (BluetoothLeBroadcastAssistant) proxy;
mIsProfileReady = true;
try {
- mConditionProfileConnection.signal();
+ mConditionProfileIsConnected.signal();
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedLock.unlock();
}
}
@Override
public void onServiceDisconnected(int profile) {
- mProfileConnectionlock.lock();
- mIsProfileReady = false;
- try {
- mConditionProfileConnection.signal();
- } finally {
- mProfileConnectionlock.unlock();
- }
}
}
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeBroadcastTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeBroadcastTest.java
index 7b72649..6dae0ba 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeBroadcastTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeBroadcastTest.java
@@ -93,8 +93,8 @@
private BluetoothLeBroadcast mBluetoothLeBroadcast;
private boolean mIsLeBroadcastSupported;
private boolean mIsProfileReady;
- private Condition mConditionProfileConnection;
- private ReentrantLock mProfileConnectionlock;
+ private Condition mConditionProfileIsConnected;
+ private ReentrantLock mProfileConnectedlock;
private boolean mOnBroadcastStartedCalled = false;
private boolean mOnBroadcastStartFailedCalled = false;
@@ -167,8 +167,8 @@
mAdapter = TestUtils.getBluetoothAdapterOrDie();
assertTrue(BTAdapterUtils.enableAdapter(mAdapter, mContext));
- mProfileConnectionlock = new ReentrantLock();
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
+ mProfileConnectedlock = new ReentrantLock();
+ mConditionProfileIsConnected = mProfileConnectedlock.newCondition();
mIsProfileReady = false;
mBluetoothLeBroadcast = null;
@@ -204,21 +204,6 @@
}
@Test
- public void testCloseProfileProxy() {
- if (shouldSkipTest()) {
- return;
- }
-
- assertTrue(waitForProfileConnect());
- assertNotNull(mBluetoothLeBroadcast);
- assertTrue(mIsProfileReady);
-
- mAdapter.closeProfileProxy(BluetoothProfile.LE_AUDIO_BROADCAST, mBluetoothLeBroadcast);
- assertTrue(waitForProfileDisconnect());
- assertFalse(mIsProfileReady);
- }
-
- @Test
public void testGetConnectedDevices() {
if (shouldSkipTest()) {
return;
@@ -564,11 +549,11 @@
}
private boolean waitForProfileConnect() {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
// Wait for the Adapter to be disabled
while (!mIsProfileReady) {
- if (!mConditionProfileConnection.await(
+ if (!mConditionProfileIsConnected.await(
PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
// Timeout
Log.e(TAG, "Timeout while waiting for Profile Connect");
@@ -578,55 +563,28 @@
} catch (InterruptedException e) {
Log.e(TAG, "waitForProfileConnect: interrrupted");
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
return mIsProfileReady;
}
- private boolean waitForProfileDisconnect() {
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
- mProfileConnectionlock.lock();
- try {
- while (mIsProfileReady) {
- if (!mConditionProfileConnection.await(
- PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
- // Timeout
- Log.e(TAG, "Timeout while waiting for Profile Disconnect");
- break;
- } // else spurious wakeups
- }
- } catch (InterruptedException e) {
- Log.e(TAG, "waitForProfileDisconnect: interrrupted");
- } finally {
- mProfileConnectionlock.unlock();
- }
- return !mIsProfileReady;
- }
-
private final class ServiceListener implements
BluetoothProfile.ServiceListener {
@Override
public void onServiceConnected(int profile, BluetoothProfile proxy) {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
mBluetoothLeBroadcast = (BluetoothLeBroadcast) proxy;
mIsProfileReady = true;
try {
- mConditionProfileConnection.signal();
+ mConditionProfileIsConnected.signal();
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
}
@Override
public void onServiceDisconnected(int profile) {
- mProfileConnectionlock.lock();
- mIsProfileReady = false;
- try {
- mConditionProfileConnection.signal();
- } finally {
- mProfileConnectionlock.unlock();
- }
}
}
}
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothMapClientTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothMapClientTest.java
index 34f0f52..c0a3037 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothMapClientTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothMapClientTest.java
@@ -62,8 +62,8 @@
private BluetoothMapClient mBluetoothMapClient;
private boolean mIsMapClientSupported;
private boolean mIsProfileReady;
- private Condition mConditionProfileConnection;
- private ReentrantLock mProfileConnectionlock;
+ private Condition mConditionProfileIsConnected;
+ private ReentrantLock mProfileConnectedlock;
@Override
public void setUp() throws Exception {
@@ -83,8 +83,8 @@
mAdapter = manager.getAdapter();
assertTrue(BTAdapterUtils.enableAdapter(mAdapter, mContext));
- mProfileConnectionlock = new ReentrantLock();
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
+ mProfileConnectedlock = new ReentrantLock();
+ mConditionProfileIsConnected = mProfileConnectedlock.newCondition();
mIsProfileReady = false;
mBluetoothMapClient = null;
@@ -108,18 +108,6 @@
mAdapter = null;
}
- public void test_closeProfileProxy() {
- if (!(mHasBluetooth && mIsMapClientSupported)) return;
-
- assertTrue(waitForProfileConnect());
- assertNotNull(mBluetoothMapClient);
- assertTrue(mIsProfileReady);
-
- mAdapter.closeProfileProxy(BluetoothProfile.MAP_CLIENT, mBluetoothMapClient);
- assertTrue(waitForProfileDisconnect());
- assertFalse(mIsProfileReady);
- }
-
public void test_getConnectedDevices() {
if (!(mHasBluetooth && mIsMapClientSupported)) return;
@@ -234,11 +222,11 @@
}
private boolean waitForProfileConnect() {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
// Wait for the Adapter to be disabled
while (!mIsProfileReady) {
- if (!mConditionProfileConnection.await(
+ if (!mConditionProfileIsConnected.await(
PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
// Timeout
Log.e(TAG, "Timeout while waiting for Profile Connect");
@@ -248,55 +236,28 @@
} catch (InterruptedException e) {
Log.e(TAG, "waitForProfileConnect: interrrupted");
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
return mIsProfileReady;
}
- private boolean waitForProfileDisconnect() {
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
- mProfileConnectionlock.lock();
- try {
- while (mIsProfileReady) {
- if (!mConditionProfileConnection.await(
- PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
- // Timeout
- Log.e(TAG, "Timeout while waiting for Profile Disconnect");
- break;
- } // else spurious wakeups
- }
- } catch (InterruptedException e) {
- Log.e(TAG, "waitForProfileDisconnect: interrrupted");
- } finally {
- mProfileConnectionlock.unlock();
- }
- return !mIsProfileReady;
- }
-
private final class BluetoothMapClientServiceListener implements
BluetoothProfile.ServiceListener {
@Override
public void onServiceConnected(int profile, BluetoothProfile proxy) {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
mBluetoothMapClient = (BluetoothMapClient) proxy;
mIsProfileReady = true;
try {
- mConditionProfileConnection.signal();
+ mConditionProfileIsConnected.signal();
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
}
@Override
public void onServiceDisconnected(int profile) {
- mProfileConnectionlock.lock();
- mIsProfileReady = false;
- try {
- mConditionProfileConnection.signal();
- } finally {
- mProfileConnectionlock.unlock();
- }
}
}
}
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothMapTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothMapTest.java
index 0e5da68..bdc5d42 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothMapTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothMapTest.java
@@ -51,8 +51,8 @@
private BluetoothMap mBluetoothMap;
private boolean mIsMapSupported;
private boolean mIsProfileReady;
- private Condition mConditionProfileConnection;
- private ReentrantLock mProfileConnectionlock;
+ private Condition mConditionProfileIsConnected;
+ private ReentrantLock mProfileConnectedlock;
@Override
public void setUp() throws Exception {
@@ -72,8 +72,8 @@
mAdapter = manager.getAdapter();
assertTrue(BTAdapterUtils.enableAdapter(mAdapter, mContext));
- mProfileConnectionlock = new ReentrantLock();
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
+ mProfileConnectedlock = new ReentrantLock();
+ mConditionProfileIsConnected = mProfileConnectedlock.newCondition();
mIsProfileReady = false;
mBluetoothMap = null;
@@ -96,18 +96,6 @@
mAdapter = null;
}
- public void test_closeProfileProxy() {
- if (!(mHasBluetooth && mIsMapSupported)) return;
-
- assertTrue(waitForProfileConnect());
- assertNotNull(mBluetoothMap);
- assertTrue(mIsProfileReady);
-
- mAdapter.closeProfileProxy(BluetoothProfile.MAP, mBluetoothMap);
- assertTrue(waitForProfileDisconnect());
- assertFalse(mIsProfileReady);
- }
-
public void test_getConnectedDevices() {
if (!(mHasBluetooth && mIsMapSupported)) return;
@@ -195,11 +183,11 @@
}
private boolean waitForProfileConnect() {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
// Wait for the Adapter to be disabled
while (!mIsProfileReady) {
- if (!mConditionProfileConnection.await(
+ if (!mConditionProfileIsConnected.await(
PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
// Timeout
Log.e(TAG, "Timeout while waiting for Profile Connect");
@@ -209,55 +197,28 @@
} catch (InterruptedException e) {
Log.e(TAG, "waitForProfileConnect: interrupted");
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
return mIsProfileReady;
}
- private boolean waitForProfileDisconnect() {
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
- mProfileConnectionlock.lock();
- try {
- while (mIsProfileReady) {
- if (!mConditionProfileConnection.await(
- PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
- // Timeout
- Log.e(TAG, "Timeout while waiting for Profile Disconnect");
- break;
- } // else spurious wakeups
- }
- } catch (InterruptedException e) {
- Log.e(TAG, "waitForProfileDisconnect: interrrupted");
- } finally {
- mProfileConnectionlock.unlock();
- }
- return !mIsProfileReady;
- }
-
private final class BluetoothMapServiceListener implements
BluetoothProfile.ServiceListener {
@Override
public void onServiceConnected(int profile, BluetoothProfile proxy) {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
mBluetoothMap = (BluetoothMap) proxy;
mIsProfileReady = true;
- mConditionProfileConnection.signal();
+ mConditionProfileIsConnected.signal();
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
}
@Override
public void onServiceDisconnected(int profile) {
- mProfileConnectionlock.lock();
- mIsProfileReady = false;
- try {
- mConditionProfileConnection.signal();
- } finally {
- mProfileConnectionlock.unlock();
- }
}
}
}
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPanTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPanTest.java
index aa4ca29..11954a3 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPanTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPanTest.java
@@ -46,8 +46,8 @@
private BluetoothPan mBluetoothPan;
private boolean mIsPanSupported;
private boolean mIsProfileReady;
- private Condition mConditionProfileConnection;
- private ReentrantLock mProfileConnectionlock;
+ private Condition mConditionProfileIsConnected;
+ private ReentrantLock mProfileConnectedlock;
@Override
public void setUp() throws Exception {
@@ -66,8 +66,8 @@
mAdapter = manager.getAdapter();
assertTrue(BTAdapterUtils.enableAdapter(mAdapter, mContext));
- mProfileConnectionlock = new ReentrantLock();
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
+ mProfileConnectedlock = new ReentrantLock();
+ mConditionProfileIsConnected = mProfileConnectedlock.newCondition();
mIsProfileReady = false;
mBluetoothPan = null;
@@ -90,18 +90,6 @@
TestUtils.dropPermissionAsShellUid();
}
- public void test_closeProfileProxy() {
- if (!(mHasBluetooth && mIsPanSupported)) return;
-
- assertTrue(waitForProfileConnect());
- assertNotNull(mBluetoothPan);
- assertTrue(mIsProfileReady);
-
- mAdapter.closeProfileProxy(BluetoothProfile.PAN, mBluetoothPan);
- assertTrue(waitForProfileDisconnect());
- assertFalse(mIsProfileReady);
- }
-
public void test_getConnectedDevices() {
if (!(mHasBluetooth && mIsPanSupported)) return;
@@ -185,11 +173,11 @@
}
private boolean waitForProfileConnect() {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
// Wait for the Adapter to be disabled
while (!mIsProfileReady) {
- if (!mConditionProfileConnection.await(
+ if (!mConditionProfileIsConnected.await(
PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
// Timeout
Log.e(TAG, "Timeout while waiting for Profile Connect");
@@ -199,54 +187,27 @@
} catch (InterruptedException e) {
Log.e(TAG, "waitForProfileConnect: interrrupted");
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
return mIsProfileReady;
}
- private boolean waitForProfileDisconnect() {
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
- mProfileConnectionlock.lock();
- try {
- while (mIsProfileReady) {
- if (!mConditionProfileConnection.await(
- PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
- // Timeout
- Log.e(TAG, "Timeout while waiting for Profile Disconnect");
- break;
- } // else spurious wakeups
- }
- } catch (InterruptedException e) {
- Log.e(TAG, "waitForProfileDisconnect: interrrupted");
- } finally {
- mProfileConnectionlock.unlock();
- }
- return !mIsProfileReady;
- }
-
private final class BluetoothPanServiceListener implements BluetoothProfile.ServiceListener {
@Override
public void onServiceConnected(int profile, BluetoothProfile proxy) {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
mBluetoothPan = (BluetoothPan) proxy;
mIsProfileReady = true;
try {
- mConditionProfileConnection.signal();
+ mConditionProfileIsConnected.signal();
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
}
@Override
public void onServiceDisconnected(int profile) {
- mProfileConnectionlock.lock();
- mIsProfileReady = false;
- try {
- mConditionProfileConnection.signal();
- } finally {
- mProfileConnectionlock.unlock();
- }
}
}
}
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPbapClientTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPbapClientTest.java
index dcdd677..1ce2b0b 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPbapClientTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPbapClientTest.java
@@ -48,8 +48,8 @@
private BluetoothPbapClient mBluetoothPbapClient;
private boolean mIsPbapClientSupported;
private boolean mIsProfileReady;
- private Condition mConditionProfileConnection;
- private ReentrantLock mProfileConnectionlock;
+ private Condition mConditionProfileIsConnected;
+ private ReentrantLock mProfileConnectedlock;
@Override
public void setUp() throws Exception {
@@ -68,8 +68,8 @@
mAdapter = manager.getAdapter();
assertTrue(BTAdapterUtils.enableAdapter(mAdapter, mContext));
- mProfileConnectionlock = new ReentrantLock();
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
+ mProfileConnectedlock = new ReentrantLock();
+ mConditionProfileIsConnected = mProfileConnectedlock.newCondition();
mIsProfileReady = false;
mBluetoothPbapClient = null;
@@ -92,18 +92,6 @@
mAdapter = null;
}
- public void test_closeProfileProxy() {
- if (!(mHasBluetooth && mIsPbapClientSupported)) return;
-
- assertTrue(waitForProfileConnect());
- assertNotNull(mBluetoothPbapClient);
- assertTrue(mIsProfileReady);
-
- mAdapter.closeProfileProxy(BluetoothProfile.PBAP_CLIENT, mBluetoothPbapClient);
- assertTrue(waitForProfileDisconnect());
- assertFalse(mIsProfileReady);
- }
-
public void test_getConnectedDevices() {
if (!(mHasBluetooth && mIsPbapClientSupported)) return;
@@ -191,11 +179,11 @@
}
private boolean waitForProfileConnect() {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
// Wait for the Adapter to be disabled
while (!mIsProfileReady) {
- if (!mConditionProfileConnection.await(
+ if (!mConditionProfileIsConnected.await(
PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
// Timeout
Log.e(TAG, "Timeout while waiting for Profile Connect");
@@ -205,55 +193,28 @@
} catch (InterruptedException e) {
Log.e(TAG, "waitForProfileConnect: interrrupted");
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
return mIsProfileReady;
}
- private boolean waitForProfileDisconnect() {
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
- mProfileConnectionlock.lock();
- try {
- while (mIsProfileReady) {
- if (!mConditionProfileConnection.await(
- PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
- // Timeout
- Log.e(TAG, "Timeout while waiting for Profile Disconnect");
- break;
- } // else spurious wakeups
- }
- } catch (InterruptedException e) {
- Log.e(TAG, "waitForProfileDisconnect: interrrupted");
- } finally {
- mProfileConnectionlock.unlock();
- }
- return !mIsProfileReady;
- }
-
private final class BluetoothPbapClientServiceListener implements
BluetoothProfile.ServiceListener {
@Override
public void onServiceConnected(int profile, BluetoothProfile proxy) {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
mBluetoothPbapClient = (BluetoothPbapClient) proxy;
mIsProfileReady = true;
try {
- mConditionProfileConnection.signal();
+ mConditionProfileIsConnected.signal();
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
}
@Override
public void onServiceDisconnected(int profile) {
- mProfileConnectionlock.lock();
- mIsProfileReady = false;
- try {
- mConditionProfileConnection.signal();
- } finally {
- mProfileConnectionlock.unlock();
- }
}
}
}
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPbapTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPbapTest.java
index 05b6e91..fadffd9 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPbapTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPbapTest.java
@@ -49,8 +49,8 @@
private BluetoothPbap mBluetoothPbap;
private boolean mIsPbapSupported;
private boolean mIsProfileReady;
- private Condition mConditionProfileConnection;
- private ReentrantLock mProfileConnectionlock;
+ private Condition mConditionProfileIsConnected;
+ private ReentrantLock mProfileConnectedlock;
@Override
public void setUp() throws Exception {
@@ -70,8 +70,8 @@
mAdapter = manager.getAdapter();
assertTrue(BTAdapterUtils.enableAdapter(mAdapter, mContext));
- mProfileConnectionlock = new ReentrantLock();
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
+ mProfileConnectedlock = new ReentrantLock();
+ mConditionProfileIsConnected = mProfileConnectedlock.newCondition();
mIsProfileReady = false;
mBluetoothPbap = null;
@@ -94,18 +94,6 @@
mAdapter = null;
}
- public void test_closeProfileProxy() {
- if (!(mHasBluetooth && mIsPbapSupported)) return;
-
- assertTrue(waitForProfileConnect());
- assertNotNull(mBluetoothPbap);
- assertTrue(mIsProfileReady);
-
- mAdapter.closeProfileProxy(BluetoothProfile.PBAP, mBluetoothPbap);
- assertTrue(waitForProfileDisconnect());
- assertFalse(mIsProfileReady);
- }
-
public void test_getConnectedDevices() {
if (!(mHasBluetooth && mIsPbapSupported)) return;
@@ -174,11 +162,11 @@
}
private boolean waitForProfileConnect() {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
// Wait for the Adapter to be disabled
while (!mIsProfileReady) {
- if (!mConditionProfileConnection.await(
+ if (!mConditionProfileIsConnected.await(
PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
// Timeout
Log.e(TAG, "Timeout while waiting for Profile Connect");
@@ -188,55 +176,28 @@
} catch (InterruptedException e) {
Log.e(TAG, "waitForProfileConnect: interrupted");
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
return mIsProfileReady;
}
- private boolean waitForProfileDisconnect() {
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
- mProfileConnectionlock.lock();
- try {
- while (mIsProfileReady) {
- if (!mConditionProfileConnection.await(
- PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
- // Timeout
- Log.e(TAG, "Timeout while waiting for Profile Disconnect");
- break;
- } // else spurious wakeups
- }
- } catch (InterruptedException e) {
- Log.e(TAG, "waitForProfileDisconnect: interrrupted");
- } finally {
- mProfileConnectionlock.unlock();
- }
- return !mIsProfileReady;
- }
-
private final class BluetoothPbapServiceListener implements
BluetoothProfile.ServiceListener {
@Override
public void onServiceConnected(int profile, BluetoothProfile proxy) {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
mBluetoothPbap = (BluetoothPbap) proxy;
mIsProfileReady = true;
- mConditionProfileConnection.signal();
+ mConditionProfileIsConnected.signal();
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
}
@Override
public void onServiceDisconnected(int profile) {
- mProfileConnectionlock.lock();
- mIsProfileReady = false;
- try {
- mConditionProfileConnection.signal();
- } finally {
- mProfileConnectionlock.unlock();
- }
}
}
}
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothSapTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothSapTest.java
index 6da4b9a..9dad13a 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothSapTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothSapTest.java
@@ -48,8 +48,8 @@
private BluetoothSap mBluetoothSap;
private boolean mIsProfileReady;
- private Condition mConditionProfileConnection;
- private ReentrantLock mProfileConnectionlock;
+ private Condition mConditionProfileIsConnected;
+ private ReentrantLock mProfileConnectedlock;
private boolean mIsSapSupported;
@@ -70,8 +70,8 @@
mAdapter = getContext().getSystemService(BluetoothManager.class).getAdapter();
assertTrue(BTAdapterUtils.enableAdapter(mAdapter, mContext));
- mProfileConnectionlock = new ReentrantLock();
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
+ mProfileConnectedlock = new ReentrantLock();
+ mConditionProfileIsConnected = mProfileConnectedlock.newCondition();
mIsProfileReady = false;
mBluetoothSap = null;
@@ -93,18 +93,6 @@
}
}
- public void test_closeProfileProxy() {
- if (!(mHasBluetooth && mIsSapSupported)) return;
-
- assertTrue(waitForProfileConnect());
- assertNotNull(mBluetoothSap);
- assertTrue(mIsProfileReady);
-
- mAdapter.closeProfileProxy(BluetoothProfile.SAP, mBluetoothSap);
- assertTrue(waitForProfileDisconnect());
- assertFalse(mIsProfileReady);
- }
-
@MediumTest
public void test_getConnectedDevices() {
if (!mHasBluetooth || !mIsSapSupported) return;
@@ -169,11 +157,11 @@
}
private boolean waitForProfileConnect() {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
// Wait for the Adapter to be disabled
while (!mIsProfileReady) {
- if (!mConditionProfileConnection.await(
+ if (!mConditionProfileIsConnected.await(
PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
// Timeout
Log.e(TAG, "Timeout while waiting for Profile Connect");
@@ -183,54 +171,27 @@
} catch (InterruptedException e) {
Log.e(TAG, "waitForProfileConnect: interrrupted");
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
return mIsProfileReady;
}
- private boolean waitForProfileDisconnect() {
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
- mProfileConnectionlock.lock();
- try {
- while (mIsProfileReady) {
- if (!mConditionProfileConnection.await(
- PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
- // Timeout
- Log.e(TAG, "Timeout while waiting for Profile Disconnect");
- break;
- } // else spurious wakeups
- }
- } catch (InterruptedException e) {
- Log.e(TAG, "waitForProfileDisconnect: interrrupted");
- } finally {
- mProfileConnectionlock.unlock();
- }
- return !mIsProfileReady;
- }
-
private final class BluetoothSapServiceListener implements BluetoothProfile.ServiceListener {
@Override
public void onServiceConnected(int profile, BluetoothProfile proxy) {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
mBluetoothSap = (BluetoothSap) proxy;
mIsProfileReady = true;
try {
- mConditionProfileConnection.signal();
+ mConditionProfileIsConnected.signal();
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
}
@Override
public void onServiceDisconnected(int profile) {
- mProfileConnectionlock.lock();
- mIsProfileReady = false;
- try {
- mConditionProfileConnection.signal();
- } finally {
- mProfileConnectionlock.unlock();
- }
}
}
}
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothVolumeControlTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothVolumeControlTest.java
index 09c4308..32eeb02 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothVolumeControlTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothVolumeControlTest.java
@@ -47,8 +47,8 @@
private BluetoothVolumeControl mBluetoothVolumeControl;
private boolean mIsVolumeControlSupported;
private boolean mIsProfileReady;
- private Condition mConditionProfileConnection;
- private ReentrantLock mProfileConnectionlock;
+ private Condition mConditionProfileIsConnected;
+ private ReentrantLock mProfileConnectedlock;
private boolean mVolumeOffsetChangedCallbackCalled;
private TestCallback mTestCallback;
private Executor mTestExecutor;
@@ -78,8 +78,8 @@
mAdapter = manager.getAdapter();
assertTrue(BTAdapterUtils.enableAdapter(mAdapter, mContext));
- mProfileConnectionlock = new ReentrantLock();
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
+ mProfileConnectedlock = new ReentrantLock();
+ mConditionProfileIsConnected = mProfileConnectedlock.newCondition();
mIsProfileReady = false;
mBluetoothVolumeControl = null;
@@ -122,18 +122,6 @@
}
}
- public void testCloseProfileProxy() {
- if (!(mHasBluetooth && mIsVolumeControlSupported)) return;
-
- assertTrue(waitForProfileConnect());
- assertNotNull(mBluetoothVolumeControl);
- assertTrue(mIsProfileReady);
-
- mAdapter.closeProfileProxy(BluetoothProfile.VOLUME_CONTROL, mBluetoothVolumeControl);
- assertTrue(waitForProfileDisconnect());
- assertFalse(mIsProfileReady);
- }
-
public void testGetConnectedDevices() {
if (!(mHasBluetooth && mIsVolumeControlSupported)) return;
@@ -299,11 +287,11 @@
}
private boolean waitForProfileConnect() {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
// Wait for the Adapter to be disabled
while (!mIsProfileReady) {
- if (!mConditionProfileConnection.await(
+ if (!mConditionProfileIsConnected.await(
PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
// Timeout
Log.e(TAG, "Timeout while waiting for Profile Connect");
@@ -313,55 +301,28 @@
} catch (InterruptedException e) {
Log.e(TAG, "waitForProfileConnect: interrrupted");
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
return mIsProfileReady;
}
- private boolean waitForProfileDisconnect() {
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
- mProfileConnectionlock.lock();
- try {
- while (mIsProfileReady) {
- if (!mConditionProfileConnection.await(
- PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
- // Timeout
- Log.e(TAG, "Timeout while waiting for Profile Disconnect");
- break;
- } // else spurious wakeups
- }
- } catch (InterruptedException e) {
- Log.e(TAG, "waitForProfileDisconnect: interrrupted");
- } finally {
- mProfileConnectionlock.unlock();
- }
- return !mIsProfileReady;
- }
-
private final class BluetoothVolumeControlServiceListener implements
BluetoothProfile.ServiceListener {
@Override
public void onServiceConnected(int profile, BluetoothProfile proxy) {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
mBluetoothVolumeControl = (BluetoothVolumeControl) proxy;
mIsProfileReady = true;
try {
- mConditionProfileConnection.signal();
+ mConditionProfileIsConnected.signal();
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
}
@Override
public void onServiceDisconnected(int profile) {
- mProfileConnectionlock.lock();
- mIsProfileReady = false;
- try {
- mConditionProfileConnection.signal();
- } finally {
- mProfileConnectionlock.unlock();
- }
}
}
}
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/HearingAidProfileTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/HearingAidProfileTest.java
index 536d32b..6b5f2ec 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/HearingAidProfileTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/HearingAidProfileTest.java
@@ -69,8 +69,8 @@
private BroadcastReceiver mIntentReceiver;
private UiAutomation mUiAutomation;;
- private Condition mConditionProfileConnection;
- private ReentrantLock mProfileConnectionlock;
+ private Condition mConditionProfileIsConnected;
+ private ReentrantLock mProfileConnectedlock;
private boolean mIsProfileReady;
private static List<Integer> mValidConnectionStates = new ArrayList<Integer>(
@@ -94,8 +94,8 @@
mBluetoothAdapter = manager.getAdapter();
assertTrue(BTAdapterUtils.enableAdapter(mBluetoothAdapter, mContext));
- mProfileConnectionlock = new ReentrantLock();
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
+ mProfileConnectedlock = new ReentrantLock();
+ mConditionProfileIsConnected = mProfileConnectedlock.newCondition();
mIsProfileReady = false;
mService = null;
mBluetoothAdapter.getProfileProxy(getContext(), new HearingAidsServiceListener(),
@@ -110,18 +110,6 @@
mUiAutomation.dropShellPermissionIdentity();
}
- public void test_closeProfileProxy() {
- if (!(mIsBleSupported && mIsHearingAidSupported)) return;
-
- assertTrue(waitForProfileConnect());
- assertNotNull(mService);
- assertTrue(mIsProfileReady);
-
- mBluetoothAdapter.closeProfileProxy(BluetoothProfile.HEARING_AID, mService);
- assertTrue(waitForProfileDisconnect());
- assertFalse(mIsProfileReady);
- }
-
/**
* Basic test case to make sure that Hearing Aid Profile Proxy can connect.
*/
@@ -284,11 +272,11 @@
}
private boolean waitForProfileConnect() {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
// Wait for the Adapter to be disabled
while (!mIsProfileReady) {
- if (!mConditionProfileConnection.await(
+ if (!mConditionProfileIsConnected.await(
PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
// Timeout
Log.e(TAG, "Timeout while waiting for Profile Connect");
@@ -298,54 +286,30 @@
} catch(InterruptedException e) {
Log.e(TAG, "waitForProfileConnect: interrrupted");
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
return mIsProfileReady;
}
- private boolean waitForProfileDisconnect() {
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
- mProfileConnectionlock.lock();
- try {
- while (mIsProfileReady) {
- if (!mConditionProfileConnection.await(
- PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
- // Timeout
- Log.e(TAG, "Timeout while waiting for Profile Disconnect");
- break;
- } // else spurious wakeups
- }
- } catch (InterruptedException e) {
- Log.e(TAG, "waitForProfileDisconnect: interrrupted");
- } finally {
- mProfileConnectionlock.unlock();
- }
- return !mIsProfileReady;
- }
-
private final class HearingAidsServiceListener
implements BluetoothProfile.ServiceListener {
public void onServiceConnected(int profile, BluetoothProfile proxy) {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
mService = (BluetoothHearingAid) proxy;
mIsProfileReady = true;
try {
- mConditionProfileConnection.signal();
+ mConditionProfileIsConnected.signal();
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
}
public void onServiceDisconnected(int profile) {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
mIsProfileReady = false;
mService = null;
- try {
- mConditionProfileConnection.signal();
- } finally {
- mProfileConnectionlock.unlock();
- }
+ mProfileConnectedlock.unlock();
}
}