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

Commit 3221828a authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Move set speakerphone out of async task executor.

This turned out to cause a regression related to switching to hearing
aids.  There are other set/clearcommunicationDevice operations elsewhere
in Telecom which are not part of the async task executor so we were seeing
race conditions where the clear hear doesn't happen before the set
in the Telecom BluetoothDeviceManager code.

For now we'll move this back out of the task executor since that was
only done to try and satisfy issues with Cuttlefish tests.

Test: Run CTS/Unit test suite.
Bug: 283198536
Change-Id: I9cc11eb11b59eb04b706a4bd6f61c1b7240a50c2
Merged-In: I9cc11eb11b59eb04b706a4bd6f61c1b7240a50c2
parent 218b3a80
Loading
Loading
Loading
Loading
+22 −20
Original line number Original line Diff line number Diff line
@@ -1734,7 +1734,7 @@ public class CallAudioRouteStateMachine extends StateMachine {
        final boolean hasAnyCalls = mCallsManager.hasAnyCalls();
        final boolean hasAnyCalls = mCallsManager.hasAnyCalls();
        // These APIs are all via two-way binder calls so can potentially block Telecom.  Since none
        // These APIs are all via two-way binder calls so can potentially block Telecom.  Since none
        // of this has to happen in the Telecom lock we'll offload it to the async executor.
        // of this has to happen in the Telecom lock we'll offload it to the async executor.
        mAsyncTaskExecutor.execute(() -> {

        AudioDeviceInfo speakerDevice = null;
        AudioDeviceInfo speakerDevice = null;
        for (AudioDeviceInfo info : mAudioManager.getAvailableCommunicationDevices()) {
        for (AudioDeviceInfo info : mAudioManager.getAvailableCommunicationDevices()) {
            if (info.getType() == AudioDeviceInfo.TYPE_BUILTIN_SPEAKER) {
            if (info.getType() == AudioDeviceInfo.TYPE_BUILTIN_SPEAKER) {
@@ -1755,7 +1755,9 @@ public class CallAudioRouteStateMachine extends StateMachine {
                mAudioManager.clearCommunicationDevice();
                mAudioManager.clearCommunicationDevice();
            }
            }
        }
        }
            mStatusBarNotifier.notifySpeakerphone(hasAnyCalls && speakerOn);
        final boolean isSpeakerOn = speakerOn;
        mAsyncTaskExecutor.execute(() -> {
            mStatusBarNotifier.notifySpeakerphone(hasAnyCalls && isSpeakerOn);
        });
        });
    }
    }