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

Commit 68d4c575 authored by Jin Seok Park's avatar Jin Seok Park
Browse files

Call listener when media button session is destroyed

Currently, onMediaKeyEventSessionChanged is not being called when
both the media button session and the media button receiver values
become null.

Bug: 171967523
Test: N/A
Change-Id: Id6154ff0dbae9b305eabb1fcd60f4e3316d98dda
parent 0ef85393
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -1048,10 +1048,11 @@ public final class MediaSessionManager {
         * has specified the target.
         * <p>
         * The session token can be {@link null} if the media button session is unset. In that case,
         * framework would dispatch to the last sessions's media button receiver. If the media
         * button receive isn't set as well, then it
         * packageName will return the package name of the last session's media button receiver, or
         * an empty string if the last session didn't set a media button receiver.
         *
         * @param packageName The package name who would receive the media key event. Can be empty.
         * @param packageName The package name of the component that will receive the media key
         *                    event. Can be empty.
         * @param sessionToken The media session's token. Can be {@code null}.
         */
        void onMediaKeyEventSessionChanged(@NonNull String packageName,
+2 −0
Original line number Diff line number Diff line
@@ -991,6 +991,8 @@ public class MediaSessionService extends SystemService implements Monitor {
                } else if (mCurrentFullUserRecord.mLastMediaButtonReceiverHolder != null) {
                    String packageName = mLastMediaButtonReceiverHolder.getPackageName();
                    callback.onMediaKeyEventSessionChanged(packageName, null);
                } else {
                    callback.onMediaKeyEventSessionChanged("", null);
                }
            } catch (RemoteException e) {
                Log.w(TAG, "Failed to pushAddressedPlayerChangedLocked", e);