From 103b98c64230e494cadd063493ad2b8dae89384b Mon Sep 17 00:00:00 2001 From: William Escande Date: Thu, 20 Mar 2025 13:49:55 -0700 Subject: getAdapterProxy: null-check re-order Bug: 404290817 Fix: 404290817 Bug: 404058947 Flag: EXEMPT bugfix obvious and without risk Test: atest CtsBluetoothTestCases Change-Id: I18e528e7324c81d710952425b7dfacf4a504bf40 --- framework/java/android/bluetooth/BluetoothAdapter.java | 6 +++--- 1 file 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 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 -- cgit v1.2.3-59-g8ed1b