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

Skip to content
Commit 8d1376ef authored by Pranav Madapurmath's avatar Pranav Madapurmath
Browse files

Clean up onCommunicationDeviceChanged callback logic

Minor clean up for the recently added onCommunicationDeviceChanged
callback that is being used to listen to changes to the communication
device (only being used for speaker right now). Ensure that we only send
SPEAKER_ON when the current audio route isn't in speaker. Also, remove
the condition check on sending SPEAKER_OFF when the original pending
audio route is speaker. Considering a case where we switch from speaker
-> BT -> earpiece, we will wait for the following pending messages:
SPEAKER_OFF, BT_AUDIO_CONNECTED, BT_AUDIO_DISCONNECTED. If these
requests happen quickly and depending on when we receive the
onCommunicationDeviceChanged callback update for speaker, it might be
possible that we would've already processed the request to switch to
earpiece. In this case, the pending original route would be updated from
speaker to BT so when we do receive the update from the callback, we
wouldn't send the SPEAKER_OFF msg (inadvertently leaving the speakerphone
icon on in the notification bar).

Bug: 375473325
Test: Manual
Flag: EXEMPT bugfix
Change-Id: I98ac1376b5e1cb862fd1db748358071fb517d46a
parent 9c8427ea
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment