[RESTRICT AUTOMERGE] Do not send new Intent to non-exported activity when navigateUpTo

The new Intent was delivered to a non-exported activity while
#navigateUpTo was called from an Activity of a different uid.

Bug: 238605611
Test: atest StartActivityTests
Change-Id: I854dd825bfd9a2c08851980d480d1f3a177af6cf
Merged-In: I854dd825bfd9a2c08851980d480d1f3a177af6cf
This commit is contained in:
Louis Chang
2022-08-02 03:33:39 +00:00
parent 82a9fa1667
commit b9a9340645

View File

@@ -4308,7 +4308,23 @@ class ActivityStack extends ConfigurationContainer {
parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_TASK ||
parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_TOP ||
(destIntentFlags & Intent.FLAG_ACTIVITY_CLEAR_TOP) != 0) {
parent.deliverNewIntentLocked(callingUid, destIntent, srec.packageName);
boolean abort;
try {
final int callingPid = srec.app != null ? srec.app.getPid() : 0;
abort = !mStackSupervisor.checkStartAnyActivityPermission(destIntent,
parent.info, null /* resultWho */, -1 /* requestCode */, callingPid,
callingUid, srec.info.packageName, false /* ignoreTargetSecurity */,
false /* launchingInTask */, srec.app, null /* resultRecord */,
null /* resultRootTask */);
} catch (SecurityException e) {
abort = true;
}
if (abort) {
android.util.EventLog.writeEvent(0x534e4554, "238605611", callingUid, "");
foundParentInTask = false;
} else {
parent.deliverNewIntentLocked(callingUid, destIntent, srec.packageName);
}
} else {
try {
ActivityInfo aInfo = AppGlobals.getPackageManager().getActivityInfo(