Merge "Send system user broadcasts in headless system user mode." into tm-qpr-dev

This commit is contained in:
TreeHugger Robot
2023-01-23 17:51:13 +00:00
committed by Android (Google) Code Review

View File

@@ -8196,15 +8196,13 @@ public class ActivityManagerService extends IActivityManager.Stub
t.traceEnd(); t.traceEnd();
} }
boolean isBootingSystemUser = currentUserId == UserHandle.USER_SYSTEM;
// Some systems - like automotive - will explicitly unlock system user then switch // Some systems - like automotive - will explicitly unlock system user then switch
// to a secondary user. Hence, we don't want to send duplicate broadcasts for // to a secondary user.
// the system user here.
// TODO(b/242195409): this workaround shouldn't be necessary once we move // TODO(b/242195409): this workaround shouldn't be necessary once we move
// the headless-user start logic to UserManager-land. // the headless-user start logic to UserManager-land.
final boolean isBootingSystemUser = (currentUserId == UserHandle.USER_SYSTEM) if (isBootingSystemUser && !UserManager.isHeadlessSystemUserMode()) {
&& !UserManager.isHeadlessSystemUserMode();
if (isBootingSystemUser) {
t.traceBegin("startHomeOnAllDisplays"); t.traceBegin("startHomeOnAllDisplays");
mAtmInternal.startHomeOnAllDisplays(currentUserId, "systemReady"); mAtmInternal.startHomeOnAllDisplays(currentUserId, "systemReady");
t.traceEnd(); t.traceEnd();
@@ -8216,6 +8214,10 @@ public class ActivityManagerService extends IActivityManager.Stub
if (isBootingSystemUser) { if (isBootingSystemUser) {
// Need to send the broadcasts for the system user here because
// UserController#startUserInternal will not send them for the system user starting,
// It checks if the user state already exists, which is always the case for the
// system user.
t.traceBegin("sendUserStartBroadcast"); t.traceBegin("sendUserStartBroadcast");
final int callingUid = Binder.getCallingUid(); final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid(); final int callingPid = Binder.getCallingPid();