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

Commit 6d5f80d1 authored by Adam Powell's avatar Adam Powell Committed by android-build-merger
Browse files

Backport ChooserTarget package source check from N

am: 82b9565b

* commit '82b9565b':
  Backport ChooserTarget package source check from N

Change-Id: Ic7e4a8e80829ccb0b2f60c572eea15d18d6658ec
parents 8c635e73 82b9565b
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -656,7 +656,19 @@ public class ChooserActivity extends ResolverActivity {
            }
            intent.setComponent(mChooserTarget.getComponentName());
            intent.putExtras(mChooserTarget.getIntentExtras());
            activity.startActivityAsCaller(intent, options, true, userId);

            // Important: we will ignore the target security checks in ActivityManager
            // if and only if the ChooserTarget's target package is the same package
            // where we got the ChooserTargetService that provided it. This lets a
            // ChooserTargetService provide a non-exported or permission-guarded target
            // to the chooser for the user to pick.
            //
            // If mSourceInfo is null, we got this ChooserTarget from the caller or elsewhere
            // so we'll obey the caller's normal security checks.
            final boolean ignoreTargetSecurity = mSourceInfo != null
                    && mSourceInfo.getResolvedComponentName().getPackageName()
                    .equals(mChooserTarget.getComponentName().getPackageName());
            activity.startActivityAsCaller(intent, options, ignoreTargetSecurity, userId);
            return true;
        }