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

Commit 2054db33 authored by Insun Kang's avatar Insun Kang
Browse files

MediaSessionService: Send MEDIA_BUTTON intents with foreground priority

Bug: 27179450
Change-Id: Id4f530e87fff67b0582d13ef5b5333f3eae2d927
parent 03f1e026
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -962,6 +962,7 @@ public class MediaSessionService extends SystemService implements Monitor {
                        mKeyEventReceiver.aquireWakeLockLocked();
                        mKeyEventReceiver.aquireWakeLockLocked();
                    }
                    }
                    Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
                    Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
                    mediaButtonIntent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
                    mediaButtonIntent.putExtra(Intent.EXTRA_KEY_EVENT, keyEvent);
                    mediaButtonIntent.putExtra(Intent.EXTRA_KEY_EVENT, keyEvent);
                    try {
                    try {
                        if (user.mLastMediaButtonReceiver != null) {
                        if (user.mLastMediaButtonReceiver != null) {
@@ -986,6 +987,7 @@ public class MediaSessionService extends SystemService implements Monitor {
                    }
                    }
                    // Fallback to legacy behavior
                    // Fallback to legacy behavior
                    Intent keyIntent = new Intent(Intent.ACTION_MEDIA_BUTTON, null);
                    Intent keyIntent = new Intent(Intent.ACTION_MEDIA_BUTTON, null);
                    keyIntent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
                    keyIntent.putExtra(Intent.EXTRA_KEY_EVENT, keyEvent);
                    keyIntent.putExtra(Intent.EXTRA_KEY_EVENT, keyEvent);
                    if (needWakeLock) {
                    if (needWakeLock) {
                        keyIntent.putExtra(EXTRA_WAKELOCK_ACQUIRED,
                        keyIntent.putExtra(EXTRA_WAKELOCK_ACQUIRED,