summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--framework/java/android/bluetooth/BluetoothAdapter.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/framework/java/android/bluetooth/BluetoothAdapter.java b/framework/java/android/bluetooth/BluetoothAdapter.java
index 1b37497323..b7feb11e19 100644
--- a/framework/java/android/bluetooth/BluetoothAdapter.java
+++ b/framework/java/android/bluetooth/BluetoothAdapter.java
@@ -3460,14 +3460,14 @@ public final class BluetoothAdapter {
BiFunction<Context, BluetoothAdapter, BluetoothProfile> constructor =
PROFILE_CONSTRUCTORS.get(profile);
- BluetoothProfile profileProxy = constructor.apply(context, this);
- ProfileConnection connection = new ProfileConnection(profile, listener, executor);
-
if (constructor == null) {
Log.e(TAG, "getProfileProxy(): Unknown profile " + profile);
return false;
}
+ BluetoothProfile profileProxy = constructor.apply(context, this);
+ ProfileConnection connection = new ProfileConnection(profile, listener, executor);
+
synchronized (sProfileLock) {
// Synchronize with the binder callback to prevent performing the
// ProfileConnection.connect concurrently