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

Commit 02ed0129 authored by riddle_hsu's avatar riddle_hsu Committed by Sungsoo Lim
Browse files

MediaSession: Use Handler for sending a pending intent

When PendingIntent.send() is called with a null handler,
onSendFinished() will be called inside of the send() method.
Therefore in this case, if a thread holds a lock before
calling send(), and onSendFinished() also requires the lock,
a deadlock could happen.

Bug: 25653801
Change-Id: I71d9f708fc3d52b7b5713426ad6140cbf6e336ef
parent 1ee3e370
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -967,7 +967,7 @@ public class MediaSessionService extends SystemService implements Monitor {
                        if (user.mLastMediaButtonReceiver != null) {
                            user.mLastMediaButtonReceiver.send(getContext(),
                                    needWakeLock ? mKeyEventReceiver.mLastTimeoutId : -1,
                                    mediaButtonIntent, mKeyEventReceiver, null);
                                    mediaButtonIntent, mKeyEventReceiver, mHandler);
                        } else {
                            mediaButtonIntent.setComponent(user.mRestoredMediaButtonReceiver);
                            getContext().sendBroadcastAsUser(mediaButtonIntent,