Loading services/core/java/com/android/server/am/ActivityManagerService.java +29 −2 Original line number Diff line number Diff line Loading @@ -5635,8 +5635,35 @@ public class ActivityManagerService extends IActivityManager.Stub IBinder allowlistToken, int code, Intent intent, String resolvedType, IIntentReceiver finishedReceiver, String requiredPermission, Bundle options) { if (target instanceof PendingIntentRecord) { return ((PendingIntentRecord) target).sendWithResult(caller, code, intent, resolvedType, allowlistToken, finishedReceiver, requiredPermission, options); final PendingIntentRecord originalRecord = (PendingIntentRecord) target; // In multi-display scenarios, there can be background users who execute the // PendingIntent. In these scenarios, we don't want to use the foreground user as the // current user. final PendingIntentRecord.Key originalKey = originalRecord.key; final UserManagerInternal umInternal = LocalServices.getService(UserManagerInternal.class); final int callingUserId = UserHandle.getCallingUserId(); if (UserManager.isVisibleBackgroundUsersEnabled() && originalKey.userId == UserHandle.USER_CURRENT && callingUserId != UserHandle.USER_SYSTEM && umInternal.isUserVisible(callingUserId)) { EventLogTags.writeAmIntentSenderRedirectUser(callingUserId); final PendingIntentRecord.Key key = new PendingIntentRecord.Key(originalKey.type, originalKey.packageName, originalKey.featureId, originalKey.activity, originalKey.who, originalKey.requestCode, originalKey.allIntents, originalKey.allResolvedTypes, originalKey.flags, originalKey.options, callingUserId); final PendingIntentRecord newRecord = new PendingIntentRecord( originalRecord.controller, key, originalRecord.uid); return newRecord.sendWithResult(caller, code, intent, resolvedType, allowlistToken, finishedReceiver, requiredPermission, options); } return originalRecord.sendWithResult(caller, code, intent, resolvedType, allowlistToken, finishedReceiver, requiredPermission, options); } else { if (intent == null) { // Weird case: someone has given us their own custom IIntentSender, and now Loading services/core/java/com/android/server/am/EventLogTags.logtags +4 −1 Original line number Diff line number Diff line # See system/core/logcat/event.logtags for a description of the format of this file. # See system/logging/logcat/event.logtags for a description of the format of this file. option java_package com.android.server.am Loading Loading @@ -125,3 +125,6 @@ option java_package com.android.server.am 30100 am_foreground_service_start (User|1|5),(Component Name|3),(allowWhileInUse|1),(startReasonCode|3),(targetSdk|1|1),(callerTargetSdk|1|1),(notificationWasDeferred|1),(notificationShown|1),(durationMs|1|3),(startForegroundCount|1|1),(stopReason|3) 30101 am_foreground_service_denied (User|1|5),(Component Name|3),(allowWhileInUse|1),(startReasonCode|3),(targetSdk|1|1),(callerTargetSdk|1|1),(notificationWasDeferred|1),(notificationShown|1),(durationMs|1|3),(startForegroundCount|1|1),(stopReason|3) 30102 am_foreground_service_stop (User|1|5),(Component Name|3),(allowWhileInUse|1),(startReasonCode|3),(targetSdk|1|1),(callerTargetSdk|1|1),(notificationWasDeferred|1),(notificationShown|1),(durationMs|1|3),(startForegroundCount|1|1),(stopReason|3) # Intent Sender redirect for UserHandle.USER_CURRENT 30110 am_intent_sender_redirect_user (userId|1|5) Loading
services/core/java/com/android/server/am/ActivityManagerService.java +29 −2 Original line number Diff line number Diff line Loading @@ -5635,8 +5635,35 @@ public class ActivityManagerService extends IActivityManager.Stub IBinder allowlistToken, int code, Intent intent, String resolvedType, IIntentReceiver finishedReceiver, String requiredPermission, Bundle options) { if (target instanceof PendingIntentRecord) { return ((PendingIntentRecord) target).sendWithResult(caller, code, intent, resolvedType, allowlistToken, finishedReceiver, requiredPermission, options); final PendingIntentRecord originalRecord = (PendingIntentRecord) target; // In multi-display scenarios, there can be background users who execute the // PendingIntent. In these scenarios, we don't want to use the foreground user as the // current user. final PendingIntentRecord.Key originalKey = originalRecord.key; final UserManagerInternal umInternal = LocalServices.getService(UserManagerInternal.class); final int callingUserId = UserHandle.getCallingUserId(); if (UserManager.isVisibleBackgroundUsersEnabled() && originalKey.userId == UserHandle.USER_CURRENT && callingUserId != UserHandle.USER_SYSTEM && umInternal.isUserVisible(callingUserId)) { EventLogTags.writeAmIntentSenderRedirectUser(callingUserId); final PendingIntentRecord.Key key = new PendingIntentRecord.Key(originalKey.type, originalKey.packageName, originalKey.featureId, originalKey.activity, originalKey.who, originalKey.requestCode, originalKey.allIntents, originalKey.allResolvedTypes, originalKey.flags, originalKey.options, callingUserId); final PendingIntentRecord newRecord = new PendingIntentRecord( originalRecord.controller, key, originalRecord.uid); return newRecord.sendWithResult(caller, code, intent, resolvedType, allowlistToken, finishedReceiver, requiredPermission, options); } return originalRecord.sendWithResult(caller, code, intent, resolvedType, allowlistToken, finishedReceiver, requiredPermission, options); } else { if (intent == null) { // Weird case: someone has given us their own custom IIntentSender, and now Loading
services/core/java/com/android/server/am/EventLogTags.logtags +4 −1 Original line number Diff line number Diff line # See system/core/logcat/event.logtags for a description of the format of this file. # See system/logging/logcat/event.logtags for a description of the format of this file. option java_package com.android.server.am Loading Loading @@ -125,3 +125,6 @@ option java_package com.android.server.am 30100 am_foreground_service_start (User|1|5),(Component Name|3),(allowWhileInUse|1),(startReasonCode|3),(targetSdk|1|1),(callerTargetSdk|1|1),(notificationWasDeferred|1),(notificationShown|1),(durationMs|1|3),(startForegroundCount|1|1),(stopReason|3) 30101 am_foreground_service_denied (User|1|5),(Component Name|3),(allowWhileInUse|1),(startReasonCode|3),(targetSdk|1|1),(callerTargetSdk|1|1),(notificationWasDeferred|1),(notificationShown|1),(durationMs|1|3),(startForegroundCount|1|1),(stopReason|3) 30102 am_foreground_service_stop (User|1|5),(Component Name|3),(allowWhileInUse|1),(startReasonCode|3),(targetSdk|1|1),(callerTargetSdk|1|1),(notificationWasDeferred|1),(notificationShown|1),(durationMs|1|3),(startForegroundCount|1|1),(stopReason|3) # Intent Sender redirect for UserHandle.USER_CURRENT 30110 am_intent_sender_redirect_user (userId|1|5)