diff options
author | Aarthi Balachander <aarthibc@google.com> | 2018-07-13 15:00:58 -0700 |
---|---|---|
committer | Aarthi Balachander <aarthibc@google.com> | 2018-07-20 16:29:00 +0000 |
commit | 0a427ef5c13496f1242bfcc0995a707bb50c6ac3 (patch) | |
tree | e6f4deeed2af753f05178f62ea04cb2887307dc2 /packages/SystemUI/src | |
parent | 9c512f1c216e328de1da04a734d4eeba0db30db4 (diff) |
Show the user switcher only when the bouncer cancel button is pressed.
Bug: 110534280
Test: Tested on device
Change-Id: Iff465ebf5089e023a27e1ec192a580c20b35d242
(cherry picked from commit e2a6edceb007847cc8026b47c365a68610a074f7)
Diffstat (limited to 'packages/SystemUI/src')
12 files changed, 69 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardHostView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardHostView.java index df64160c9e48..265a961cd985 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardHostView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardHostView.java @@ -242,6 +242,11 @@ public class KeyguardHostView extends FrameLayout implements SecurityCallback { mViewMediatorCallback.resetKeyguard(); } + @Override + public void onCancelClicked() { + mViewMediatorCallback.onCancelClicked(); + } + public void resetSecurityContainer() { mSecurityContainer.reset(); } diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPINView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPINView.java index adb246013d5d..a3862eb72362 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPINView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPINView.java @@ -112,6 +112,7 @@ public class KeyguardPINView extends KeyguardPinBasedInputView { if (cancelBtn != null) { cancelBtn.setOnClickListener(view -> { mCallback.reset(); + mCallback.onCancelClicked(); }); } } diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java index 81cf3aef4bc8..6b24ad56d01c 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java @@ -201,6 +201,7 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView if (cancelBtn != null) { cancelBtn.setOnClickListener(view -> { mCallback.reset(); + mCallback.onCancelClicked(); }); } diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java index 50cf5b908092..9bf781678962 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java @@ -163,6 +163,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit if (cancelBtn != null) { cancelBtn.setOnClickListener(view -> { mCallback.reset(); + mCallback.onCancelClicked(); }); } } diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityCallback.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityCallback.java index 5b743c1a20c5..cbfbffbe50a4 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityCallback.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityCallback.java @@ -48,4 +48,11 @@ public interface KeyguardSecurityCallback { * Resets the keyguard view. */ void reset(); + + /** + * Call when cancel button is pressed in bouncer. + */ + default void onCancelClicked() { + // No-op + } } diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java index 745f81d55e31..f4acc0cdde13 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java @@ -68,6 +68,7 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe */ public void finish(boolean strongAuth, int targetUserId); public void reset(); + public void onCancelClicked(); } public KeyguardSecurityContainer(Context context, AttributeSet attrs) { @@ -447,6 +448,10 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe public void reset() { mSecurityCallback.reset(); } + + public void onCancelClicked() { + mSecurityCallback.onCancelClicked(); + } }; // The following is used to ignore callbacks from SecurityViews that are no longer current diff --git a/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java b/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java index 5c6812367a15..41b86a7450a3 100644 --- a/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java +++ b/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java @@ -105,4 +105,9 @@ public interface ViewMediatorCallback { * @return Message that should be displayed above the challenge. */ CharSequence consumeCustomMessage(); + + /** + * Call when cancel button is pressed in bouncer. + */ + void onCancelClicked(); } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 8d7eb6c719ff..4763fa9f426a 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -629,6 +629,11 @@ public class KeyguardViewMediator extends SystemUI { } @Override + public void onCancelClicked() { + mStatusBarKeyguardViewManager.onCancelClicked(); + } + + @Override public void onBouncerVisiblityChanged(boolean shown) { synchronized (KeyguardViewMediator.this) { adjustStatusBarLocked(shown); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java index 288b473461e0..7a357ae43ae3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java @@ -29,6 +29,7 @@ import android.view.ViewGroup.LayoutParams; import android.view.WindowManager; import com.android.keyguard.KeyguardUpdateMonitor; +import com.android.settingslib.users.UserManagerHelper; import com.android.systemui.BatteryMeterView; import com.android.systemui.Dependency; import com.android.systemui.Prefs; @@ -483,6 +484,13 @@ public class CarStatusBar extends StatusBar implements @Override public void updateKeyguardState(boolean goingToFullShade, boolean fromShadeLocked) { super.updateKeyguardState(goingToFullShade, fromShadeLocked); + UserManagerHelper helper = new UserManagerHelper(mContext); + if (!helper.isHeadlessSystemUser()) { + showUserSwitcher(); + } + } + + public void showUserSwitcher() { if (mFullscreenUserSwitcher != null) { if (mState == StatusBarState.FULLSCREEN_USER_SWITCHER) { mFullscreenUserSwitcher.show(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarStatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarStatusBarKeyguardViewManager.java index dabe23eec558..d0f06296545b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/car/CarStatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/CarStatusBarKeyguardViewManager.java @@ -39,4 +39,13 @@ public class CarStatusBarKeyguardViewManager extends StatusBarKeyguardViewManage protected boolean shouldDestroyViewOnReset() { return true; } + + /** + * Called when cancel button in bouncer is pressed. + */ + @Override + public void onCancelClicked() { + CarStatusBar statusBar = (CarStatusBar) mStatusBar; + statusBar.showUserSwitcher(); + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java index d720aef3a138..25a55bdd7a54 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java @@ -62,10 +62,8 @@ public class FullscreenUserSwitcher { } public void show() { - // On a switch from the system user, don't show the user switcher - if (mUserManagerHelper.isHeadlessSystemUser() && mUserManagerHelper - .userIsSystemUser(mUserManagerHelper.getForegroundUserInfo())) { - return; + if (mUserManagerHelper.isHeadlessSystemUser()) { + showUserGrid(); } if (mShowing) { return; @@ -99,6 +97,10 @@ public class FullscreenUserSwitcher { } private void onUserSelected(UserGridRecyclerView.UserRecord record) { + if (mUserManagerHelper.isHeadlessSystemUser()) { + hideUserGrid(); + } + if (record.mIsForeground) { dismissKeyguard(); return; @@ -106,6 +108,14 @@ public class FullscreenUserSwitcher { toggleSwitchInProgress(true); } + private void showUserGrid() { + mUserGridView.setVisibility(View.VISIBLE); + } + + private void hideUserGrid() { + mUserGridView.setVisibility(View.INVISIBLE); + } + // Dismisses the keyguard and shows bouncer if authentication is necessary. private void dismissKeyguard() { mStatusBar.executeRunnableDismissingKeyguard(null/* runnable */, null /* cancelAction */, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index 378910af3e02..c4424d8e3c97 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -693,6 +693,14 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb false /* delayed */, speedUpFactor); } + + /** + * Called when cancel button in bouncer is pressed. + */ + public void onCancelClicked() { + // No-op + } + /** * Notifies that the user has authenticated by other means than using the bouncer, for example, * fingerprint. |