Skip to content

Commit caceb02

Browse files
Dianne HackbornAndroid (Google) Code Review
Dianne Hackborn
authored and
Android (Google) Code Review
committed
Merge "Fix issue #26102692: Unable to create secondary user..."
2 parents fefe8ad + 76e8009 commit caceb02

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

services/core/java/com/android/server/am/BroadcastQueue.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,9 +1075,18 @@ final void processNextBroadcast(boolean fromMsg) {
10751075
}
10761076
}
10771077

1078+
// This is safe to do even if we are skipping the broadcast, and we need
1079+
// this information now to evaluate whether it is going to be allowed to run.
1080+
final int receiverUid = info.activityInfo.applicationInfo.uid;
1081+
// If it's a singleton, it needs to be the same app or a special app
1082+
if (r.callingUid != Process.SYSTEM_UID && isSingleton
1083+
&& mService.isValidSingletonCall(r.callingUid, receiverUid)) {
1084+
info.activityInfo = mService.getActivityInfoForUser(info.activityInfo, 0);
1085+
}
10781086
String targetProcess = info.activityInfo.processName;
10791087
ProcessRecord app = mService.getProcessRecordLocked(targetProcess,
10801088
info.activityInfo.applicationInfo.uid, false);
1089+
10811090
if (!skip) {
10821091
final int allowed = mService.checkAllowBackgroundLocked(
10831092
info.activityInfo.applicationInfo.uid, info.activityInfo.packageName, -1);
@@ -1118,12 +1127,6 @@ final void processNextBroadcast(boolean fromMsg) {
11181127

11191128
r.state = BroadcastRecord.APP_RECEIVE;
11201129
r.curComponent = component;
1121-
final int receiverUid = info.activityInfo.applicationInfo.uid;
1122-
// If it's a singleton, it needs to be the same app or a special app
1123-
if (r.callingUid != Process.SYSTEM_UID && isSingleton
1124-
&& mService.isValidSingletonCall(r.callingUid, receiverUid)) {
1125-
info.activityInfo = mService.getActivityInfoForUser(info.activityInfo, 0);
1126-
}
11271130
r.curReceiver = info.activityInfo;
11281131
if (DEBUG_MU && r.callingUid > UserHandle.PER_USER_RANGE) {
11291132
Slog.v(TAG_MU, "Updated broadcast record activity info for secondary user, "

0 commit comments

Comments
 (0)