Merge "Using EventLog for user switching events" into rvc-dev am: 5c36c9551b
Change-Id: I181c3896fd4de0e8cf48cfe520cf423e2d10774a
This commit is contained in:
@@ -93,3 +93,16 @@ option java_package com.android.server.am
|
|||||||
|
|
||||||
# The task is being unfrozen
|
# The task is being unfrozen
|
||||||
30069 am_unfreeze (Pid|1|5),(Process Name|3)
|
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)
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ import android.os.storage.IStorageManager;
|
|||||||
import android.os.storage.StorageManager;
|
import android.os.storage.StorageManager;
|
||||||
import android.text.format.DateUtils;
|
import android.text.format.DateUtils;
|
||||||
import android.util.ArraySet;
|
import android.util.ArraySet;
|
||||||
|
import android.util.EventLog;
|
||||||
import android.util.IntArray;
|
import android.util.IntArray;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
@@ -382,8 +383,8 @@ class UserController implements Handler.Callback {
|
|||||||
|
|
||||||
private void finishUserBoot(UserState uss, IIntentReceiver resultTo) {
|
private void finishUserBoot(UserState uss, IIntentReceiver resultTo) {
|
||||||
final int userId = uss.mHandle.getIdentifier();
|
final int userId = uss.mHandle.getIdentifier();
|
||||||
|
EventLog.writeEvent(EventLogTags.UC_FINISH_USER_BOOT, userId);
|
||||||
|
|
||||||
Slog.d(TAG, "Finishing user boot " + userId);
|
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
// Bail if we ended up with a stale user
|
// Bail if we ended up with a stale user
|
||||||
if (mStartedUsers.get(userId) != uss) {
|
if (mStartedUsers.get(userId) != uss) {
|
||||||
@@ -451,7 +452,7 @@ class UserController implements Handler.Callback {
|
|||||||
*/
|
*/
|
||||||
private boolean finishUserUnlocking(final UserState uss) {
|
private boolean finishUserUnlocking(final UserState uss) {
|
||||||
final int userId = uss.mHandle.getIdentifier();
|
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
|
// Only keep marching forward if user is actually unlocked
|
||||||
if (!StorageManager.isUserKeyUnlocked(userId)) return false;
|
if (!StorageManager.isUserKeyUnlocked(userId)) return false;
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
@@ -496,7 +497,7 @@ class UserController implements Handler.Callback {
|
|||||||
*/
|
*/
|
||||||
void finishUserUnlocked(final UserState uss) {
|
void finishUserUnlocked(final UserState uss) {
|
||||||
final int userId = uss.mHandle.getIdentifier();
|
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
|
// Only keep marching forward if user is actually unlocked
|
||||||
if (!StorageManager.isUserKeyUnlocked(userId)) return;
|
if (!StorageManager.isUserKeyUnlocked(userId)) return;
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
@@ -567,7 +568,7 @@ class UserController implements Handler.Callback {
|
|||||||
|
|
||||||
private void finishUserUnlockedCompleted(UserState uss) {
|
private void finishUserUnlockedCompleted(UserState uss) {
|
||||||
final int userId = uss.mHandle.getIdentifier();
|
final int userId = uss.mHandle.getIdentifier();
|
||||||
Slog.d(TAG, "UserController event: finishUserUnlockedCompleted(" + userId + ")");
|
EventLog.writeEvent(EventLogTags.UC_FINISH_USER_UNLOCKED_COMPLETED, userId);
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
// Bail if we ended up with a stale user
|
// Bail if we ended up with a stale user
|
||||||
if (mStartedUsers.get(uss.mHandle.getIdentifier()) != uss) return;
|
if (mStartedUsers.get(uss.mHandle.getIdentifier()) != uss) return;
|
||||||
@@ -830,7 +831,7 @@ class UserController implements Handler.Callback {
|
|||||||
|
|
||||||
void finishUserStopping(final int userId, final UserState uss,
|
void finishUserStopping(final int userId, final UserState uss,
|
||||||
final boolean allowDelayedLocking) {
|
final boolean allowDelayedLocking) {
|
||||||
Slog.d(TAG, "UserController event: finishUserStopping(" + userId + ")");
|
EventLog.writeEvent(EventLogTags.UC_FINISH_USER_STOPPING, userId);
|
||||||
// On to the next.
|
// On to the next.
|
||||||
final Intent shutdownIntent = new Intent(Intent.ACTION_SHUTDOWN);
|
final Intent shutdownIntent = new Intent(Intent.ACTION_SHUTDOWN);
|
||||||
// This is the result receiver for the final shutdown broadcast.
|
// This is the result receiver for the final shutdown broadcast.
|
||||||
@@ -870,7 +871,7 @@ class UserController implements Handler.Callback {
|
|||||||
|
|
||||||
void finishUserStopped(UserState uss, boolean allowDelayedLocking) {
|
void finishUserStopped(UserState uss, boolean allowDelayedLocking) {
|
||||||
final int userId = uss.mHandle.getIdentifier();
|
final int userId = uss.mHandle.getIdentifier();
|
||||||
Slog.d(TAG, "UserController event: finishUserStopped(" + userId + ")");
|
EventLog.writeEvent(EventLogTags.UC_FINISH_USER_STOPPED, userId);
|
||||||
final boolean stopped;
|
final boolean stopped;
|
||||||
boolean lockUser = true;
|
boolean lockUser = true;
|
||||||
final ArrayList<IStopUserCallback> stopCallbacks;
|
final ArrayList<IStopUserCallback> stopCallbacks;
|
||||||
@@ -1147,7 +1148,7 @@ class UserController implements Handler.Callback {
|
|||||||
|
|
||||||
private boolean startUserInternal(@UserIdInt int userId, boolean foreground,
|
private boolean startUserInternal(@UserIdInt int userId, boolean foreground,
|
||||||
@Nullable IProgressListener unlockListener, @NonNull TimingsTraceAndSlog t) {
|
@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 callingUid = Binder.getCallingUid();
|
||||||
final int callingPid = Binder.getCallingPid();
|
final int callingPid = Binder.getCallingPid();
|
||||||
@@ -1396,7 +1397,7 @@ class UserController implements Handler.Callback {
|
|||||||
boolean unlockUser(final @UserIdInt int userId, byte[] token, byte[] secret,
|
boolean unlockUser(final @UserIdInt int userId, byte[] token, byte[] secret,
|
||||||
IProgressListener listener) {
|
IProgressListener listener) {
|
||||||
checkCallingPermission(INTERACT_ACROSS_USERS_FULL, "unlockUser");
|
checkCallingPermission(INTERACT_ACROSS_USERS_FULL, "unlockUser");
|
||||||
Slog.i(TAG, "unlocking user " + userId);
|
EventLog.writeEvent(EventLogTags.UC_UNLOCK_USER, userId);
|
||||||
final long binderToken = Binder.clearCallingIdentity();
|
final long binderToken = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
return unlockUserCleared(userId, token, secret, listener);
|
return unlockUserCleared(userId, token, secret, listener);
|
||||||
@@ -1481,7 +1482,7 @@ class UserController implements Handler.Callback {
|
|||||||
|
|
||||||
boolean switchUser(final int targetUserId) {
|
boolean switchUser(final int targetUserId) {
|
||||||
enforceShellRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES, targetUserId);
|
enforceShellRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES, targetUserId);
|
||||||
Slog.i(TAG, "switching to user " + targetUserId);
|
EventLog.writeEvent(EventLogTags.UC_SWITCH_USER, targetUserId);
|
||||||
int currentUserId = getCurrentUserId();
|
int currentUserId = getCurrentUserId();
|
||||||
UserInfo targetUserInfo = getUserInfo(targetUserId);
|
UserInfo targetUserInfo = getUserInfo(targetUserId);
|
||||||
if (targetUserId == currentUserId) {
|
if (targetUserId == currentUserId) {
|
||||||
@@ -1604,7 +1605,8 @@ class UserController implements Handler.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void dispatchUserSwitch(final UserState uss, final int oldUserId, final int newUserId) {
|
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();
|
final int observerCount = mUserSwitchObservers.beginBroadcast();
|
||||||
if (observerCount > 0) {
|
if (observerCount > 0) {
|
||||||
final ArraySet<String> curWaitingUserSwitchCallbacks = new ArraySet<>();
|
final ArraySet<String> curWaitingUserSwitchCallbacks = new ArraySet<>();
|
||||||
@@ -1666,7 +1668,8 @@ class UserController implements Handler.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void continueUserSwitch(UserState uss, int oldUserId, int newUserId) {
|
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()) {
|
if (isUserSwitchUiEnabled()) {
|
||||||
mInjector.getWindowManager().stopFreezingScreen();
|
mInjector.getWindowManager().stopFreezingScreen();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user