Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f1ade52b authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 12273892 from 31af5d58 to 24Q4-release

Change-Id: I00e09fdbdb3b621723c5ae1c6c2461f63a542c0b
parents bbd090ff 31af5d58
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -18,3 +18,4 @@ TestBeds:
      AndroidDevice: '*'
      BumbleDevice:
          - transport: 'pyusb:8087:0036'
          - transport: 'pyusb:8087:0036'
+1 −1
Original line number Diff line number Diff line
@@ -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:
+7 −0
Original line number Diff line number Diff line
@@ -399,3 +399,10 @@ flag {
    bug: "361263965"
}

flag {
    name: "leaudio_gmap_client"
    namespace: "bluetooth"
    description: "enable Gaming Audio Profile"
    bug: "353978074"
}
+10 −0
Original line number Diff line number Diff line
@@ -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
    }
}
+33 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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();
@@ -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));
    }

    /**
@@ -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;
                }
            };
@@ -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(
@@ -4232,6 +4262,9 @@ public final class BluetoothAdapter {
            } catch (RemoteException e) {
                throw e.rethrowAsRuntimeException();
            }
            if (Flags.broadcastAdapterStateWithCallback()) {
                sAdapterState = BluetoothAdapter.STATE_OFF;
            }
        }
        sServiceRegistered = wantRegistered;
    }
Loading