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

Commit 6a59fa25 authored by Roman Birg's avatar Roman Birg Committed by Gerrit Code Review
Browse files

AudioService: don't launch music player while in call



If the option to launch the music player when inserting headphones is
enabled, do not launch the music player if the user is in a call, or
receiving one, or making one.

REF: CYNGNOS-290
Change-Id: I1e1d173fdd246154299b77227f0e1cbed449246b
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
(cherry picked from commit df6bcfea)
parent 6cff082c
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -4979,7 +4979,9 @@ public class AudioService extends IAudioService.Stub {
    {
        boolean launchPlayer = Settings.System.getIntForUser(mContext.getContentResolver(),
                Settings.System.HEADSET_CONNECT_PLAYER, 0, UserHandle.USER_CURRENT) != 0;
        if (launchPlayer) {

        TelecomManager tm = (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
        if (launchPlayer && !tm.isInCall()) {
            Intent playerIntent = new Intent(Intent.ACTION_MAIN);
            playerIntent.addCategory(Intent.CATEGORY_APP_MUSIC);
            playerIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);