From 094e9f8046d758d5e585235cd1336d7696d9da07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Budnik?= Date: Tue, 30 Aug 2022 13:11:00 +0000 Subject: [PATCH] Revert "Enforce ComponentName belongs to caller app" This reverts commit ff7be9912fae5a04c2703a113160782dad9509a8. 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: I7da45dfedace793085da06697976d189e8e7fbdb Merged-In: Ibabff26c5a54e89c5dbe3a577f4c7739be6e2709 --- .../server/media/MediaSessionRecord.java | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/services/core/java/com/android/server/media/MediaSessionRecord.java b/services/core/java/com/android/server/media/MediaSessionRecord.java index d03cf06480830..02b7582a8637c 100644 --- a/services/core/java/com/android/server/media/MediaSessionRecord.java +++ b/services/core/java/com/android/server/media/MediaSessionRecord.java @@ -18,7 +18,6 @@ package com.android.server.media; import android.annotation.Nullable; import android.app.PendingIntent; -import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.ParceledListSlice; @@ -50,8 +49,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.util.Slog; import android.view.KeyEvent; @@ -837,30 +834,10 @@ public class MediaSessionRecord implements IBinder.DeathRecipient, MediaSessionR mHandler.post(MessageHandler.MSG_UPDATE_SESSION_STATE); } - private boolean checkComponentNamePackage(PendingIntent pi, String packageName) { - ComponentName componentName = null; - if (pi != null && pi.getIntent() != null) { - componentName = pi.getIntent().getComponent(); - } - - if(componentName != null - && !TextUtils.equals(packageName, componentName.getPackageName())) { - return false; - } - - return true; - } - @Override public void setMediaButtonReceiver(PendingIntent pi) throws RemoteException { final long token = Binder.clearCallingIdentity(); try { - if (!checkComponentNamePackage(pi, mPackageName)) { - EventLog.writeEvent(0x534e4554, "238177121", -1, ""); // SafetyNet logging - throw new IllegalArgumentException("Component Name package does not match " - + "package name provided to MediaSessionRecord."); - } - if ((mPolicies & SessionPolicyProvider.SESSION_POLICY_IGNORE_BUTTON_RECEIVER) != 0) { return;