Plumbing to allow keyguard to be shown with user switcher (issue 7175023)

-> Also reduced calls to lockNow, and moved this call in ActivityManagerService

Change-Id: I9ba34ca902f7c0f71fa4ec302104688ca8d11f55
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 3ef6767..d91edcd 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -21,6 +21,7 @@
 import com.android.internal.R;
 import com.android.internal.os.BatteryStatsImpl;
 import com.android.internal.os.ProcessStats;
+import com.android.internal.widget.LockPatternUtils;
 import com.android.server.AttributeCache;
 import com.android.server.IntentResolver;
 import com.android.server.ProcessMap;
@@ -14102,7 +14103,6 @@
                     return false;
                 }
 
-                mWindowManager.lockNow();
                 mWindowManager.startFreezingScreen(R.anim.screen_user_exit,
                         R.anim.screen_user_enter);
 
@@ -14121,6 +14121,10 @@
 
                 mWindowManager.setCurrentUser(userId);
 
+                // Once the internal notion of the active user has switched, we lock the device
+                // with the option to show the user switcher on the keyguard.
+                mWindowManager.lockNow(LockPatternUtils.USER_SWITCH_LOCK_OPTIONS);
+
                 final UserStartedState uss = mStartedUsers.get(userId);
 
                 mHandler.removeMessages(REPORT_USER_SWITCH_MSG);