Loading services/core/java/com/android/server/am/UserController.java +164 −154 Original line number Diff line number Diff line Loading @@ -1920,6 +1920,21 @@ class UserController implements Handler.Callback { return false; } mHandler.post(() -> startUserInternalOnHandler(userId, oldUserId, userStartMode, unlockListener, callingUid, callingPid)); } finally { Binder.restoreCallingIdentity(ident); } return true; } private void startUserInternalOnHandler(int userId, int oldUserId, int userStartMode, IProgressListener unlockListener, int callingUid, int callingPid) { final TimingsTraceAndSlog t = new TimingsTraceAndSlog(); final boolean foreground = userStartMode == USER_START_MODE_FOREGROUND; final UserInfo userInfo = getUserInfo(userId); boolean needStart = false; boolean updateUmState = false; UserState uss; Loading @@ -1943,7 +1958,7 @@ class UserController implements Handler.Callback { mPendingUserStarts.add(new PendingUserStart(userId, userStartMode, unlockListener)); t.traceEnd(); // updateStartedUserArrayStarting return true; return; } } Loading Loading @@ -2089,11 +2104,6 @@ class UserController implements Handler.Callback { sendUserStartingBroadcast(userId, callingUid, callingPid); t.traceEnd(); } } finally { Binder.restoreCallingIdentity(ident); } return true; } /** Loading services/tests/servicestests/src/com/android/server/am/UserControllerTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -181,12 +181,14 @@ public class UserControllerTest { Intent.ACTION_USER_STARTING); private static final Set<Integer> START_FOREGROUND_USER_MESSAGE_CODES = newHashSet( 0, // for startUserInternalOnHandler REPORT_USER_SWITCH_MSG, USER_SWITCH_TIMEOUT_MSG, USER_START_MSG, USER_CURRENT_MSG); private static final Set<Integer> START_BACKGROUND_USER_MESSAGE_CODES = newHashSet( 0, // for startUserInternalOnHandler USER_START_MSG, REPORT_LOCKED_BOOT_COMPLETE_MSG); Loading Loading @@ -374,7 +376,7 @@ public class UserControllerTest { // and the cascade effect goes on...). In fact, a better approach would to not assert the // binder calls, but their side effects (in this case, that the user is stopped right away) assertWithMessage("wrong binder message calls").that(mInjector.mHandler.getMessageCodes()) .containsExactly(USER_START_MSG); .containsExactly(/* for startUserInternalOnHandler */ 0, USER_START_MSG); } private void startUserAssertions( Loading Loading
services/core/java/com/android/server/am/UserController.java +164 −154 Original line number Diff line number Diff line Loading @@ -1920,6 +1920,21 @@ class UserController implements Handler.Callback { return false; } mHandler.post(() -> startUserInternalOnHandler(userId, oldUserId, userStartMode, unlockListener, callingUid, callingPid)); } finally { Binder.restoreCallingIdentity(ident); } return true; } private void startUserInternalOnHandler(int userId, int oldUserId, int userStartMode, IProgressListener unlockListener, int callingUid, int callingPid) { final TimingsTraceAndSlog t = new TimingsTraceAndSlog(); final boolean foreground = userStartMode == USER_START_MODE_FOREGROUND; final UserInfo userInfo = getUserInfo(userId); boolean needStart = false; boolean updateUmState = false; UserState uss; Loading @@ -1943,7 +1958,7 @@ class UserController implements Handler.Callback { mPendingUserStarts.add(new PendingUserStart(userId, userStartMode, unlockListener)); t.traceEnd(); // updateStartedUserArrayStarting return true; return; } } Loading Loading @@ -2089,11 +2104,6 @@ class UserController implements Handler.Callback { sendUserStartingBroadcast(userId, callingUid, callingPid); t.traceEnd(); } } finally { Binder.restoreCallingIdentity(ident); } return true; } /** Loading
services/tests/servicestests/src/com/android/server/am/UserControllerTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -181,12 +181,14 @@ public class UserControllerTest { Intent.ACTION_USER_STARTING); private static final Set<Integer> START_FOREGROUND_USER_MESSAGE_CODES = newHashSet( 0, // for startUserInternalOnHandler REPORT_USER_SWITCH_MSG, USER_SWITCH_TIMEOUT_MSG, USER_START_MSG, USER_CURRENT_MSG); private static final Set<Integer> START_BACKGROUND_USER_MESSAGE_CODES = newHashSet( 0, // for startUserInternalOnHandler USER_START_MSG, REPORT_LOCKED_BOOT_COMPLETE_MSG); Loading Loading @@ -374,7 +376,7 @@ public class UserControllerTest { // and the cascade effect goes on...). In fact, a better approach would to not assert the // binder calls, but their side effects (in this case, that the user is stopped right away) assertWithMessage("wrong binder message calls").that(mInjector.mHandler.getMessageCodes()) .containsExactly(USER_START_MSG); .containsExactly(/* for startUserInternalOnHandler */ 0, USER_START_MSG); } private void startUserAssertions( Loading