Loading services/core/java/com/android/server/am/ActivityManagerService.java +22 −11 Original line number Original line Diff line number Diff line Loading @@ -1353,6 +1353,7 @@ public final class ActivityManagerService extends ActivityManagerNative static final int FOREGROUND_PROFILE_CHANGED_MSG = 53; static final int FOREGROUND_PROFILE_CHANGED_MSG = 53; static final int DISPATCH_UIDS_CHANGED_MSG = 54; static final int DISPATCH_UIDS_CHANGED_MSG = 54; static final int REPORT_TIME_TRACKER_MSG = 55; static final int REPORT_TIME_TRACKER_MSG = 55; static final int REPORT_USER_SWITCH_COMPLETE_MSG = 56; static final int FIRST_ACTIVITY_STACK_MSG = 100; static final int FIRST_ACTIVITY_STACK_MSG = 100; static final int FIRST_BROADCAST_QUEUE_MSG = 200; static final int FIRST_BROADCAST_QUEUE_MSG = 200; Loading Loading @@ -2014,6 +2015,9 @@ public final class ActivityManagerService extends ActivityManagerNative AppTimeTracker tracker = (AppTimeTracker)msg.obj; AppTimeTracker tracker = (AppTimeTracker)msg.obj; tracker.deliverResult(mContext); tracker.deliverResult(mContext); } break; } break; case REPORT_USER_SWITCH_COMPLETE_MSG: { dispatchUserSwitchComplete(msg.arg1); } break; } } } } }; }; Loading Loading @@ -19910,7 +19914,7 @@ public final class ActivityManagerService extends ActivityManagerNative } } } } completeSwitchAndInitalize(uss, newUserId, true, false); completeSwitchAndInitialize(uss, newUserId, true, false); } } void moveUserToForeground(UserState uss, int oldUserId, int newUserId) { void moveUserToForeground(UserState uss, int oldUserId, int newUserId) { Loading @@ -19926,10 +19930,10 @@ public final class ActivityManagerService extends ActivityManagerNative } } void continueUserSwitch(UserState uss, int oldUserId, int newUserId) { void continueUserSwitch(UserState uss, int oldUserId, int newUserId) { completeSwitchAndInitalize(uss, newUserId, false, true); completeSwitchAndInitialize(uss, newUserId, false, true); } } void completeSwitchAndInitalize(UserState uss, int newUserId, void completeSwitchAndInitialize(UserState uss, int newUserId, boolean clearInitializing, boolean clearSwitching) { boolean clearInitializing, boolean clearSwitching) { boolean unfrozen = false; boolean unfrozen = false; synchronized (this) { synchronized (this) { Loading @@ -19946,17 +19950,24 @@ public final class ActivityManagerService extends ActivityManagerNative } } } } if (unfrozen) { if (unfrozen) { final int N = mUserSwitchObservers.beginBroadcast(); mHandler.removeMessages(REPORT_USER_SWITCH_COMPLETE_MSG); for (int i=0; i<N; i++) { mHandler.sendMessage(mHandler.obtainMessage(REPORT_USER_SWITCH_COMPLETE_MSG, newUserId, 0)); } stopGuestUserIfBackground(); } /** Called on handler thread */ void dispatchUserSwitchComplete(int userId) { final int observerCount = mUserSwitchObservers.beginBroadcast(); for (int i = 0; i < observerCount; i++) { try { try { mUserSwitchObservers.getBroadcastItem(i).onUserSwitchComplete(newUserId); mUserSwitchObservers.getBroadcastItem(i).onUserSwitchComplete(userId); } catch (RemoteException e) { } catch (RemoteException e) { } } } } mUserSwitchObservers.finishBroadcast(); mUserSwitchObservers.finishBroadcast(); } } stopGuestUserIfBackground(); } /** /** * Stops the guest user if it has gone to the background. * Stops the guest user if it has gone to the background. Loading
services/core/java/com/android/server/am/ActivityManagerService.java +22 −11 Original line number Original line Diff line number Diff line Loading @@ -1353,6 +1353,7 @@ public final class ActivityManagerService extends ActivityManagerNative static final int FOREGROUND_PROFILE_CHANGED_MSG = 53; static final int FOREGROUND_PROFILE_CHANGED_MSG = 53; static final int DISPATCH_UIDS_CHANGED_MSG = 54; static final int DISPATCH_UIDS_CHANGED_MSG = 54; static final int REPORT_TIME_TRACKER_MSG = 55; static final int REPORT_TIME_TRACKER_MSG = 55; static final int REPORT_USER_SWITCH_COMPLETE_MSG = 56; static final int FIRST_ACTIVITY_STACK_MSG = 100; static final int FIRST_ACTIVITY_STACK_MSG = 100; static final int FIRST_BROADCAST_QUEUE_MSG = 200; static final int FIRST_BROADCAST_QUEUE_MSG = 200; Loading Loading @@ -2014,6 +2015,9 @@ public final class ActivityManagerService extends ActivityManagerNative AppTimeTracker tracker = (AppTimeTracker)msg.obj; AppTimeTracker tracker = (AppTimeTracker)msg.obj; tracker.deliverResult(mContext); tracker.deliverResult(mContext); } break; } break; case REPORT_USER_SWITCH_COMPLETE_MSG: { dispatchUserSwitchComplete(msg.arg1); } break; } } } } }; }; Loading Loading @@ -19910,7 +19914,7 @@ public final class ActivityManagerService extends ActivityManagerNative } } } } completeSwitchAndInitalize(uss, newUserId, true, false); completeSwitchAndInitialize(uss, newUserId, true, false); } } void moveUserToForeground(UserState uss, int oldUserId, int newUserId) { void moveUserToForeground(UserState uss, int oldUserId, int newUserId) { Loading @@ -19926,10 +19930,10 @@ public final class ActivityManagerService extends ActivityManagerNative } } void continueUserSwitch(UserState uss, int oldUserId, int newUserId) { void continueUserSwitch(UserState uss, int oldUserId, int newUserId) { completeSwitchAndInitalize(uss, newUserId, false, true); completeSwitchAndInitialize(uss, newUserId, false, true); } } void completeSwitchAndInitalize(UserState uss, int newUserId, void completeSwitchAndInitialize(UserState uss, int newUserId, boolean clearInitializing, boolean clearSwitching) { boolean clearInitializing, boolean clearSwitching) { boolean unfrozen = false; boolean unfrozen = false; synchronized (this) { synchronized (this) { Loading @@ -19946,17 +19950,24 @@ public final class ActivityManagerService extends ActivityManagerNative } } } } if (unfrozen) { if (unfrozen) { final int N = mUserSwitchObservers.beginBroadcast(); mHandler.removeMessages(REPORT_USER_SWITCH_COMPLETE_MSG); for (int i=0; i<N; i++) { mHandler.sendMessage(mHandler.obtainMessage(REPORT_USER_SWITCH_COMPLETE_MSG, newUserId, 0)); } stopGuestUserIfBackground(); } /** Called on handler thread */ void dispatchUserSwitchComplete(int userId) { final int observerCount = mUserSwitchObservers.beginBroadcast(); for (int i = 0; i < observerCount; i++) { try { try { mUserSwitchObservers.getBroadcastItem(i).onUserSwitchComplete(newUserId); mUserSwitchObservers.getBroadcastItem(i).onUserSwitchComplete(userId); } catch (RemoteException e) { } catch (RemoteException e) { } } } } mUserSwitchObservers.finishBroadcast(); mUserSwitchObservers.finishBroadcast(); } } stopGuestUserIfBackground(); } /** /** * Stops the guest user if it has gone to the background. * Stops the guest user if it has gone to the background.