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

Commit 3d81c371 authored by Krzysztof Kopyściński's avatar Krzysztof Kopyściński
Browse files

ADM: fix switching between LEA and ASHA on same device

`setFallbackDeviceActiveLocked` shall take last removed device, not currently
one being set. This cause issues when for same device profile was switched,
and "new" device was `null` - disabling old profile. That would cause ADM to
enable again disabled profile.

Flag: EXEMPT, day-to-day bugfix
Bug: 383439955
Test: atest ActiveDeviceManagerTest
Change-Id: I33e8f00f647e7dc0837d56f141c840cb10a56ebb
parent e97e59c7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -719,7 +719,7 @@ public class ActiveDeviceManager implements AdapterService.BluetoothStateCallbac
                if ((!Utils.isDualModeAudioEnabled() && device == null)) {
                    Log.d(TAG, "HFP active device is null. Try to fallback to the active device.");
                    synchronized (mLock) {
                        setFallbackDeviceActiveLocked(null);
                        setFallbackDeviceActiveLocked(mHfpActiveDevice /* recentlyRemovedDevice */);
                    }
                }
            }
@@ -831,7 +831,7 @@ public class ActiveDeviceManager implements AdapterService.BluetoothStateCallbac
            if (device == null && !Utils.isDualModeAudioEnabled() && !isBroadcastingAudio()) {
                Log.d(TAG, "LE audio active device is null. Try to fallback to the active device.");
                synchronized (mLock) {
                    setFallbackDeviceActiveLocked(device);
                    setFallbackDeviceActiveLocked(mLeAudioActiveDevice /* recentlyRemovedDevice */);
                }
            }