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

Commit 3e75ae86 authored by Iván Budnik's avatar Iván Budnik Committed by Presubmit Automerger Backend
Browse files

[automerge] Enforce MediaButtonReceiver ComponentName belongs to app 2p: 863d396f

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20272083

Bug: 238177121
Change-Id: Id67e5e9ac44fff0e0036af155691ef3ed96388ad
Merged-In: I4aba866a9758366175ea4af0d434729ad98fa48d
parents 84b3aebc 863d396f
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ import android.os.RemoteException;
import android.os.ResultReceiver;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.EventLog;
import android.util.Log;
import android.view.KeyEvent;

@@ -952,6 +953,14 @@ public class MediaSessionRecord implements IBinder.DeathRecipient, MediaSessionR
        public void setMediaButtonBroadcastReceiver(ComponentName receiver) throws RemoteException {
            final long token = Binder.clearCallingIdentity();
            try {
                //mPackageName has been verified in MediaSessionService.enforcePackageName().
                if (receiver != null && !TextUtils.equals(
                        mPackageName, receiver.getPackageName())) {
                    EventLog.writeEvent(0x534e4554, "238177121", -1, ""); // SafetyNet logging.
                    throw new IllegalArgumentException("receiver does not belong to "
                            + "package name provided to MediaSessionRecord. Pkg = " + mPackageName
                            + ", Receiver Pkg = " + receiver.getPackageName());
                }
                if ((mPolicies & MediaSessionPolicyProvider.SESSION_POLICY_IGNORE_BUTTON_RECEIVER)
                        != 0) {
                    return;