Loading android/pandora/test/config.yml +1 −0 Original line number Diff line number Diff line Loading @@ -18,3 +18,4 @@ TestBeds: AndroidDevice: '*' BumbleDevice: - transport: 'pyusb:8087:0036' - transport: 'pyusb:8087:0036' build.py +1 −1 Original line number Diff line number Diff line Loading @@ -380,7 +380,7 @@ class HostBuild(): 'enable_exceptions': os.environ.get('CXXEXCEPTIONS', 0) == '1', 'external_cflags': [], 'external_cxxflags': ["-DNDEBUG"], 'enable_werror': False, 'enable_werror': True, } if clang: Loading flags/leaudio.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -399,3 +399,10 @@ flag { bug: "361263965" } flag { name: "leaudio_gmap_client" namespace: "bluetooth" description: "enable Gaming Audio Profile" bug: "353978074" } flags/pairing.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -127,3 +127,13 @@ flag { purpose: PURPOSE_BUGFIX } } flag { name: "donot_queue_dup_rnr" namespace: "bluetooth" description: "Avoid queueing second RNR as part of ssp process" bug: "361839492" metadata { purpose: PURPOSE_BUGFIX } } framework/java/android/bluetooth/BluetoothAdapter.java +33 −0 Original line number Diff line number Diff line Loading @@ -96,8 +96,12 @@ import java.util.Map; import java.util.Set; import java.util.UUID; import java.util.WeakHashMap; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.function.BiFunction; import java.util.function.Consumer; Loading Loading @@ -873,6 +877,7 @@ public final class BluetoothAdapter { @GuardedBy("mServiceLock") private IBluetooth mService; private static CompletableFuture<Void> sAdapterStateFuture = null; private static int sAdapterState = BluetoothAdapter.STATE_OFF; private final ReentrantReadWriteLock mServiceLock = new ReentrantReadWriteLock(); Loading Loading @@ -1173,6 +1178,20 @@ public final class BluetoothAdapter { new CallbackWrapper( registerBluetoothConnectionCallbackConsumer, unregisterBluetoothConnectionCallbackConsumer); if (!Flags.broadcastAdapterStateWithCallback()) { return; } // Make sure that we are waiting on the state callback prior to returning from constructor CompletableFuture<Void> futureState = sAdapterStateFuture; if (futureState != null) { try { futureState.get(1_000, TimeUnit.MILLISECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } } Log.i(TAG, "Adapter created with state: " + nameForState(sAdapterState)); } /** Loading Loading @@ -3784,6 +3803,12 @@ public final class BluetoothAdapter { @RequiresNoPermission public void onBluetoothAdapterStateChange(int newState) { Log.v(TAG, "onBluetoothAdapterStateChange(" + nameForState(newState) + ")"); CompletableFuture<Void> future = sAdapterStateFuture; sAdapterStateFuture = null; if (future != null) { future.complete(null); } sAdapterState = newState; } }; Loading Loading @@ -4218,6 +4243,11 @@ public final class BluetoothAdapter { return; } if (wantRegistered) { if (Flags.broadcastAdapterStateWithCallback() && sAdapterState == BluetoothAdapter.STATE_OFF && sAdapterStateFuture == null) { sAdapterStateFuture = new CompletableFuture<>(); } try { sService = IBluetooth.Stub.asInterface( Loading @@ -4232,6 +4262,9 @@ public final class BluetoothAdapter { } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } if (Flags.broadcastAdapterStateWithCallback()) { sAdapterState = BluetoothAdapter.STATE_OFF; } } sServiceRegistered = wantRegistered; } Loading Loading
android/pandora/test/config.yml +1 −0 Original line number Diff line number Diff line Loading @@ -18,3 +18,4 @@ TestBeds: AndroidDevice: '*' BumbleDevice: - transport: 'pyusb:8087:0036' - transport: 'pyusb:8087:0036'
build.py +1 −1 Original line number Diff line number Diff line Loading @@ -380,7 +380,7 @@ class HostBuild(): 'enable_exceptions': os.environ.get('CXXEXCEPTIONS', 0) == '1', 'external_cflags': [], 'external_cxxflags': ["-DNDEBUG"], 'enable_werror': False, 'enable_werror': True, } if clang: Loading
flags/leaudio.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -399,3 +399,10 @@ flag { bug: "361263965" } flag { name: "leaudio_gmap_client" namespace: "bluetooth" description: "enable Gaming Audio Profile" bug: "353978074" }
flags/pairing.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -127,3 +127,13 @@ flag { purpose: PURPOSE_BUGFIX } } flag { name: "donot_queue_dup_rnr" namespace: "bluetooth" description: "Avoid queueing second RNR as part of ssp process" bug: "361839492" metadata { purpose: PURPOSE_BUGFIX } }
framework/java/android/bluetooth/BluetoothAdapter.java +33 −0 Original line number Diff line number Diff line Loading @@ -96,8 +96,12 @@ import java.util.Map; import java.util.Set; import java.util.UUID; import java.util.WeakHashMap; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.function.BiFunction; import java.util.function.Consumer; Loading Loading @@ -873,6 +877,7 @@ public final class BluetoothAdapter { @GuardedBy("mServiceLock") private IBluetooth mService; private static CompletableFuture<Void> sAdapterStateFuture = null; private static int sAdapterState = BluetoothAdapter.STATE_OFF; private final ReentrantReadWriteLock mServiceLock = new ReentrantReadWriteLock(); Loading Loading @@ -1173,6 +1178,20 @@ public final class BluetoothAdapter { new CallbackWrapper( registerBluetoothConnectionCallbackConsumer, unregisterBluetoothConnectionCallbackConsumer); if (!Flags.broadcastAdapterStateWithCallback()) { return; } // Make sure that we are waiting on the state callback prior to returning from constructor CompletableFuture<Void> futureState = sAdapterStateFuture; if (futureState != null) { try { futureState.get(1_000, TimeUnit.MILLISECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } } Log.i(TAG, "Adapter created with state: " + nameForState(sAdapterState)); } /** Loading Loading @@ -3784,6 +3803,12 @@ public final class BluetoothAdapter { @RequiresNoPermission public void onBluetoothAdapterStateChange(int newState) { Log.v(TAG, "onBluetoothAdapterStateChange(" + nameForState(newState) + ")"); CompletableFuture<Void> future = sAdapterStateFuture; sAdapterStateFuture = null; if (future != null) { future.complete(null); } sAdapterState = newState; } }; Loading Loading @@ -4218,6 +4243,11 @@ public final class BluetoothAdapter { return; } if (wantRegistered) { if (Flags.broadcastAdapterStateWithCallback() && sAdapterState == BluetoothAdapter.STATE_OFF && sAdapterStateFuture == null) { sAdapterStateFuture = new CompletableFuture<>(); } try { sService = IBluetooth.Stub.asInterface( Loading @@ -4232,6 +4262,9 @@ public final class BluetoothAdapter { } catch (RemoteException e) { throw e.rethrowAsRuntimeException(); } if (Flags.broadcastAdapterStateWithCallback()) { sAdapterState = BluetoothAdapter.STATE_OFF; } } sServiceRegistered = wantRegistered; } Loading