Revert "Enforce ComponentName belongs to caller app"

Revert "[automerge] Enforce ComponentName belongs to caller app ..."

Revert submission 19459103-presubmit-am-994c84d568054c049282d3d0e9c67263

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.
Reverted Changes:
I206469e21:[automerge] Enforce ComponentName belongs to calle...
I06b4de6e2:[automerge] Enforce ComponentName belongs to calle...
Iac143d8bb:Enforce ComponentName belongs to caller app

Change-Id: Ibabff26c5a54e89c5dbe3a577f4c7739be6e2709
Merged-In: I2ec5fd036af1d35c6d3fe000ee41f3347f9aea41
This commit is contained in:
Iván Budnik
2022-08-30 12:48:09 +00:00
parent a28f866052
commit 8b7cf1993c
2 changed files with 0 additions and 25 deletions

View File

@@ -32,7 +32,6 @@ import android.os.Handler;
import android.os.PowerWhitelistManager; import android.os.PowerWhitelistManager;
import android.os.UserHandle; import android.os.UserHandle;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.EventLog;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
@@ -118,12 +117,6 @@ final class MediaButtonReceiverHolder {
int componentType = getComponentType(pendingIntent); int componentType = getComponentType(pendingIntent);
ComponentName componentName = getComponentName(pendingIntent, componentType); ComponentName componentName = getComponentName(pendingIntent, componentType);
if (componentName != null) { 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, return new MediaButtonReceiverHolder(userId, pendingIntent, componentName,
componentType); componentType);
} }

View File

@@ -53,7 +53,6 @@ import android.os.RemoteException;
import android.os.ResultReceiver; import android.os.ResultReceiver;
import android.os.SystemClock; import android.os.SystemClock;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.EventLog;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
@@ -935,14 +934,6 @@ public class MediaSessionRecord implements IBinder.DeathRecipient, MediaSessionR
@Override @Override
public void setMediaButtonReceiver(PendingIntent pi, String sessionPackageName) public void setMediaButtonReceiver(PendingIntent pi, String sessionPackageName)
throws RemoteException { 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(); final long token = Binder.clearCallingIdentity();
try { try {
if ((mPolicies & MediaSessionPolicyProvider.SESSION_POLICY_IGNORE_BUTTON_RECEIVER) if ((mPolicies & MediaSessionPolicyProvider.SESSION_POLICY_IGNORE_BUTTON_RECEIVER)
@@ -961,15 +952,6 @@ public class MediaSessionRecord implements IBinder.DeathRecipient, MediaSessionR
public void setMediaButtonBroadcastReceiver(ComponentName receiver) throws RemoteException { public void setMediaButtonBroadcastReceiver(ComponentName receiver) throws RemoteException {
final long token = Binder.clearCallingIdentity(); final long token = Binder.clearCallingIdentity();
try { 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) if ((mPolicies & MediaSessionPolicyProvider.SESSION_POLICY_IGNORE_BUTTON_RECEIVER)
!= 0) { != 0) {
return; return;