Don't send HOME intent twice when booting from non-system user.

When Automotive boots, CarServiceHelperService "restarts" the system user in the background, so it
can be unlocked. Consequently, some boot tasks will be executed twice (triggered from
UserController.startUser() and ActivityManager.systemReady()).

Test: manual verification
Bug: 139502237

Merged-In: Idd8beedf1ea034b47b9756b91404c5a043965c23
Change-Id: Idd8beedf1ea034b47b9756b91404c5a043965c23
This commit is contained in:
Felipe Leme
2019-08-22 16:32:21 -07:00
parent 712fc079a0
commit 0639751675

View File

@@ -9047,7 +9047,13 @@ public class ActivityManagerService extends IActivityManager.Stub
throw e.rethrowAsRuntimeException();
}
}
mAtmInternal.startHomeOnAllDisplays(currentUserId, "systemReady");
// On Automotive, at this point the system user has already been started and unlocked,
// and some of the tasks we do here have already been done. So skip those in that case.
final boolean bootingSystemUser = currentUserId == UserHandle.USER_SYSTEM;
if (bootingSystemUser) {
mAtmInternal.startHomeOnAllDisplays(currentUserId, "systemReady");
}
mAtmInternal.showSystemReadyErrorDialogsIfNeeded();