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

Commit 720f8e1f authored by Iván Budnik's avatar Iván Budnik Committed by Android Build Coastguard Worker
Browse files

Revert "Enforce ComponentName belongs to caller app"

This reverts commit 7319e40b.

Reason for revert: b/241798893. Note: this fix is not the root cause of the breakage. It just exposes a previously unknown bug. See linked bug.

Change-Id: I2ec5fd036af1d35c6d3fe000ee41f3347f9aea41
Merged-In: I01bda0f5bf343d73c480ad64b562dd0a2ee46e30
(cherry picked from commit 8914ae87)
Merged-In: I2ec5fd036af1d35c6d3fe000ee41f3347f9aea41
parent 4775a027
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import android.os.Handler;
import android.os.PowerWhitelistManager;
import android.os.UserHandle;
import android.text.TextUtils;
import android.util.EventLog;
import android.util.Log;
import android.view.KeyEvent;

@@ -118,12 +117,6 @@ final class MediaButtonReceiverHolder {
        int componentType = getComponentType(pendingIntent);
        ComponentName componentName = getComponentName(pendingIntent, componentType);
        if (componentName != null) {
            if (!TextUtils.equals(componentName.getPackageName(), sessionPackageName)) {
                EventLog.writeEvent(0x534e4554, "238177121", -1, ""); // SafetyNet logging
                throw new IllegalArgumentException("ComponentName does not belong to "
                        + "sessionPackageName. sessionPackageName = " + sessionPackageName
                        + ", ComponentName pkg = " + componentName.getPackageName());
            }
            return new MediaButtonReceiverHolder(userId, pendingIntent, componentName,
                    componentType);
        }
+0 −19
Original line number Diff line number Diff line
@@ -52,8 +52,6 @@ import android.os.Process;
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;

@@ -940,14 +938,6 @@ public class MediaSessionRecord implements IBinder.DeathRecipient, MediaSessionR
        @Override
        public void setMediaButtonReceiver(PendingIntent pi, String sessionPackageName)
                throws RemoteException {
            //mPackageName has been verified in MediaSessionService.enforcePackageName().
            if (!TextUtils.equals(sessionPackageName, mPackageName)) {
                EventLog.writeEvent(0x534e4554, "238177121", -1, ""); // SafetyNet logging
                throw new IllegalArgumentException("sessionPackageName name does not match "
                        + "package name provided to MediaSessionRecord. sessionPackageName = "
                        + sessionPackageName + ", pkg = "
                        + mPackageName);
            }
            final long token = Binder.clearCallingIdentity();
            try {
                if ((mPolicies & MediaSessionPolicyProvider.SESSION_POLICY_IGNORE_BUTTON_RECEIVER)
@@ -966,15 +956,6 @@ 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;