Loading services/core/java/com/android/server/am/ActivityStackSupervisor.java +2 −1 Original line number Diff line number Diff line Loading @@ -4666,7 +4666,8 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D userId = task.userId; return mService.getActivityStartController().startActivityInPackage( task.mCallingUid, callingPid, callingUid, callingPackage, intent, null, null, null, 0, 0, options, userId, task, "startActivityFromRecents"); null, 0, 0, options, userId, task, "startActivityFromRecents", false /* validateIncomingUser */); } finally { if (windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY && task != null) { // If we are launching the task in the docked stack, put it into resizing mode so Loading services/core/java/com/android/server/am/ActivityStartController.java +28 −9 Original line number Diff line number Diff line Loading @@ -224,13 +224,33 @@ public class ActivityStartController { } } /** * If {@code validateIncomingUser} is true, check {@code targetUserId} against the real calling * user ID inferred from {@code realCallingUid}, then return the resolved user-id, taking into * account "current user", etc. * * If {@code validateIncomingUser} is false, it skips the above check, but instead * ensures {@code targetUserId} is a real user ID and not a special user ID such as * {@link android.os.UserHandle#USER_ALL}, etc. */ private int checkTargetUser(int targetUserId, boolean validateIncomingUser, int realCallingPid, int realCallingUid, String reason) { if (validateIncomingUser) { return mService.mUserController.handleIncomingUser(realCallingPid, realCallingUid, targetUserId, false, ALLOW_FULL_ONLY, reason, null); } else { mService.mUserController.ensureNotSpecialUser(targetUserId); return targetUserId; } } final int startActivityInPackage(int uid, int realCallingPid, int realCallingUid, String callingPackage, Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, int startFlags, SafeActivityOptions options, int userId, TaskRecord inTask, String reason) { int userId, TaskRecord inTask, String reason, boolean validateIncomingUser) { userId = mService.mUserController.handleIncomingUser(realCallingPid, realCallingUid, userId, false, ALLOW_FULL_ONLY, "startActivityInPackage", null); userId = checkTargetUser(userId, validateIncomingUser, realCallingPid, realCallingUid, reason); // TODO: Switch to user app stacks here. return obtainStarter(intent, reason) Loading Loading @@ -261,13 +281,12 @@ public class ActivityStartController { final int startActivitiesInPackage(int uid, String callingPackage, Intent[] intents, String[] resolvedTypes, IBinder resultTo, SafeActivityOptions options, int userId, boolean validateIncomingUser) { final String reason = "startActivityInPackage"; if (validateIncomingUser) { userId = mService.mUserController.handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), userId, false, ALLOW_FULL_ONLY, reason, null); } else { mService.mUserController.ensureNotSpecialUser(userId); } userId = checkTargetUser(userId, validateIncomingUser, Binder.getCallingPid(), Binder.getCallingUid(), reason); // TODO: Switch to user app stacks here. return startActivities(null, uid, callingPackage, intents, resolvedTypes, resultTo, options, userId, reason); Loading services/core/java/com/android/server/am/AppErrors.java +1 −1 Original line number Diff line number Diff line Loading @@ -483,7 +483,7 @@ class AppErrors { task.intent, null, null, null, 0, 0, new SafeActivityOptions(ActivityOptions.makeBasic()), task.userId, null, "AppErrors"); "AppErrors", false /*validateIncomingUser*/); } } } Loading services/core/java/com/android/server/am/PendingIntentRecord.java +9 −2 Original line number Diff line number Diff line Loading @@ -322,6 +322,11 @@ final class PendingIntentRecord extends IIntentSender.Stub { } else { mergedOptions.setCallerOptions(ActivityOptions.fromBundle(options)); } // Note when someone has a pending intent, even from different // users, then there's no need to ensure the calling user matches // the target user, so validateIncomingUser is always false below. if (key.allIntents != null && key.allIntents.length > 1) { Intent[] allIntents = new Intent[key.allIntents.length]; String[] allResolvedTypes = new String[key.allIntents.length]; Loading @@ -333,15 +338,17 @@ final class PendingIntentRecord extends IIntentSender.Stub { } allIntents[allIntents.length-1] = finalIntent; allResolvedTypes[allResolvedTypes.length-1] = resolvedType; res = owner.getActivityStartController().startActivitiesInPackage( uid, key.packageName, allIntents, allResolvedTypes, resultTo, mergedOptions, userId, true /* validateIncomingUser */); false /* validateIncomingUser */); } else { res = owner.getActivityStartController().startActivityInPackage(uid, callingPid, callingUid, key.packageName, finalIntent, resolvedType, resultTo, resultWho, requestCode, 0, mergedOptions, userId, null, "PendingIntentRecord"); mergedOptions, userId, null, "PendingIntentRecord", false /* validateIncomingUser */); } } catch (RuntimeException e) { Slog.w(TAG, "Unable to send startActivity intent", e); Loading Loading
services/core/java/com/android/server/am/ActivityStackSupervisor.java +2 −1 Original line number Diff line number Diff line Loading @@ -4666,7 +4666,8 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D userId = task.userId; return mService.getActivityStartController().startActivityInPackage( task.mCallingUid, callingPid, callingUid, callingPackage, intent, null, null, null, 0, 0, options, userId, task, "startActivityFromRecents"); null, 0, 0, options, userId, task, "startActivityFromRecents", false /* validateIncomingUser */); } finally { if (windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY && task != null) { // If we are launching the task in the docked stack, put it into resizing mode so Loading
services/core/java/com/android/server/am/ActivityStartController.java +28 −9 Original line number Diff line number Diff line Loading @@ -224,13 +224,33 @@ public class ActivityStartController { } } /** * If {@code validateIncomingUser} is true, check {@code targetUserId} against the real calling * user ID inferred from {@code realCallingUid}, then return the resolved user-id, taking into * account "current user", etc. * * If {@code validateIncomingUser} is false, it skips the above check, but instead * ensures {@code targetUserId} is a real user ID and not a special user ID such as * {@link android.os.UserHandle#USER_ALL}, etc. */ private int checkTargetUser(int targetUserId, boolean validateIncomingUser, int realCallingPid, int realCallingUid, String reason) { if (validateIncomingUser) { return mService.mUserController.handleIncomingUser(realCallingPid, realCallingUid, targetUserId, false, ALLOW_FULL_ONLY, reason, null); } else { mService.mUserController.ensureNotSpecialUser(targetUserId); return targetUserId; } } final int startActivityInPackage(int uid, int realCallingPid, int realCallingUid, String callingPackage, Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, int startFlags, SafeActivityOptions options, int userId, TaskRecord inTask, String reason) { int userId, TaskRecord inTask, String reason, boolean validateIncomingUser) { userId = mService.mUserController.handleIncomingUser(realCallingPid, realCallingUid, userId, false, ALLOW_FULL_ONLY, "startActivityInPackage", null); userId = checkTargetUser(userId, validateIncomingUser, realCallingPid, realCallingUid, reason); // TODO: Switch to user app stacks here. return obtainStarter(intent, reason) Loading Loading @@ -261,13 +281,12 @@ public class ActivityStartController { final int startActivitiesInPackage(int uid, String callingPackage, Intent[] intents, String[] resolvedTypes, IBinder resultTo, SafeActivityOptions options, int userId, boolean validateIncomingUser) { final String reason = "startActivityInPackage"; if (validateIncomingUser) { userId = mService.mUserController.handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), userId, false, ALLOW_FULL_ONLY, reason, null); } else { mService.mUserController.ensureNotSpecialUser(userId); } userId = checkTargetUser(userId, validateIncomingUser, Binder.getCallingPid(), Binder.getCallingUid(), reason); // TODO: Switch to user app stacks here. return startActivities(null, uid, callingPackage, intents, resolvedTypes, resultTo, options, userId, reason); Loading
services/core/java/com/android/server/am/AppErrors.java +1 −1 Original line number Diff line number Diff line Loading @@ -483,7 +483,7 @@ class AppErrors { task.intent, null, null, null, 0, 0, new SafeActivityOptions(ActivityOptions.makeBasic()), task.userId, null, "AppErrors"); "AppErrors", false /*validateIncomingUser*/); } } } Loading
services/core/java/com/android/server/am/PendingIntentRecord.java +9 −2 Original line number Diff line number Diff line Loading @@ -322,6 +322,11 @@ final class PendingIntentRecord extends IIntentSender.Stub { } else { mergedOptions.setCallerOptions(ActivityOptions.fromBundle(options)); } // Note when someone has a pending intent, even from different // users, then there's no need to ensure the calling user matches // the target user, so validateIncomingUser is always false below. if (key.allIntents != null && key.allIntents.length > 1) { Intent[] allIntents = new Intent[key.allIntents.length]; String[] allResolvedTypes = new String[key.allIntents.length]; Loading @@ -333,15 +338,17 @@ final class PendingIntentRecord extends IIntentSender.Stub { } allIntents[allIntents.length-1] = finalIntent; allResolvedTypes[allResolvedTypes.length-1] = resolvedType; res = owner.getActivityStartController().startActivitiesInPackage( uid, key.packageName, allIntents, allResolvedTypes, resultTo, mergedOptions, userId, true /* validateIncomingUser */); false /* validateIncomingUser */); } else { res = owner.getActivityStartController().startActivityInPackage(uid, callingPid, callingUid, key.packageName, finalIntent, resolvedType, resultTo, resultWho, requestCode, 0, mergedOptions, userId, null, "PendingIntentRecord"); mergedOptions, userId, null, "PendingIntentRecord", false /* validateIncomingUser */); } } catch (RuntimeException e) { Slog.w(TAG, "Unable to send startActivity intent", e); Loading