Fix permission bypass in legacy shortcut am: b7b192bd7f

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/24751391

Change-Id: I9989130b7225de16297dadb0ab70febf3139ba28
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Pinyao Ting
2023-09-27 20:41:00 +00:00
committed by Automerger Merge Worker

View File

@@ -155,15 +155,8 @@ public class PackageManagerHelper {
public boolean hasPermissionForActivity(Intent intent, String srcPackage) {
// b/270152142
if (Intent.ACTION_CHOOSER.equals(intent.getAction())) {
final Bundle extras = intent.getExtras();
if (extras == null) {
return true;
}
// If given intent is ACTION_CHOOSER, verify srcPackage has permission over EXTRA_INTENT
intent = (Intent) extras.getParcelable(Intent.EXTRA_INTENT);
if (intent == null) {
return true;
}
// Chooser shortcuts is not a valid target
return false;
}
ResolveInfo target = mPm.resolveActivity(intent, 0);
if (target == null) {