Loading services/core/java/com/android/server/am/EventLogTags.logtags +13 −0 Original line number Diff line number Diff line Loading @@ -93,3 +93,16 @@ option java_package com.android.server.am # The task is being unfrozen 30069 am_unfreeze (Pid|1|5),(Process Name|3) # User switch events 30070 uc_finish_user_unlocking (UID|1|5) 30071 uc_finish_user_unlocked (UID|1|5) 30072 uc_finish_user_unlocked_completed (UID|1|5) 30073 uc_finish_user_stopping (UID|1|5) 30074 uc_finish_user_stopped (UID|1|5) 30075 uc_switch_user (UID|1|5) 30076 uc_start_user_internal (UID|1|5) 30077 uc_unlock_user (UID|1|5) 30078 uc_finish_user_boot (UID|1|5) 30079 uc_dispatch_user_switch (oldUID|1|5) (newUID|1|5) 30080 uc_continue_user_switch (oldUID|1|5) (newUID|1|5) services/core/java/com/android/server/am/UserController.java +14 −11 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ import android.os.storage.IStorageManager; import android.os.storage.StorageManager; import android.text.format.DateUtils; import android.util.ArraySet; import android.util.EventLog; import android.util.IntArray; import android.util.Pair; import android.util.Slog; Loading Loading @@ -382,8 +383,8 @@ class UserController implements Handler.Callback { private void finishUserBoot(UserState uss, IIntentReceiver resultTo) { final int userId = uss.mHandle.getIdentifier(); EventLog.writeEvent(EventLogTags.UC_FINISH_USER_BOOT, userId); Slog.d(TAG, "Finishing user boot " + userId); synchronized (mLock) { // Bail if we ended up with a stale user if (mStartedUsers.get(userId) != uss) { Loading Loading @@ -451,7 +452,7 @@ class UserController implements Handler.Callback { */ private boolean finishUserUnlocking(final UserState uss) { final int userId = uss.mHandle.getIdentifier(); Slog.d(TAG, "UserController event: finishUserUnlocking(" + userId + ")"); EventLog.writeEvent(EventLogTags.UC_FINISH_USER_UNLOCKING, userId); // Only keep marching forward if user is actually unlocked if (!StorageManager.isUserKeyUnlocked(userId)) return false; synchronized (mLock) { Loading Loading @@ -496,7 +497,7 @@ class UserController implements Handler.Callback { */ void finishUserUnlocked(final UserState uss) { final int userId = uss.mHandle.getIdentifier(); Slog.d(TAG, "UserController event: finishUserUnlocked(" + userId + ")"); EventLog.writeEvent(EventLogTags.UC_FINISH_USER_UNLOCKED, userId); // Only keep marching forward if user is actually unlocked if (!StorageManager.isUserKeyUnlocked(userId)) return; synchronized (mLock) { Loading Loading @@ -567,7 +568,7 @@ class UserController implements Handler.Callback { private void finishUserUnlockedCompleted(UserState uss) { final int userId = uss.mHandle.getIdentifier(); Slog.d(TAG, "UserController event: finishUserUnlockedCompleted(" + userId + ")"); EventLog.writeEvent(EventLogTags.UC_FINISH_USER_UNLOCKED_COMPLETED, userId); synchronized (mLock) { // Bail if we ended up with a stale user if (mStartedUsers.get(uss.mHandle.getIdentifier()) != uss) return; Loading Loading @@ -830,7 +831,7 @@ class UserController implements Handler.Callback { void finishUserStopping(final int userId, final UserState uss, final boolean allowDelayedLocking) { Slog.d(TAG, "UserController event: finishUserStopping(" + userId + ")"); EventLog.writeEvent(EventLogTags.UC_FINISH_USER_STOPPING, userId); // On to the next. final Intent shutdownIntent = new Intent(Intent.ACTION_SHUTDOWN); // This is the result receiver for the final shutdown broadcast. Loading Loading @@ -870,7 +871,7 @@ class UserController implements Handler.Callback { void finishUserStopped(UserState uss, boolean allowDelayedLocking) { final int userId = uss.mHandle.getIdentifier(); Slog.d(TAG, "UserController event: finishUserStopped(" + userId + ")"); EventLog.writeEvent(EventLogTags.UC_FINISH_USER_STOPPED, userId); final boolean stopped; boolean lockUser = true; final ArrayList<IStopUserCallback> stopCallbacks; Loading Loading @@ -1147,7 +1148,7 @@ class UserController implements Handler.Callback { private boolean startUserInternal(@UserIdInt int userId, boolean foreground, @Nullable IProgressListener unlockListener, @NonNull TimingsTraceAndSlog t) { Slog.i(TAG, "Starting userid:" + userId + " fg:" + foreground); EventLog.writeEvent(EventLogTags.UC_START_USER_INTERNAL, userId); final int callingUid = Binder.getCallingUid(); final int callingPid = Binder.getCallingPid(); Loading Loading @@ -1396,7 +1397,7 @@ class UserController implements Handler.Callback { boolean unlockUser(final @UserIdInt int userId, byte[] token, byte[] secret, IProgressListener listener) { checkCallingPermission(INTERACT_ACROSS_USERS_FULL, "unlockUser"); Slog.i(TAG, "unlocking user " + userId); EventLog.writeEvent(EventLogTags.UC_UNLOCK_USER, userId); final long binderToken = Binder.clearCallingIdentity(); try { return unlockUserCleared(userId, token, secret, listener); Loading Loading @@ -1481,7 +1482,7 @@ class UserController implements Handler.Callback { boolean switchUser(final int targetUserId) { enforceShellRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES, targetUserId); Slog.i(TAG, "switching to user " + targetUserId); EventLog.writeEvent(EventLogTags.UC_SWITCH_USER, targetUserId); int currentUserId = getCurrentUserId(); UserInfo targetUserInfo = getUserInfo(targetUserId); if (targetUserId == currentUserId) { Loading Loading @@ -1604,7 +1605,8 @@ class UserController implements Handler.Callback { } void dispatchUserSwitch(final UserState uss, final int oldUserId, final int newUserId) { Slog.d(TAG, "Dispatch onUserSwitching oldUser #" + oldUserId + " newUser #" + newUserId); EventLog.writeEvent(EventLogTags.UC_DISPATCH_USER_SWITCH, oldUserId, newUserId); final int observerCount = mUserSwitchObservers.beginBroadcast(); if (observerCount > 0) { final ArraySet<String> curWaitingUserSwitchCallbacks = new ArraySet<>(); Loading Loading @@ -1666,7 +1668,8 @@ class UserController implements Handler.Callback { } void continueUserSwitch(UserState uss, int oldUserId, int newUserId) { Slog.d(TAG, "Continue user switch oldUser #" + oldUserId + ", newUser #" + newUserId); EventLog.writeEvent(EventLogTags.UC_CONTINUE_USER_SWITCH, oldUserId, newUserId); if (isUserSwitchUiEnabled()) { mInjector.getWindowManager().stopFreezingScreen(); } Loading Loading
services/core/java/com/android/server/am/EventLogTags.logtags +13 −0 Original line number Diff line number Diff line Loading @@ -93,3 +93,16 @@ option java_package com.android.server.am # The task is being unfrozen 30069 am_unfreeze (Pid|1|5),(Process Name|3) # User switch events 30070 uc_finish_user_unlocking (UID|1|5) 30071 uc_finish_user_unlocked (UID|1|5) 30072 uc_finish_user_unlocked_completed (UID|1|5) 30073 uc_finish_user_stopping (UID|1|5) 30074 uc_finish_user_stopped (UID|1|5) 30075 uc_switch_user (UID|1|5) 30076 uc_start_user_internal (UID|1|5) 30077 uc_unlock_user (UID|1|5) 30078 uc_finish_user_boot (UID|1|5) 30079 uc_dispatch_user_switch (oldUID|1|5) (newUID|1|5) 30080 uc_continue_user_switch (oldUID|1|5) (newUID|1|5)
services/core/java/com/android/server/am/UserController.java +14 −11 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ import android.os.storage.IStorageManager; import android.os.storage.StorageManager; import android.text.format.DateUtils; import android.util.ArraySet; import android.util.EventLog; import android.util.IntArray; import android.util.Pair; import android.util.Slog; Loading Loading @@ -382,8 +383,8 @@ class UserController implements Handler.Callback { private void finishUserBoot(UserState uss, IIntentReceiver resultTo) { final int userId = uss.mHandle.getIdentifier(); EventLog.writeEvent(EventLogTags.UC_FINISH_USER_BOOT, userId); Slog.d(TAG, "Finishing user boot " + userId); synchronized (mLock) { // Bail if we ended up with a stale user if (mStartedUsers.get(userId) != uss) { Loading Loading @@ -451,7 +452,7 @@ class UserController implements Handler.Callback { */ private boolean finishUserUnlocking(final UserState uss) { final int userId = uss.mHandle.getIdentifier(); Slog.d(TAG, "UserController event: finishUserUnlocking(" + userId + ")"); EventLog.writeEvent(EventLogTags.UC_FINISH_USER_UNLOCKING, userId); // Only keep marching forward if user is actually unlocked if (!StorageManager.isUserKeyUnlocked(userId)) return false; synchronized (mLock) { Loading Loading @@ -496,7 +497,7 @@ class UserController implements Handler.Callback { */ void finishUserUnlocked(final UserState uss) { final int userId = uss.mHandle.getIdentifier(); Slog.d(TAG, "UserController event: finishUserUnlocked(" + userId + ")"); EventLog.writeEvent(EventLogTags.UC_FINISH_USER_UNLOCKED, userId); // Only keep marching forward if user is actually unlocked if (!StorageManager.isUserKeyUnlocked(userId)) return; synchronized (mLock) { Loading Loading @@ -567,7 +568,7 @@ class UserController implements Handler.Callback { private void finishUserUnlockedCompleted(UserState uss) { final int userId = uss.mHandle.getIdentifier(); Slog.d(TAG, "UserController event: finishUserUnlockedCompleted(" + userId + ")"); EventLog.writeEvent(EventLogTags.UC_FINISH_USER_UNLOCKED_COMPLETED, userId); synchronized (mLock) { // Bail if we ended up with a stale user if (mStartedUsers.get(uss.mHandle.getIdentifier()) != uss) return; Loading Loading @@ -830,7 +831,7 @@ class UserController implements Handler.Callback { void finishUserStopping(final int userId, final UserState uss, final boolean allowDelayedLocking) { Slog.d(TAG, "UserController event: finishUserStopping(" + userId + ")"); EventLog.writeEvent(EventLogTags.UC_FINISH_USER_STOPPING, userId); // On to the next. final Intent shutdownIntent = new Intent(Intent.ACTION_SHUTDOWN); // This is the result receiver for the final shutdown broadcast. Loading Loading @@ -870,7 +871,7 @@ class UserController implements Handler.Callback { void finishUserStopped(UserState uss, boolean allowDelayedLocking) { final int userId = uss.mHandle.getIdentifier(); Slog.d(TAG, "UserController event: finishUserStopped(" + userId + ")"); EventLog.writeEvent(EventLogTags.UC_FINISH_USER_STOPPED, userId); final boolean stopped; boolean lockUser = true; final ArrayList<IStopUserCallback> stopCallbacks; Loading Loading @@ -1147,7 +1148,7 @@ class UserController implements Handler.Callback { private boolean startUserInternal(@UserIdInt int userId, boolean foreground, @Nullable IProgressListener unlockListener, @NonNull TimingsTraceAndSlog t) { Slog.i(TAG, "Starting userid:" + userId + " fg:" + foreground); EventLog.writeEvent(EventLogTags.UC_START_USER_INTERNAL, userId); final int callingUid = Binder.getCallingUid(); final int callingPid = Binder.getCallingPid(); Loading Loading @@ -1396,7 +1397,7 @@ class UserController implements Handler.Callback { boolean unlockUser(final @UserIdInt int userId, byte[] token, byte[] secret, IProgressListener listener) { checkCallingPermission(INTERACT_ACROSS_USERS_FULL, "unlockUser"); Slog.i(TAG, "unlocking user " + userId); EventLog.writeEvent(EventLogTags.UC_UNLOCK_USER, userId); final long binderToken = Binder.clearCallingIdentity(); try { return unlockUserCleared(userId, token, secret, listener); Loading Loading @@ -1481,7 +1482,7 @@ class UserController implements Handler.Callback { boolean switchUser(final int targetUserId) { enforceShellRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES, targetUserId); Slog.i(TAG, "switching to user " + targetUserId); EventLog.writeEvent(EventLogTags.UC_SWITCH_USER, targetUserId); int currentUserId = getCurrentUserId(); UserInfo targetUserInfo = getUserInfo(targetUserId); if (targetUserId == currentUserId) { Loading Loading @@ -1604,7 +1605,8 @@ class UserController implements Handler.Callback { } void dispatchUserSwitch(final UserState uss, final int oldUserId, final int newUserId) { Slog.d(TAG, "Dispatch onUserSwitching oldUser #" + oldUserId + " newUser #" + newUserId); EventLog.writeEvent(EventLogTags.UC_DISPATCH_USER_SWITCH, oldUserId, newUserId); final int observerCount = mUserSwitchObservers.beginBroadcast(); if (observerCount > 0) { final ArraySet<String> curWaitingUserSwitchCallbacks = new ArraySet<>(); Loading Loading @@ -1666,7 +1668,8 @@ class UserController implements Handler.Callback { } void continueUserSwitch(UserState uss, int oldUserId, int newUserId) { Slog.d(TAG, "Continue user switch oldUser #" + oldUserId + ", newUser #" + newUserId); EventLog.writeEvent(EventLogTags.UC_CONTINUE_USER_SWITCH, oldUserId, newUserId); if (isUserSwitchUiEnabled()) { mInjector.getWindowManager().stopFreezingScreen(); } Loading