Loading packages/SystemUI/src/com/android/systemui/GuestResumeSessionReceiver.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -47,7 +47,7 @@ public class GuestResumeSessionReceiver extends BroadcastReceiver { public void register(Context context) { public void register(Context context) { IntentFilter f = new IntentFilter(Intent.ACTION_USER_SWITCHED); IntentFilter f = new IntentFilter(Intent.ACTION_USER_SWITCHED); context.registerReceiverAsUser(this, UserHandle.OWNER, context.registerReceiverAsUser(this, UserHandle.SYSTEM, f, null /* permission */, null /* scheduler */); f, null /* permission */, null /* scheduler */); } } Loading Loading @@ -121,8 +121,8 @@ public class GuestResumeSessionReceiver extends BroadcastReceiver { try { try { if (newGuest == null) { if (newGuest == null) { Log.e(TAG, "Could not create new guest, switching back to owner"); Log.e(TAG, "Could not create new guest, switching back to system user"); ActivityManagerNative.getDefault().switchUser(UserHandle.USER_OWNER); ActivityManagerNative.getDefault().switchUser(UserHandle.USER_SYSTEM); userManager.removeUser(currentUser.id); userManager.removeUser(currentUser.id); WindowManagerGlobal.getWindowManagerService().lockNow(null /* options */); WindowManagerGlobal.getWindowManagerService().lockNow(null /* options */); return; return; Loading packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -340,7 +340,7 @@ public class KeyguardViewMediator extends SystemUI { @Override @Override public void onUserSwitchComplete(int userId) { public void onUserSwitchComplete(int userId) { mSwitchingUser = false; mSwitchingUser = false; if (userId != UserHandle.USER_OWNER) { if (userId != UserHandle.USER_SYSTEM) { UserInfo info = UserManager.get(mContext).getUserInfo(userId); UserInfo info = UserManager.get(mContext).getUserInfo(userId); if (info != null && info.isGuest()) { if (info != null && info.isGuest()) { // If we just switched to a guest, try to dismiss keyguard. // If we just switched to a guest, try to dismiss keyguard. Loading packages/SystemUI/src/com/android/systemui/recents/Recents.java +22 −23 Original line number Original line Diff line number Diff line Loading @@ -20,7 +20,6 @@ import android.app.Activity; import android.app.ActivityManager; import android.app.ActivityManager; import android.app.ActivityOptions; import android.app.ActivityOptions; import android.app.ITaskStackListener; import android.app.ITaskStackListener; import android.appwidget.AppWidgetProviderInfo; import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException; import android.content.BroadcastReceiver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Context; Loading Loading @@ -62,15 +61,15 @@ import com.android.systemui.statusbar.phone.PhoneStatusBar; import java.util.ArrayList; import java.util.ArrayList; /** /** * Annotation for a method that is only called from the primary user's SystemUI process and will be * Annotation for a method that is only called from the system user's SystemUI process and will be * proxied to the current user. * proxied to the current user. */ */ @interface ProxyFromPrimaryToCurrentUser {} @interface ProxyFromSystemToCurrentUser {} /** /** * Annotation for a method that may be called from any user's SystemUI process and will be proxied * Annotation for a method that may be called from any user's SystemUI process and will be proxied * to the primary user. * to the system user. */ */ @interface ProxyFromAnyToPrimaryUser {} @interface ProxyFromAnyToSystemUser {} /** A proxy implementation for the recents component */ /** A proxy implementation for the recents component */ public class Recents extends SystemUI public class Recents extends SystemUI Loading Loading @@ -225,7 +224,7 @@ public class Recents extends SystemUI } } /** Initializes the Recents. */ /** Initializes the Recents. */ @ProxyFromPrimaryToCurrentUser @ProxyFromSystemToCurrentUser @Override @Override public void start() { public void start() { if (sInstance == null) { if (sInstance == null) { Loading @@ -245,7 +244,7 @@ public class Recents extends SystemUI // Only the owner has the callback to update the SysUI visibility flags, so all non-owner // Only the owner has the callback to update the SysUI visibility flags, so all non-owner // instances of AlternateRecentsComponent needs to notify the owner when the visibility // instances of AlternateRecentsComponent needs to notify the owner when the visibility // changes. // changes. if (mSystemServicesProxy.isForegroundUserOwner()) { if (mSystemServicesProxy.isForegroundUserSystem()) { mProxyBroadcastReceiver = new RecentsOwnerEventProxyReceiver(); mProxyBroadcastReceiver = new RecentsOwnerEventProxyReceiver(); IntentFilter filter = new IntentFilter(); IntentFilter filter = new IntentFilter(); filter.addAction(Recents.ACTION_PROXY_NOTIFY_RECENTS_VISIBLITY_TO_OWNER); filter.addAction(Recents.ACTION_PROXY_NOTIFY_RECENTS_VISIBLITY_TO_OWNER); Loading Loading @@ -278,10 +277,10 @@ public class Recents extends SystemUI } } /** Shows the Recents. */ /** Shows the Recents. */ @ProxyFromPrimaryToCurrentUser @ProxyFromSystemToCurrentUser @Override @Override public void showRecents(boolean triggeredFromAltTab, View statusBarView) { public void showRecents(boolean triggeredFromAltTab, View statusBarView) { if (mSystemServicesProxy.isForegroundUserOwner()) { if (mSystemServicesProxy.isForegroundUserSystem()) { showRecentsInternal(triggeredFromAltTab); showRecentsInternal(triggeredFromAltTab); } else { } else { Intent intent = createLocalBroadcastIntent(mContext, Intent intent = createLocalBroadcastIntent(mContext, Loading @@ -302,10 +301,10 @@ public class Recents extends SystemUI } } /** Hides the Recents. */ /** Hides the Recents. */ @ProxyFromPrimaryToCurrentUser @ProxyFromSystemToCurrentUser @Override @Override public void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) { public void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) { if (mSystemServicesProxy.isForegroundUserOwner()) { if (mSystemServicesProxy.isForegroundUserSystem()) { hideRecentsInternal(triggeredFromAltTab, triggeredFromHomeKey); hideRecentsInternal(triggeredFromAltTab, triggeredFromHomeKey); } else { } else { Intent intent = createLocalBroadcastIntent(mContext, Intent intent = createLocalBroadcastIntent(mContext, Loading @@ -328,10 +327,10 @@ public class Recents extends SystemUI } } /** Toggles the Recents activity. */ /** Toggles the Recents activity. */ @ProxyFromPrimaryToCurrentUser @ProxyFromSystemToCurrentUser @Override @Override public void toggleRecents(Display display, int layoutDirection, View statusBarView) { public void toggleRecents(Display display, int layoutDirection, View statusBarView) { if (mSystemServicesProxy.isForegroundUserOwner()) { if (mSystemServicesProxy.isForegroundUserSystem()) { toggleRecentsInternal(); toggleRecentsInternal(); } else { } else { Intent intent = createLocalBroadcastIntent(mContext, Intent intent = createLocalBroadcastIntent(mContext, Loading @@ -351,10 +350,10 @@ public class Recents extends SystemUI } } /** Preloads info for the Recents activity. */ /** Preloads info for the Recents activity. */ @ProxyFromPrimaryToCurrentUser @ProxyFromSystemToCurrentUser @Override @Override public void preloadRecents() { public void preloadRecents() { if (mSystemServicesProxy.isForegroundUserOwner()) { if (mSystemServicesProxy.isForegroundUserSystem()) { preloadRecentsInternal(); preloadRecentsInternal(); } else { } else { Intent intent = createLocalBroadcastIntent(mContext, Intent intent = createLocalBroadcastIntent(mContext, Loading Loading @@ -483,9 +482,9 @@ public class Recents extends SystemUI } } /** Updates on configuration change. */ /** Updates on configuration change. */ @ProxyFromPrimaryToCurrentUser @ProxyFromSystemToCurrentUser public void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) { if (mSystemServicesProxy.isForegroundUserOwner()) { if (mSystemServicesProxy.isForegroundUserSystem()) { configurationChanged(); configurationChanged(); } else { } else { Intent intent = createLocalBroadcastIntent(mContext, Intent intent = createLocalBroadcastIntent(mContext, Loading Loading @@ -849,16 +848,16 @@ public class Recents extends SystemUI } } /** Notifies the callbacks that the visibility of Recents has changed. */ /** Notifies the callbacks that the visibility of Recents has changed. */ @ProxyFromAnyToPrimaryUser @ProxyFromAnyToSystemUser public static void notifyVisibilityChanged(Context context, SystemServicesProxy ssp, public static void notifyVisibilityChanged(Context context, SystemServicesProxy ssp, boolean visible) { boolean visible) { if (ssp.isForegroundUserOwner()) { if (ssp.isForegroundUserSystem()) { visibilityChanged(visible); visibilityChanged(visible); } else { } else { Intent intent = createLocalBroadcastIntent(context, Intent intent = createLocalBroadcastIntent(context, ACTION_PROXY_NOTIFY_RECENTS_VISIBLITY_TO_OWNER); ACTION_PROXY_NOTIFY_RECENTS_VISIBLITY_TO_OWNER); intent.putExtra(EXTRA_RECENTS_VISIBILITY, visible); intent.putExtra(EXTRA_RECENTS_VISIBILITY, visible); context.sendBroadcastAsUser(intent, UserHandle.OWNER); context.sendBroadcastAsUser(intent, UserHandle.SYSTEM); } } } } static void visibilityChanged(boolean visible) { static void visibilityChanged(boolean visible) { Loading @@ -868,14 +867,14 @@ public class Recents extends SystemUI } } /** Notifies the status bar to trigger screen pinning. */ /** Notifies the status bar to trigger screen pinning. */ @ProxyFromAnyToPrimaryUser @ProxyFromAnyToSystemUser public static void startScreenPinning(Context context, SystemServicesProxy ssp) { public static void startScreenPinning(Context context, SystemServicesProxy ssp) { if (ssp.isForegroundUserOwner()) { if (ssp.isForegroundUserSystem()) { onStartScreenPinning(context); onStartScreenPinning(context); } else { } else { Intent intent = createLocalBroadcastIntent(context, Intent intent = createLocalBroadcastIntent(context, ACTION_PROXY_SCREEN_PINNING_REQUEST_TO_OWNER); ACTION_PROXY_SCREEN_PINNING_REQUEST_TO_OWNER); context.sendBroadcastAsUser(intent, UserHandle.OWNER); context.sendBroadcastAsUser(intent, UserHandle.SYSTEM); } } } } static void onStartScreenPinning(Context context) { static void onStartScreenPinning(Context context) { Loading packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -526,10 +526,10 @@ public class SystemServicesProxy { /** /** * Returns whether the foreground user is the owner. * Returns whether the foreground user is the owner. */ */ public boolean isForegroundUserOwner() { public boolean isForegroundUserSystem() { if (mAm == null) return false; if (mAm == null) return false; return mAm.getCurrentUser() == UserHandle.USER_OWNER; return mAm.getCurrentUser() == UserHandle.USER_SYSTEM; } } /** /** Loading packages/SystemUI/src/com/android/systemui/settings/CurrentUserTracker.java +0 −4 Original line number Original line Diff line number Diff line Loading @@ -58,8 +58,4 @@ public abstract class CurrentUserTracker extends BroadcastReceiver { } } public abstract void onUserSwitched(int newUserId); public abstract void onUserSwitched(int newUserId); public boolean isCurrentUserOwner() { return mCurrentUserId == UserHandle.USER_OWNER; } } } Loading
packages/SystemUI/src/com/android/systemui/GuestResumeSessionReceiver.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -47,7 +47,7 @@ public class GuestResumeSessionReceiver extends BroadcastReceiver { public void register(Context context) { public void register(Context context) { IntentFilter f = new IntentFilter(Intent.ACTION_USER_SWITCHED); IntentFilter f = new IntentFilter(Intent.ACTION_USER_SWITCHED); context.registerReceiverAsUser(this, UserHandle.OWNER, context.registerReceiverAsUser(this, UserHandle.SYSTEM, f, null /* permission */, null /* scheduler */); f, null /* permission */, null /* scheduler */); } } Loading Loading @@ -121,8 +121,8 @@ public class GuestResumeSessionReceiver extends BroadcastReceiver { try { try { if (newGuest == null) { if (newGuest == null) { Log.e(TAG, "Could not create new guest, switching back to owner"); Log.e(TAG, "Could not create new guest, switching back to system user"); ActivityManagerNative.getDefault().switchUser(UserHandle.USER_OWNER); ActivityManagerNative.getDefault().switchUser(UserHandle.USER_SYSTEM); userManager.removeUser(currentUser.id); userManager.removeUser(currentUser.id); WindowManagerGlobal.getWindowManagerService().lockNow(null /* options */); WindowManagerGlobal.getWindowManagerService().lockNow(null /* options */); return; return; Loading
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -340,7 +340,7 @@ public class KeyguardViewMediator extends SystemUI { @Override @Override public void onUserSwitchComplete(int userId) { public void onUserSwitchComplete(int userId) { mSwitchingUser = false; mSwitchingUser = false; if (userId != UserHandle.USER_OWNER) { if (userId != UserHandle.USER_SYSTEM) { UserInfo info = UserManager.get(mContext).getUserInfo(userId); UserInfo info = UserManager.get(mContext).getUserInfo(userId); if (info != null && info.isGuest()) { if (info != null && info.isGuest()) { // If we just switched to a guest, try to dismiss keyguard. // If we just switched to a guest, try to dismiss keyguard. Loading
packages/SystemUI/src/com/android/systemui/recents/Recents.java +22 −23 Original line number Original line Diff line number Diff line Loading @@ -20,7 +20,6 @@ import android.app.Activity; import android.app.ActivityManager; import android.app.ActivityManager; import android.app.ActivityOptions; import android.app.ActivityOptions; import android.app.ITaskStackListener; import android.app.ITaskStackListener; import android.appwidget.AppWidgetProviderInfo; import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException; import android.content.BroadcastReceiver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Context; Loading Loading @@ -62,15 +61,15 @@ import com.android.systemui.statusbar.phone.PhoneStatusBar; import java.util.ArrayList; import java.util.ArrayList; /** /** * Annotation for a method that is only called from the primary user's SystemUI process and will be * Annotation for a method that is only called from the system user's SystemUI process and will be * proxied to the current user. * proxied to the current user. */ */ @interface ProxyFromPrimaryToCurrentUser {} @interface ProxyFromSystemToCurrentUser {} /** /** * Annotation for a method that may be called from any user's SystemUI process and will be proxied * Annotation for a method that may be called from any user's SystemUI process and will be proxied * to the primary user. * to the system user. */ */ @interface ProxyFromAnyToPrimaryUser {} @interface ProxyFromAnyToSystemUser {} /** A proxy implementation for the recents component */ /** A proxy implementation for the recents component */ public class Recents extends SystemUI public class Recents extends SystemUI Loading Loading @@ -225,7 +224,7 @@ public class Recents extends SystemUI } } /** Initializes the Recents. */ /** Initializes the Recents. */ @ProxyFromPrimaryToCurrentUser @ProxyFromSystemToCurrentUser @Override @Override public void start() { public void start() { if (sInstance == null) { if (sInstance == null) { Loading @@ -245,7 +244,7 @@ public class Recents extends SystemUI // Only the owner has the callback to update the SysUI visibility flags, so all non-owner // Only the owner has the callback to update the SysUI visibility flags, so all non-owner // instances of AlternateRecentsComponent needs to notify the owner when the visibility // instances of AlternateRecentsComponent needs to notify the owner when the visibility // changes. // changes. if (mSystemServicesProxy.isForegroundUserOwner()) { if (mSystemServicesProxy.isForegroundUserSystem()) { mProxyBroadcastReceiver = new RecentsOwnerEventProxyReceiver(); mProxyBroadcastReceiver = new RecentsOwnerEventProxyReceiver(); IntentFilter filter = new IntentFilter(); IntentFilter filter = new IntentFilter(); filter.addAction(Recents.ACTION_PROXY_NOTIFY_RECENTS_VISIBLITY_TO_OWNER); filter.addAction(Recents.ACTION_PROXY_NOTIFY_RECENTS_VISIBLITY_TO_OWNER); Loading Loading @@ -278,10 +277,10 @@ public class Recents extends SystemUI } } /** Shows the Recents. */ /** Shows the Recents. */ @ProxyFromPrimaryToCurrentUser @ProxyFromSystemToCurrentUser @Override @Override public void showRecents(boolean triggeredFromAltTab, View statusBarView) { public void showRecents(boolean triggeredFromAltTab, View statusBarView) { if (mSystemServicesProxy.isForegroundUserOwner()) { if (mSystemServicesProxy.isForegroundUserSystem()) { showRecentsInternal(triggeredFromAltTab); showRecentsInternal(triggeredFromAltTab); } else { } else { Intent intent = createLocalBroadcastIntent(mContext, Intent intent = createLocalBroadcastIntent(mContext, Loading @@ -302,10 +301,10 @@ public class Recents extends SystemUI } } /** Hides the Recents. */ /** Hides the Recents. */ @ProxyFromPrimaryToCurrentUser @ProxyFromSystemToCurrentUser @Override @Override public void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) { public void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) { if (mSystemServicesProxy.isForegroundUserOwner()) { if (mSystemServicesProxy.isForegroundUserSystem()) { hideRecentsInternal(triggeredFromAltTab, triggeredFromHomeKey); hideRecentsInternal(triggeredFromAltTab, triggeredFromHomeKey); } else { } else { Intent intent = createLocalBroadcastIntent(mContext, Intent intent = createLocalBroadcastIntent(mContext, Loading @@ -328,10 +327,10 @@ public class Recents extends SystemUI } } /** Toggles the Recents activity. */ /** Toggles the Recents activity. */ @ProxyFromPrimaryToCurrentUser @ProxyFromSystemToCurrentUser @Override @Override public void toggleRecents(Display display, int layoutDirection, View statusBarView) { public void toggleRecents(Display display, int layoutDirection, View statusBarView) { if (mSystemServicesProxy.isForegroundUserOwner()) { if (mSystemServicesProxy.isForegroundUserSystem()) { toggleRecentsInternal(); toggleRecentsInternal(); } else { } else { Intent intent = createLocalBroadcastIntent(mContext, Intent intent = createLocalBroadcastIntent(mContext, Loading @@ -351,10 +350,10 @@ public class Recents extends SystemUI } } /** Preloads info for the Recents activity. */ /** Preloads info for the Recents activity. */ @ProxyFromPrimaryToCurrentUser @ProxyFromSystemToCurrentUser @Override @Override public void preloadRecents() { public void preloadRecents() { if (mSystemServicesProxy.isForegroundUserOwner()) { if (mSystemServicesProxy.isForegroundUserSystem()) { preloadRecentsInternal(); preloadRecentsInternal(); } else { } else { Intent intent = createLocalBroadcastIntent(mContext, Intent intent = createLocalBroadcastIntent(mContext, Loading Loading @@ -483,9 +482,9 @@ public class Recents extends SystemUI } } /** Updates on configuration change. */ /** Updates on configuration change. */ @ProxyFromPrimaryToCurrentUser @ProxyFromSystemToCurrentUser public void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) { if (mSystemServicesProxy.isForegroundUserOwner()) { if (mSystemServicesProxy.isForegroundUserSystem()) { configurationChanged(); configurationChanged(); } else { } else { Intent intent = createLocalBroadcastIntent(mContext, Intent intent = createLocalBroadcastIntent(mContext, Loading Loading @@ -849,16 +848,16 @@ public class Recents extends SystemUI } } /** Notifies the callbacks that the visibility of Recents has changed. */ /** Notifies the callbacks that the visibility of Recents has changed. */ @ProxyFromAnyToPrimaryUser @ProxyFromAnyToSystemUser public static void notifyVisibilityChanged(Context context, SystemServicesProxy ssp, public static void notifyVisibilityChanged(Context context, SystemServicesProxy ssp, boolean visible) { boolean visible) { if (ssp.isForegroundUserOwner()) { if (ssp.isForegroundUserSystem()) { visibilityChanged(visible); visibilityChanged(visible); } else { } else { Intent intent = createLocalBroadcastIntent(context, Intent intent = createLocalBroadcastIntent(context, ACTION_PROXY_NOTIFY_RECENTS_VISIBLITY_TO_OWNER); ACTION_PROXY_NOTIFY_RECENTS_VISIBLITY_TO_OWNER); intent.putExtra(EXTRA_RECENTS_VISIBILITY, visible); intent.putExtra(EXTRA_RECENTS_VISIBILITY, visible); context.sendBroadcastAsUser(intent, UserHandle.OWNER); context.sendBroadcastAsUser(intent, UserHandle.SYSTEM); } } } } static void visibilityChanged(boolean visible) { static void visibilityChanged(boolean visible) { Loading @@ -868,14 +867,14 @@ public class Recents extends SystemUI } } /** Notifies the status bar to trigger screen pinning. */ /** Notifies the status bar to trigger screen pinning. */ @ProxyFromAnyToPrimaryUser @ProxyFromAnyToSystemUser public static void startScreenPinning(Context context, SystemServicesProxy ssp) { public static void startScreenPinning(Context context, SystemServicesProxy ssp) { if (ssp.isForegroundUserOwner()) { if (ssp.isForegroundUserSystem()) { onStartScreenPinning(context); onStartScreenPinning(context); } else { } else { Intent intent = createLocalBroadcastIntent(context, Intent intent = createLocalBroadcastIntent(context, ACTION_PROXY_SCREEN_PINNING_REQUEST_TO_OWNER); ACTION_PROXY_SCREEN_PINNING_REQUEST_TO_OWNER); context.sendBroadcastAsUser(intent, UserHandle.OWNER); context.sendBroadcastAsUser(intent, UserHandle.SYSTEM); } } } } static void onStartScreenPinning(Context context) { static void onStartScreenPinning(Context context) { Loading
packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -526,10 +526,10 @@ public class SystemServicesProxy { /** /** * Returns whether the foreground user is the owner. * Returns whether the foreground user is the owner. */ */ public boolean isForegroundUserOwner() { public boolean isForegroundUserSystem() { if (mAm == null) return false; if (mAm == null) return false; return mAm.getCurrentUser() == UserHandle.USER_OWNER; return mAm.getCurrentUser() == UserHandle.USER_SYSTEM; } } /** /** Loading
packages/SystemUI/src/com/android/systemui/settings/CurrentUserTracker.java +0 −4 Original line number Original line Diff line number Diff line Loading @@ -58,8 +58,4 @@ public abstract class CurrentUserTracker extends BroadcastReceiver { } } public abstract void onUserSwitched(int newUserId); public abstract void onUserSwitched(int newUserId); public boolean isCurrentUserOwner() { return mCurrentUserId == UserHandle.USER_OWNER; } } }