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

Commit 8cc9bf9a authored by William Escande's avatar William Escande Committed by Gerrit Code Review
Browse files

Merge "Headset: RemoveActive prior to hold the lock" into main

parents 1d9c8da5 7495892b
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -884,12 +884,13 @@ public class ActiveDeviceManager implements AdapterService.BluetoothStateCallbac
            Log.d(TAG, "setHearingAidActiveDevice(" + device + ")"
                    + (device == null ? " hasFallbackDevice=" + hasFallbackDevice : ""));
        }
        synchronized (mLock) {

        final HearingAidService hearingAidService = mFactory.getHearingAidService();
        if (hearingAidService == null) {
            return false;
        }

        synchronized (mLock) {
            if (device == null) {
                if (!hearingAidService.removeActiveDevice(!hasFallbackDevice)) {
                    return false;
+4 −4
Original line number Diff line number Diff line
@@ -1382,11 +1382,11 @@ public class HeadsetService extends ProfileService {
    @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
    public boolean setActiveDevice(BluetoothDevice device) {
        Log.i(TAG, "setActiveDevice: device=" + device + ", " + Utils.getUidPidString());
        synchronized (mStateMachines) {
        if (device == null) {
            removeActiveDevice();
            return true;
        }
        synchronized (mStateMachines) {
            if (device.equals(mActiveDevice)) {
                Log.i(TAG, "setActiveDevice: device " + device + " is already active");
                return true;