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

Commit d9bb5cd9 authored by Pinyao Ting's avatar Pinyao Ting Committed by Automerger Merge Worker
Browse files

Fix permission issue in legacy shortcut am: c53818a1 am: d19cb72b am: 3c771b12

parents 62edf72f 3c771b12
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -136,6 +136,18 @@ public class PackageManagerHelper {
     * any permissions
     * any permissions
     */
     */
    public boolean hasPermissionForActivity(Intent intent, String srcPackage) {
    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;
            }
        }
        ResolveInfo target = mPm.resolveActivity(intent, 0);
        ResolveInfo target = mPm.resolveActivity(intent, 0);
        if (target == null) {
        if (target == null) {
            // Not a valid target
            // Not a valid target