blob: 407d256917982f5db420bfcb68d02fd9d762811c [file] [log] [blame]
Jorim Jaggi5cf17872014-03-26 18:31:48 +01001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
15 */
16
17package com.android.systemui.statusbar.phone;
18
Jason Monk297c04e2018-08-23 17:16:59 -040019import static com.android.systemui.plugins.ActivityStarter.OnDismissAction;
Selim Cinek06c12d62019-07-01 19:44:18 -070020import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_UNLOCK_FADING;
Gilad Brettercb51b8b2018-03-22 17:04:51 +020021import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK;
22import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING;
Jorim Jaggif5304ad2017-07-17 18:31:13 +020023
Jorim Jaggi786afcb2014-09-25 02:41:29 +020024import android.content.ComponentCallbacks2;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010025import android.content.Context;
Jason Chang1e4a4bd2018-05-22 17:30:19 +080026import android.content.res.ColorStateList;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010027import android.os.Bundle;
Jorim Jaggie29b2db2014-05-30 23:17:03 +020028import android.os.SystemClock;
Tej Singhdd7bd352018-02-09 19:33:15 -080029import android.util.StatsLog;
Jorim Jaggidf993512014-05-13 23:06:35 +020030import android.view.KeyEvent;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010031import android.view.View;
32import android.view.ViewGroup;
Jorim Jaggib774e552015-08-24 14:52:45 -070033import android.view.ViewRootImpl;
Jorim Jaggi786afcb2014-09-25 02:41:29 +020034import android.view.WindowManagerGlobal;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010035
Lucas Dupind236ee32019-10-08 15:33:59 -070036import androidx.annotation.VisibleForTesting;
37
Lucas Dupinbc9aac12018-03-04 20:18:15 -080038import com.android.internal.util.LatencyTracker;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010039import com.android.internal.widget.LockPatternUtils;
Adrian Roosb6011622014-05-14 15:52:53 +020040import com.android.keyguard.KeyguardUpdateMonitor;
Jorim Jaggia9d7fcd2017-05-18 01:08:12 +020041import com.android.keyguard.KeyguardUpdateMonitorCallback;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010042import com.android.keyguard.ViewMediatorCallback;
Lucas Dupin2e838ac2019-04-17 16:50:58 -070043import com.android.settingslib.animation.AppearAnimationUtils;
Jorim Jaggi8adb30c2016-09-13 15:02:22 -070044import com.android.systemui.DejankUtils;
Xiyuan Xia1b30f792016-01-06 08:50:30 -080045import com.android.systemui.SystemUIFactory;
Lucas Dupinafffbf92019-04-09 19:52:26 -070046import com.android.systemui.dock.DockManager;
Jorim Jaggi241ae102016-11-02 21:57:33 -070047import com.android.systemui.keyguard.DismissCallbackRegistry;
Dave Mankoffc195ea82019-06-28 16:33:25 -040048import com.android.systemui.plugins.FalsingManager;
Beverly8fdb5332019-02-04 14:29:49 -050049import com.android.systemui.plugins.statusbar.StatusBarStateController;
Lucas Dupinafffbf92019-04-09 19:52:26 -070050import com.android.systemui.shared.system.QuickStepContract;
Lucas Dupin269feda2019-04-29 17:11:02 -070051import com.android.systemui.statusbar.CrossFadeHelper;
Jason Monk297c04e2018-08-23 17:16:59 -040052import com.android.systemui.statusbar.NotificationMediaManager;
Adrian Roosd28ccd72016-01-06 15:23:14 +010053import com.android.systemui.statusbar.RemoteInputController;
Lucas Dupin2e838ac2019-04-17 16:50:58 -070054import com.android.systemui.statusbar.StatusBarState;
Beverly8fdb5332019-02-04 14:29:49 -050055import com.android.systemui.statusbar.SysuiStatusBarStateController;
Selim Cinek06c12d62019-07-01 19:44:18 -070056import com.android.systemui.statusbar.notification.ViewGroupFadeHelper;
Lucas Dupin15a6b6c2018-04-16 14:50:20 +080057import com.android.systemui.statusbar.phone.KeyguardBouncer.BouncerExpansionCallback;
Lucas Dupinafffbf92019-04-09 19:52:26 -070058import com.android.systemui.statusbar.policy.ConfigurationController;
Lucas Dupinc8f16e82019-09-17 18:24:50 -040059import com.android.systemui.statusbar.policy.KeyguardStateController;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010060
Lucas Dupin15a6b6c2018-04-16 14:50:20 +080061import java.io.PrintWriter;
Jorim Jaggibcbe9482016-11-23 17:37:49 +010062import java.util.ArrayList;
63
Heemin Seogacea4972019-11-06 10:27:20 -080064import javax.inject.Inject;
65import javax.inject.Singleton;
66
Jorim Jaggi5cf17872014-03-26 18:31:48 +010067/**
68 * Manages creating, showing, hiding and resetting the keyguard within the status bar. Calls back
69 * via {@link ViewMediatorCallback} to poke the wake lock and report that the keyguard is done,
70 * which is in turn, reported to this class by the current
71 * {@link com.android.keyguard.KeyguardViewBase}.
72 */
Heemin Seogacea4972019-11-06 10:27:20 -080073@Singleton
Evan Laird878c8532018-10-15 15:54:29 -040074public class StatusBarKeyguardViewManager implements RemoteInputController.Callback,
Lucas Dupin2e838ac2019-04-17 16:50:58 -070075 StatusBarStateController.StateListener, ConfigurationController.ConfigurationListener,
Selim Cineka678b0e2019-07-23 13:12:55 -070076 PanelExpansionListener, NavigationModeController.ModeChangedListener {
Jorim Jaggi76a16232014-08-08 17:00:47 +020077
78 // When hiding the Keyguard with timing supplied from WindowManager, better be early than late.
Jorim Jaggi56fd70c2016-10-27 19:57:08 -070079 private static final long HIDE_TIMING_CORRECTION_MS = - 16 * 3;
Jorim Jaggi76a16232014-08-08 17:00:47 +020080
Jorim Jaggi416493b2014-09-13 03:57:32 +020081 // Delay for showing the navigation bar when the bouncer appears. This should be kept in sync
82 // with the appear animations of the PIN/pattern/password views.
83 private static final long NAV_BAR_SHOW_DELAY_BOUNCER = 320;
84
Jorim Jaggi007f0e82015-08-14 13:56:01 -070085 private static final long WAKE_AND_UNLOCK_SCRIM_FADEOUT_DURATION_MS = 200;
86
Jorim Jaggie8fde5d2016-06-30 23:41:37 -070087 // Duration of the Keyguard dismissal animation in case the user is currently locked. This is to
88 // make everything a bit slower to bridge a gap until the user is unlocked and home screen has
89 // dranw its first frame.
90 private static final long KEYGUARD_DISMISS_DURATION_LOCKED = 2000;
91
Jorim Jaggi5cf17872014-03-26 18:31:48 +010092 private static String TAG = "StatusBarKeyguardViewManager";
93
Xiyuan Xia1b30f792016-01-06 08:50:30 -080094 protected final Context mContext;
Lucas Dupin1a8588d2018-08-21 12:18:47 -070095 private final StatusBarWindowController mStatusBarWindowController;
Lucas Dupin15a6b6c2018-04-16 14:50:20 +080096 private final BouncerExpansionCallback mExpansionCallback = new BouncerExpansionCallback() {
97 @Override
98 public void onFullyShown() {
99 updateStates();
Lucas Dupin3cfd6882019-03-19 15:22:03 -0700100 mStatusBar.wakeUpIfDozing(SystemClock.uptimeMillis(), mContainer, "BOUNCER_VISIBLE");
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700101 updateLockIcon();
Lucas Dupin15a6b6c2018-04-16 14:50:20 +0800102 }
103
104 @Override
Lucas Dupin84993542018-10-11 19:23:45 -0700105 public void onStartingToHide() {
106 updateStates();
107 }
108
109 @Override
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700110 public void onStartingToShow() {
111 updateLockIcon();
Lucas Dupin15a6b6c2018-04-16 14:50:20 +0800112 }
Lucas Dupin27321c42019-03-20 16:22:24 -0700113
114 @Override
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700115 public void onFullyHidden() {
116 updateStates();
117 updateLockIcon();
Lucas Dupin27321c42019-03-20 16:22:24 -0700118 }
Lucas Dupin15a6b6c2018-04-16 14:50:20 +0800119 };
Lucas Dupinafffbf92019-04-09 19:52:26 -0700120 private final DockManager.DockEventListener mDockEventListener =
121 new DockManager.DockEventListener() {
122 @Override
123 public void onEvent(int event) {
124 boolean isDocked = mDockManager.isDocked();
125 if (isDocked == mIsDocked) {
126 return;
127 }
128 mIsDocked = isDocked;
129 updateStates();
130 }
131 };
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100132
Xiyuan Xia1b30f792016-01-06 08:50:30 -0800133 protected LockPatternUtils mLockPatternUtils;
134 protected ViewMediatorCallback mViewMediatorCallback;
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500135 protected StatusBar mStatusBar;
Dave Mankoff59b94962019-12-16 16:42:15 -0500136 private NotificationPanelViewController mNotificationPanelViewController;
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200137 private BiometricUnlockController mBiometricUnlockController;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100138
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100139 private ViewGroup mContainer;
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700140 private ViewGroup mLockIconContainer;
Selim Cinek06c12d62019-07-01 19:44:18 -0700141 private View mNotificationContainer;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100142
Xiyuan Xia1b30f792016-01-06 08:50:30 -0800143 protected KeyguardBouncer mBouncer;
144 protected boolean mShowing;
145 protected boolean mOccluded;
146 protected boolean mRemoteInputActive;
Adrian Roos087826a2017-04-19 16:59:09 -0700147 private boolean mDozing;
Lucas Dupinafffbf92019-04-09 19:52:26 -0700148 private boolean mPulsing;
149 private boolean mGesturalNav;
150 private boolean mIsDocked;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100151
Xiyuan Xia1b30f792016-01-06 08:50:30 -0800152 protected boolean mFirstUpdate = true;
153 protected boolean mLastShowing;
154 protected boolean mLastOccluded;
Adrian Roosb6011622014-05-14 15:52:53 +0200155 private boolean mLastBouncerShowing;
156 private boolean mLastBouncerDismissible;
Xiyuan Xia1b30f792016-01-06 08:50:30 -0800157 protected boolean mLastRemoteInputActive;
Adrian Roos087826a2017-04-19 16:59:09 -0700158 private boolean mLastDozing;
Lucas Dupinafffbf92019-04-09 19:52:26 -0700159 private boolean mLastGesturalNav;
160 private boolean mLastIsDocked;
161 private boolean mLastPulsing;
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200162 private int mLastBiometricMode;
Lucas Dupin16cfe452018-02-08 13:14:50 -0800163 private boolean mGoingToSleepVisibleNotOccluded;
Lucas Dupin269feda2019-04-29 17:11:02 -0700164 private boolean mLastLockVisible;
Adrian Roosd28ccd72016-01-06 15:23:14 +0100165
Jorim Jaggi746f7fa2014-08-27 17:52:46 +0200166 private OnDismissAction mAfterKeyguardGoneAction;
Selim Cinek56e6a322019-10-01 12:06:05 -0700167 private Runnable mKeyguardGoneCancelAction;
Jorim Jaggibcbe9482016-11-23 17:37:49 +0100168 private final ArrayList<Runnable> mAfterKeyguardGoneRunnables = new ArrayList<>();
Adrian Roosb6011622014-05-14 15:52:53 +0200169
Adrian Roosfee661c2017-08-04 17:05:45 +0200170 // Dismiss action to be launched when we stop dozing or the keyguard is gone.
Adrian Roos34e65402017-08-07 19:32:45 +0200171 private DismissWithActionRequest mPendingWakeupAction;
Heemin Seogacea4972019-11-06 10:27:20 -0800172 private final KeyguardStateController mKeyguardStateController;
173 private final NotificationMediaManager mMediaManager;
174 private final SysuiStatusBarStateController mStatusBarStateController;
Lucas Dupinafffbf92019-04-09 19:52:26 -0700175 private final DockManager mDockManager;
Heemin Seogacea4972019-11-06 10:27:20 -0800176 private final KeyguardUpdateMonitor mKeyguardUpdateManager;
Selim Cinek06c12d62019-07-01 19:44:18 -0700177 private KeyguardBypassController mBypassController;
Adrian Roosfee661c2017-08-04 17:05:45 +0200178
Jorim Jaggia9d7fcd2017-05-18 01:08:12 +0200179 private final KeyguardUpdateMonitorCallback mUpdateMonitorCallback =
180 new KeyguardUpdateMonitorCallback() {
181 @Override
182 public void onEmergencyCallAction() {
183
184 // Since we won't get a setOccluded call we have to reset the view manually such that
185 // the bouncer goes away.
186 if (mOccluded) {
Lucas Dupin28f90292017-08-08 18:07:49 -0400187 reset(true /* hideBouncerWhenShowing */);
Jorim Jaggia9d7fcd2017-05-18 01:08:12 +0200188 }
189 }
190 };
191
Heemin Seogacea4972019-11-06 10:27:20 -0800192 @Inject
193 public StatusBarKeyguardViewManager(
194 Context context,
195 ViewMediatorCallback callback,
196 LockPatternUtils lockPatternUtils,
197 SysuiStatusBarStateController sysuiStatusBarStateController,
198 ConfigurationController configurationController,
199 KeyguardUpdateMonitor keyguardUpdateMonitor,
200 NavigationModeController navigationModeController,
201 DockManager dockManager,
202 StatusBarWindowController statusBarWindowController,
203 KeyguardStateController keyguardStateController,
204 NotificationMediaManager notificationMediaManager) {
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100205 mContext = context;
206 mViewMediatorCallback = callback;
207 mLockPatternUtils = lockPatternUtils;
Heemin Seogacea4972019-11-06 10:27:20 -0800208 mStatusBarWindowController = statusBarWindowController;
209 mKeyguardStateController = keyguardStateController;
210 mMediaManager = notificationMediaManager;
211 mKeyguardUpdateManager = keyguardUpdateMonitor;
212 mKeyguardUpdateManager.registerCallback(mUpdateMonitorCallback);
213 mStatusBarStateController = sysuiStatusBarStateController;
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700214 mStatusBarStateController.addCallback(this);
Heemin Seogacea4972019-11-06 10:27:20 -0800215 configurationController.addCallback(this);
Lucas Dupinbe050b22019-05-02 16:38:33 -0700216 mGesturalNav = QuickStepContract.isGesturalMode(
Heemin Seogacea4972019-11-06 10:27:20 -0800217 navigationModeController.addListener(this));
218 mDockManager = dockManager;
Lucas Dupinafffbf92019-04-09 19:52:26 -0700219 if (mDockManager != null) {
220 mDockManager.addListener(mDockEventListener);
221 mIsDocked = mDockManager.isDocked();
222 }
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100223 }
224
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500225 public void registerStatusBar(StatusBar statusBar,
Jason Monk421a9412017-02-06 09:15:21 -0800226 ViewGroup container,
Dave Mankoff59b94962019-12-16 16:42:15 -0500227 NotificationPanelViewController notificationPanelViewController,
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200228 BiometricUnlockController biometricUnlockController,
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700229 DismissCallbackRegistry dismissCallbackRegistry,
Selim Cinek06c12d62019-07-01 19:44:18 -0700230 ViewGroup lockIconContainer, View notificationContainer,
Dave Mankoffc195ea82019-06-28 16:33:25 -0400231 KeyguardBypassController bypassController, FalsingManager falsingManager) {
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500232 mStatusBar = statusBar;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100233 mContainer = container;
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700234 mLockIconContainer = lockIconContainer;
Lucas Dupin269feda2019-04-29 17:11:02 -0700235 if (mLockIconContainer != null) {
236 mLastLockVisible = mLockIconContainer.getVisibility() == View.VISIBLE;
237 }
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200238 mBiometricUnlockController = biometricUnlockController;
Xiyuan Xia1b30f792016-01-06 08:50:30 -0800239 mBouncer = SystemUIFactory.getInstance().createKeyguardBouncer(mContext,
Lucas Dupin15a6b6c2018-04-16 14:50:20 +0800240 mViewMediatorCallback, mLockPatternUtils, container, dismissCallbackRegistry,
Lucas Dupinc8f16e82019-09-17 18:24:50 -0400241 mExpansionCallback, mKeyguardStateController, falsingManager, bypassController);
Dave Mankoff59b94962019-12-16 16:42:15 -0500242 mNotificationPanelViewController = notificationPanelViewController;
243 notificationPanelViewController.addExpansionListener(this);
Selim Cinek06c12d62019-07-01 19:44:18 -0700244 mBypassController = bypassController;
245 mNotificationContainer = notificationContainer;
Lucas Dupinbc9aac12018-03-04 20:18:15 -0800246 }
247
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700248 @Override
249 public void onPanelExpansionChanged(float expansion, boolean tracking) {
Lucas Dupin6f0d71f2018-03-23 17:26:06 -0700250 // We don't want to translate the bounce when:
251 // • Keyguard is occluded, because we're in a FLAG_SHOW_WHEN_LOCKED activity and need to
252 // conserve the original animation.
253 // • The user quickly taps on the display and we show "swipe up to unlock."
254 // • Keyguard will be dismissed by an action. a.k.a: FLAG_DISMISS_KEYGUARD_ACTIVITY
jovanak5f6dc612018-03-27 11:59:22 -0700255 // • Full-screen user switcher is displayed.
Dave Mankoff59b94962019-12-16 16:42:15 -0500256 if (mNotificationPanelViewController.isUnlockHintRunning()) {
Lucas Dupinf9ca35e2018-05-16 20:41:35 -0700257 mBouncer.setExpansion(KeyguardBouncer.EXPANSION_HIDDEN);
Lucas Dupinc516bac2018-06-19 10:50:04 -0700258 } else if (bouncerNeedsScrimming()) {
Lucas Dupinf9ca35e2018-05-16 20:41:35 -0700259 mBouncer.setExpansion(KeyguardBouncer.EXPANSION_VISIBLE);
Lucas Dupin1c327432019-01-03 13:37:53 -0800260 } else if (mShowing) {
Lucas Dupinaaac2cb2018-06-08 14:11:41 -0700261 if (!isWakeAndUnlocking() && !mStatusBar.isInLaunchTransition()) {
Lucas Dupin71dd4842018-05-29 15:41:03 -0700262 mBouncer.setExpansion(expansion);
263 }
Lucas Dupinf9ca35e2018-05-16 20:41:35 -0700264 if (expansion != KeyguardBouncer.EXPANSION_HIDDEN && tracking
Lucas Dupinc8f16e82019-09-17 18:24:50 -0400265 && !mKeyguardStateController.canDismissLockScreen()
Lucas Dupin52a95872018-04-20 10:28:07 +0800266 && !mBouncer.isShowing() && !mBouncer.isAnimatingAway()) {
Lucas Dupin71dd4842018-05-29 15:41:03 -0700267 mBouncer.show(false /* resetSecuritySelection */, false /* scrimmed */);
Lucas Dupin3d565fa2018-03-20 15:40:14 -0700268 }
Lucas Dupinf6a1f172019-04-18 20:57:40 -0700269 } else if (mPulsing && expansion == KeyguardBouncer.EXPANSION_VISIBLE) {
270 // Panel expanded while pulsing but didn't translate the bouncer (because we are
271 // unlocked.) Let's simply wake-up to dismiss the lock screen.
272 mStatusBar.wakeUpIfDozing(SystemClock.uptimeMillis(), mContainer, "BOUNCER_VISIBLE");
Lucas Dupinbc9aac12018-03-04 20:18:15 -0800273 }
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700274 }
275
276 @Override
277 public void onQsExpansionChanged(float expansion) {
278 updateLockIcon();
279 }
280
281 private void updateLockIcon() {
Brad Stenning691c2742019-04-19 11:48:00 -0700282 // Not all form factors have a lock icon
283 if (mLockIconContainer == null) {
284 return;
285 }
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700286 boolean keyguardWithoutQs = mStatusBarStateController.getState() == StatusBarState.KEYGUARD
Dave Mankoff59b94962019-12-16 16:42:15 -0500287 && !mNotificationPanelViewController.isQsExpanded();
Lucas Dupin269feda2019-04-29 17:11:02 -0700288 boolean lockVisible = (mBouncer.isShowing() || keyguardWithoutQs)
Lucas Dupinc8f16e82019-09-17 18:24:50 -0400289 && !mBouncer.isAnimatingAway() && !mKeyguardStateController.isKeyguardFadingAway();
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700290
Lucas Dupin269feda2019-04-29 17:11:02 -0700291 if (mLastLockVisible != lockVisible) {
292 mLastLockVisible = lockVisible;
293 if (lockVisible) {
294 CrossFadeHelper.fadeIn(mLockIconContainer,
295 AppearAnimationUtils.DEFAULT_APPEAR_DURATION /* duration */,
296 0 /* delay */);
297 } else {
Selim Cinek84b2acc2019-07-07 00:40:38 -0700298 final long duration;
Lucas Dupinfbe69ea2019-09-10 15:19:15 -0700299 final int delay;
Selim Cinek84b2acc2019-07-07 00:40:38 -0700300 if (needsBypassFading()) {
301 duration = KeyguardBypassController.BYPASS_PANEL_FADE_DURATION;
Lucas Dupinfbe69ea2019-09-10 15:19:15 -0700302 delay = 0;
Selim Cinek84b2acc2019-07-07 00:40:38 -0700303 } else {
304 duration = AppearAnimationUtils.DEFAULT_APPEAR_DURATION / 2;
Lucas Dupinfbe69ea2019-09-10 15:19:15 -0700305 delay = 120;
Selim Cinek84b2acc2019-07-07 00:40:38 -0700306 }
Lucas Dupinfbe69ea2019-09-10 15:19:15 -0700307 CrossFadeHelper.fadeOut(mLockIconContainer, duration, delay, null /* runnable */);
Lucas Dupin269feda2019-04-29 17:11:02 -0700308 }
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700309 }
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100310 }
311
312 /**
313 * Show the keyguard. Will handle creating and attaching to the view manager
314 * lazily.
315 */
316 public void show(Bundle options) {
Jorim Jaggi03c701e2014-04-02 12:39:51 +0200317 mShowing = true;
Lucas Dupin1a8588d2018-08-21 12:18:47 -0700318 mStatusBarWindowController.setKeyguardShowing(true);
Lucas Dupind236ee32019-10-08 15:33:59 -0700319 mKeyguardStateController.notifyKeyguardState(mShowing,
Lucas Dupinc8f16e82019-09-17 18:24:50 -0400320 mKeyguardStateController.isOccluded());
Jorim Jaggife762342016-10-13 14:33:27 +0200321 reset(true /* hideBouncerWhenShowing */);
Tej Singhdd7bd352018-02-09 19:33:15 -0800322 StatsLog.write(StatsLog.KEYGUARD_STATE_CHANGED,
323 StatsLog.KEYGUARD_STATE_CHANGED__STATE__SHOWN);
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100324 }
325
Jorim Jaggia005f1b2014-04-16 19:06:10 +0200326 /**
327 * Shows the notification keyguard or the bouncer depending on
328 * {@link KeyguardBouncer#needsFullscreenBouncer()}.
329 */
Jorim Jaggife762342016-10-13 14:33:27 +0200330 protected void showBouncerOrKeyguard(boolean hideBouncerWhenShowing) {
Adrian Roos41eecff2017-06-29 14:09:52 +0200331 if (mBouncer.needsFullscreenBouncer() && !mDozing) {
Jorim Jaggia005f1b2014-04-16 19:06:10 +0200332 // The keyguard might be showing (already). So we need to hide it.
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500333 mStatusBar.hideKeyguard();
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100334 mBouncer.show(true /* resetSecuritySelection */);
Jorim Jaggia005f1b2014-04-16 19:06:10 +0200335 } else {
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500336 mStatusBar.showKeyguard();
Jorim Jaggife762342016-10-13 14:33:27 +0200337 if (hideBouncerWhenShowing) {
Jian Jind1b63982018-05-21 15:20:40 -0700338 hideBouncer(shouldDestroyViewOnReset() /* destroyView */);
Jorim Jaggife762342016-10-13 14:33:27 +0200339 mBouncer.prepare();
340 }
Jorim Jaggia005f1b2014-04-16 19:06:10 +0200341 }
Adrian Roos61676aa2017-08-03 16:24:32 +0200342 updateStates();
Jorim Jaggia005f1b2014-04-16 19:06:10 +0200343 }
344
Jian Jind1b63982018-05-21 15:20:40 -0700345 protected boolean shouldDestroyViewOnReset() {
346 return false;
347 }
348
Selim Cinek56e6a322019-10-01 12:06:05 -0700349 @VisibleForTesting
350 void hideBouncer(boolean destroyView) {
Lucas Dupinafffbf92019-04-09 19:52:26 -0700351 if (mBouncer == null) {
352 return;
353 }
Selim Cinek56e6a322019-10-01 12:06:05 -0700354 if (mShowing) {
355 // If we were showing the bouncer and then aborting, we need to also clear out any
356 // potential actions unless we actually unlocked.
357 mAfterKeyguardGoneAction = null;
358 if (mKeyguardGoneCancelAction != null) {
359 mKeyguardGoneCancelAction.run();
360 mKeyguardGoneCancelAction = null;
361 }
362 }
Adrian Roosfee661c2017-08-04 17:05:45 +0200363 mBouncer.hide(destroyView);
Adrian Roos34e65402017-08-07 19:32:45 +0200364 cancelPendingWakeupAction();
Adrian Roosfee661c2017-08-04 17:05:45 +0200365 }
366
Heemin Seog98df6972019-12-05 13:01:38 -0800367 /**
368 * Shows the keyguard bouncer - the password challenge on the lock screen
369 *
370 * @param scrimmed true when the bouncer should show scrimmed, false when the user will be
371 * dragging it and translation should be deferred {@see KeyguardBouncer#show(boolean, boolean)}
372 */
Lucas Dupinf9ca35e2018-05-16 20:41:35 -0700373 public void showBouncer(boolean scrimmed) {
374 if (mShowing && !mBouncer.isShowing()) {
375 mBouncer.show(false /* resetSecuritySelection */, scrimmed);
Dan Sandler3806c772014-05-08 14:52:10 -0400376 }
Jorim Jaggi4222d9a2014-04-23 16:13:15 +0200377 updateStates();
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100378 }
379
Jorim Jaggid9449862015-05-29 14:49:08 -0700380 public void dismissWithAction(OnDismissAction r, Runnable cancelAction,
381 boolean afterKeyguardGone) {
Lucas Dupinc80c67e2017-12-04 14:29:10 -0800382 dismissWithAction(r, cancelAction, afterKeyguardGone, null /* message */);
383 }
384
385 public void dismissWithAction(OnDismissAction r, Runnable cancelAction,
386 boolean afterKeyguardGone, String message) {
Adrian Roos0002a452014-07-03 13:46:07 +0200387 if (mShowing) {
Adrian Roos34e65402017-08-07 19:32:45 +0200388 cancelPendingWakeupAction();
Adrian Roosfee661c2017-08-04 17:05:45 +0200389 // If we're dozing, this needs to be delayed until after we wake up - unless we're
390 // wake-and-unlocking, because there dozing will last until the end of the transition.
391 if (mDozing && !isWakeAndUnlocking()) {
Adrian Roos34e65402017-08-07 19:32:45 +0200392 mPendingWakeupAction = new DismissWithActionRequest(
Lucas Dupinc80c67e2017-12-04 14:29:10 -0800393 r, cancelAction, afterKeyguardGone, message);
Adrian Roosfee661c2017-08-04 17:05:45 +0200394 return;
395 }
396
Jorim Jaggi746f7fa2014-08-27 17:52:46 +0200397 if (!afterKeyguardGone) {
Jorim Jaggid9449862015-05-29 14:49:08 -0700398 mBouncer.showWithDismissAction(r, cancelAction);
Jorim Jaggi746f7fa2014-08-27 17:52:46 +0200399 } else {
Jorim Jaggi746f7fa2014-08-27 17:52:46 +0200400 mAfterKeyguardGoneAction = r;
Selim Cinek56e6a322019-10-01 12:06:05 -0700401 mKeyguardGoneCancelAction = cancelAction;
Jorim Jaggi8d5a6e72016-11-02 21:57:33 -0700402 mBouncer.show(false /* resetSecuritySelection */);
Jorim Jaggi746f7fa2014-08-27 17:52:46 +0200403 }
Adrian Roos7d7090d2014-05-21 13:10:23 +0200404 }
405 updateStates();
406 }
407
Adrian Roosfee661c2017-08-04 17:05:45 +0200408 private boolean isWakeAndUnlocking() {
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200409 int mode = mBiometricUnlockController.getMode();
Adrian Roosfee661c2017-08-04 17:05:45 +0200410 return mode == MODE_WAKE_AND_UNLOCK || mode == MODE_WAKE_AND_UNLOCK_PULSING;
411 }
412
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100413 /**
Jorim Jaggibcbe9482016-11-23 17:37:49 +0100414 * Adds a {@param runnable} to be executed after Keyguard is gone.
415 */
416 public void addAfterKeyguardGoneRunnable(Runnable runnable) {
417 mAfterKeyguardGoneRunnables.add(runnable);
418 }
419
420 /**
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100421 * Reset the state of the view.
422 */
Jorim Jaggife762342016-10-13 14:33:27 +0200423 public void reset(boolean hideBouncerWhenShowing) {
Jorim Jaggi43bdbbd2014-05-09 16:05:53 +0200424 if (mShowing) {
Adrian Roos7a56d1a2017-08-04 15:04:43 +0200425 if (mOccluded && !mDozing) {
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500426 mStatusBar.hideKeyguard();
Adrian Roos91ffdc42017-08-04 18:14:41 +0200427 if (hideBouncerWhenShowing || mBouncer.needsFullscreenBouncer()) {
428 hideBouncer(false /* destroyView */);
429 }
Jorim Jaggi43bdbbd2014-05-09 16:05:53 +0200430 } else {
Jorim Jaggife762342016-10-13 14:33:27 +0200431 showBouncerOrKeyguard(hideBouncerWhenShowing);
Jorim Jaggi43bdbbd2014-05-09 16:05:53 +0200432 }
Heemin Seogacea4972019-11-06 10:27:20 -0800433 mKeyguardUpdateManager.sendKeyguardReset();
Jorim Jaggi43bdbbd2014-05-09 16:05:53 +0200434 updateStates();
Dan Sandler3806c772014-05-08 14:52:10 -0400435 }
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100436 }
437
Lucas Dupin16cfe452018-02-08 13:14:50 -0800438 public boolean isGoingToSleepVisibleNotOccluded() {
439 return mGoingToSleepVisibleNotOccluded;
440 }
441
Jorim Jaggi18f18ae2015-09-10 15:48:21 -0700442 public void onStartedGoingToSleep() {
Lucas Dupin16cfe452018-02-08 13:14:50 -0800443 mGoingToSleepVisibleNotOccluded = isShowing() && !isOccluded();
Jorim Jaggi18f18ae2015-09-10 15:48:21 -0700444 }
445
Jorim Jaggi0d210f62015-07-10 14:24:44 -0700446 public void onFinishedGoingToSleep() {
Lucas Dupin16cfe452018-02-08 13:14:50 -0800447 mGoingToSleepVisibleNotOccluded = false;
Jorim Jaggi03c701e2014-04-02 12:39:51 +0200448 mBouncer.onScreenTurnedOff();
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100449 }
450
Jorim Jaggi0d210f62015-07-10 14:24:44 -0700451 public void onStartedWakingUp() {
Adrian Roos731d4df2017-07-18 15:10:39 +0200452 // TODO: remove
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100453 }
454
Jorim Jaggi93739112015-08-13 15:53:14 -0700455 public void onScreenTurningOn() {
Adrian Roos731d4df2017-07-18 15:10:39 +0200456 // TODO: remove
Selim Cinek372d1bd2015-08-14 13:19:37 -0700457 }
458
Jorim Jaggi0d210f62015-07-10 14:24:44 -0700459 public void onScreenTurnedOn() {
Lucas Dupin9e3fa102017-11-08 17:16:55 -0800460 // TODO: remove
Jorim Jaggi0d210f62015-07-10 14:24:44 -0700461 }
462
Adrian Roosd28ccd72016-01-06 15:23:14 +0100463 @Override
464 public void onRemoteInputActive(boolean active) {
465 mRemoteInputActive = active;
466 updateStates();
467 }
468
Evan Laird878c8532018-10-15 15:54:29 -0400469 private void setDozing(boolean dozing) {
Adrian Roos41eecff2017-06-29 14:09:52 +0200470 if (mDozing != dozing) {
471 mDozing = dozing;
Adrian Roos61676aa2017-08-03 16:24:32 +0200472 if (dozing || mBouncer.needsFullscreenBouncer() || mOccluded) {
473 reset(dozing /* hideBouncerWhenShowing */);
474 }
Adrian Roos41eecff2017-06-29 14:09:52 +0200475 updateStates();
Adrian Roosfee661c2017-08-04 17:05:45 +0200476
477 if (!dozing) {
Adrian Roos34e65402017-08-07 19:32:45 +0200478 launchPendingWakeupAction();
Adrian Roosfee661c2017-08-04 17:05:45 +0200479 }
Adrian Roos41eecff2017-06-29 14:09:52 +0200480 }
Adrian Roos087826a2017-04-19 16:59:09 -0700481 }
482
Lucas Dupinafffbf92019-04-09 19:52:26 -0700483 /**
484 * If {@link StatusBar} is pulsing.
485 */
486 public void setPulsing(boolean pulsing) {
487 if (mPulsing != pulsing) {
488 mPulsing = pulsing;
489 updateStates();
490 }
491 }
492
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100493 public void setNeedsInput(boolean needsInput) {
Lucas Dupin1a8588d2018-08-21 12:18:47 -0700494 mStatusBarWindowController.setKeyguardNeedsInput(needsInput);
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100495 }
496
Adrian Roosd5c2db62016-03-08 16:11:31 -0800497 public boolean isUnlockWithWallpaper() {
Lucas Dupin1a8588d2018-08-21 12:18:47 -0700498 return mStatusBarWindowController.isShowingWallpaper();
Adrian Roosd5c2db62016-03-08 16:11:31 -0800499 }
500
Jorim Jaggi6626f542016-08-22 13:08:44 -0700501 public void setOccluded(boolean occluded, boolean animate) {
Selim Cinek3a49ba22017-08-10 11:17:39 -0700502 mStatusBar.setOccluded(occluded);
Selim Cinekbaa23272014-07-08 18:01:07 +0200503 if (occluded && !mOccluded && mShowing) {
Tej Singhdd7bd352018-02-09 19:33:15 -0800504 StatsLog.write(StatsLog.KEYGUARD_STATE_CHANGED,
505 StatsLog.KEYGUARD_STATE_CHANGED__STATE__OCCLUDED);
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500506 if (mStatusBar.isInLaunchTransition()) {
Selim Cinekbaa23272014-07-08 18:01:07 +0200507 mOccluded = true;
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500508 mStatusBar.fadeKeyguardAfterLaunchTransition(null /* beforeFading */,
Selim Cinekbaa23272014-07-08 18:01:07 +0200509 new Runnable() {
510 @Override
511 public void run() {
Lucas Dupin1a8588d2018-08-21 12:18:47 -0700512 mStatusBarWindowController.setKeyguardOccluded(mOccluded);
Jorim Jaggife762342016-10-13 14:33:27 +0200513 reset(true /* hideBouncerWhenShowing */);
Selim Cinekbaa23272014-07-08 18:01:07 +0200514 }
515 });
516 return;
517 }
Tej Singhdd7bd352018-02-09 19:33:15 -0800518 } else if (!occluded && mOccluded && mShowing) {
519 StatsLog.write(StatsLog.KEYGUARD_STATE_CHANGED,
520 StatsLog.KEYGUARD_STATE_CHANGED__STATE__SHOWN);
Selim Cinekbaa23272014-07-08 18:01:07 +0200521 }
Lucas Dupin28f90292017-08-08 18:07:49 -0400522 boolean isOccluding = !mOccluded && occluded;
Jorim Jaggia6310292014-04-16 14:11:52 +0200523 mOccluded = occluded;
Adrian Roos909fe2d2016-10-12 12:03:24 -0700524 if (mShowing) {
Jason Monk297c04e2018-08-23 17:16:59 -0400525 mMediaManager.updateMediaMetaData(false, animate && !occluded);
Adrian Roos909fe2d2016-10-12 12:03:24 -0700526 }
Lucas Dupin1a8588d2018-08-21 12:18:47 -0700527 mStatusBarWindowController.setKeyguardOccluded(occluded);
Jorim Jaggife762342016-10-13 14:33:27 +0200528
Adrian Roos7a56d1a2017-08-04 15:04:43 +0200529 // setDozing(false) will call reset once we stop dozing.
530 if (!mDozing) {
531 // If Keyguard is reshown, don't hide the bouncer as it might just have been requested
532 // by a FLAG_DISMISS_KEYGUARD_ACTIVITY.
Lucas Dupin28f90292017-08-08 18:07:49 -0400533 reset(isOccluding /* hideBouncerWhenShowing*/);
Adrian Roos7a56d1a2017-08-04 15:04:43 +0200534 }
Lucas Dupine9e70712019-05-01 14:41:49 -0700535 if (animate && !occluded && mShowing && !mBouncer.isShowing()) {
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500536 mStatusBar.animateKeyguardUnoccluding();
Jorim Jaggi6626f542016-08-22 13:08:44 -0700537 }
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100538 }
539
Dan Sandler4b22bdf2014-06-05 00:58:02 -0400540 public boolean isOccluded() {
541 return mOccluded;
542 }
543
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100544 /**
Jorim Jaggi76a16232014-08-08 17:00:47 +0200545 * Starts the animation before we dismiss Keyguard, i.e. an disappearing animation on the
546 * security view of the bouncer.
547 *
Jorim Jaggi8de4311c2014-08-11 22:36:20 +0200548 * @param finishRunnable the runnable to be run after the animation finished, or {@code null} if
549 * no action should be run
Jorim Jaggi76a16232014-08-08 17:00:47 +0200550 */
551 public void startPreHideAnimation(Runnable finishRunnable) {
552 if (mBouncer.isShowing()) {
553 mBouncer.startPreHideAnimation(finishRunnable);
Lucas Dupinfbe69ea2019-09-10 15:19:15 -0700554 mStatusBar.onBouncerPreHideAnimation();
Jorim Jaggi8de4311c2014-08-11 22:36:20 +0200555 } else if (finishRunnable != null) {
Jorim Jaggi76a16232014-08-08 17:00:47 +0200556 finishRunnable.run();
557 }
Dave Mankoff59b94962019-12-16 16:42:15 -0500558 mNotificationPanelViewController.blockExpansionForCurrentTouch();
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700559 updateLockIcon();
Jorim Jaggi76a16232014-08-08 17:00:47 +0200560 }
561
562 /**
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100563 * Hides the keyguard view
564 */
Jorim Jaggie8fde5d2016-06-30 23:41:37 -0700565 public void hide(long startTime, long fadeoutDuration) {
Jorim Jaggi03c701e2014-04-02 12:39:51 +0200566 mShowing = false;
Lucas Dupinc8f16e82019-09-17 18:24:50 -0400567 mKeyguardStateController.notifyKeyguardState(mShowing,
Lucas Dupind236ee32019-10-08 15:33:59 -0700568 mKeyguardStateController.isOccluded());
Adrian Roos34e65402017-08-07 19:32:45 +0200569 launchPendingWakeupAction();
Jorim Jaggi44cf9192014-06-17 19:16:00 -0700570
Heemin Seogacea4972019-11-06 10:27:20 -0800571 if (mKeyguardUpdateManager.needsSlowUnlockTransition()) {
Jorim Jaggie8fde5d2016-06-30 23:41:37 -0700572 fadeoutDuration = KEYGUARD_DISMISS_DURATION_LOCKED;
573 }
Jorim Jaggie29b2db2014-05-30 23:17:03 +0200574 long uptimeMillis = SystemClock.uptimeMillis();
Jorim Jaggi76a16232014-08-08 17:00:47 +0200575 long delay = Math.max(0, startTime + HIDE_TIMING_CORRECTION_MS - uptimeMillis);
Selim Cinekbaa23272014-07-08 18:01:07 +0200576
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500577 if (mStatusBar.isInLaunchTransition() ) {
578 mStatusBar.fadeKeyguardAfterLaunchTransition(new Runnable() {
Selim Cinekbaa23272014-07-08 18:01:07 +0200579 @Override
580 public void run() {
Lucas Dupin1a8588d2018-08-21 12:18:47 -0700581 mStatusBarWindowController.setKeyguardShowing(false);
582 mStatusBarWindowController.setKeyguardFadingAway(true);
Adrian Roosfee661c2017-08-04 17:05:45 +0200583 hideBouncer(true /* destroyView */);
Selim Cinekbaa23272014-07-08 18:01:07 +0200584 updateStates();
Selim Cinekbaa23272014-07-08 18:01:07 +0200585 }
586 }, new Runnable() {
587 @Override
588 public void run() {
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500589 mStatusBar.hideKeyguard();
Lucas Dupin1a8588d2018-08-21 12:18:47 -0700590 mStatusBarWindowController.setKeyguardFadingAway(false);
Selim Cinekbaa23272014-07-08 18:01:07 +0200591 mViewMediatorCallback.keyguardGone();
Jorim Jaggi746f7fa2014-08-27 17:52:46 +0200592 executeAfterKeyguardGoneAction();
Selim Cinekbaa23272014-07-08 18:01:07 +0200593 }
594 });
595 } else {
Jorim Jaggi8d5a6e72016-11-02 21:57:33 -0700596 executeAfterKeyguardGoneAction();
Jorim Jaggie93698b2016-11-11 18:24:38 -0800597 boolean wakeUnlockPulsing =
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200598 mBiometricUnlockController.getMode() == MODE_WAKE_AND_UNLOCK_PULSING;
Selim Cinekc075f152019-07-24 15:32:17 -0700599 boolean needsFading = needsBypassFading();
600 if (needsFading) {
601 delay = 0;
602 fadeoutDuration = KeyguardBypassController.BYPASS_PANEL_FADE_DURATION;
603 } else if (wakeUnlockPulsing) {
Jorim Jaggie93698b2016-11-11 18:24:38 -0800604 delay = 0;
605 fadeoutDuration = 240;
606 }
Selim Cinekc075f152019-07-24 15:32:17 -0700607 mStatusBar.setKeyguardFadingAway(startTime, delay, fadeoutDuration, needsFading);
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200608 mBiometricUnlockController.startKeyguardFadingAway();
Adrian Roosfee661c2017-08-04 17:05:45 +0200609 hideBouncer(true /* destroyView */);
Jorim Jaggie93698b2016-11-11 18:24:38 -0800610 if (wakeUnlockPulsing) {
Selim Cinekc075f152019-07-24 15:32:17 -0700611 if (needsFading) {
Dave Mankoff59b94962019-12-16 16:42:15 -0500612 ViewGroupFadeHelper.fadeOutAllChildrenExcept(
613 mNotificationPanelViewController.getView(),
Selim Cinek06c12d62019-07-01 19:44:18 -0700614 mNotificationContainer,
Selim Cinekc075f152019-07-24 15:32:17 -0700615 fadeoutDuration,
Selim Cinek06c12d62019-07-01 19:44:18 -0700616 () -> {
617 mStatusBar.hideKeyguard();
618 onKeyguardFadedAway();
619 });
620 } else {
621 mStatusBar.fadeKeyguardWhilePulsing();
622 }
Lucas Dupin9e3fa102017-11-08 17:16:55 -0800623 wakeAndUnlockDejank();
Jorim Jaggidbc3dce2014-08-01 01:16:36 +0200624 } else {
Selim Cinek06c12d62019-07-01 19:44:18 -0700625 boolean staying = mStatusBarStateController.leaveOpenOnKeyguardHide();
Jorim Jaggi83eb6bb2015-08-17 17:38:58 -0700626 if (!staying) {
Lucas Dupin1a8588d2018-08-21 12:18:47 -0700627 mStatusBarWindowController.setKeyguardFadingAway(true);
Selim Cinekc075f152019-07-24 15:32:17 -0700628 if (needsFading) {
Dave Mankoff59b94962019-12-16 16:42:15 -0500629 ViewGroupFadeHelper.fadeOutAllChildrenExcept(
630 mNotificationPanelViewController.getView(),
Selim Cinek06c12d62019-07-01 19:44:18 -0700631 mNotificationContainer,
Selim Cinekc075f152019-07-24 15:32:17 -0700632 fadeoutDuration,
Selim Cinek06c12d62019-07-01 19:44:18 -0700633 () -> {
634 mStatusBar.hideKeyguard();
635 });
636 } else {
637 mStatusBar.hideKeyguard();
638 }
Lucas Dupinf0a67e32018-09-19 15:23:54 -0700639 // hide() will happen asynchronously and might arrive after the scrims
640 // were already hidden, this means that the transition callback won't
641 // be triggered anymore and StatusBarWindowController will be forever in
642 // the fadingAway state.
643 mStatusBar.updateScrimController();
Lucas Dupin9e3fa102017-11-08 17:16:55 -0800644 wakeAndUnlockDejank();
Jorim Jaggi83eb6bb2015-08-17 17:38:58 -0700645 } else {
Selim Cinek06c12d62019-07-01 19:44:18 -0700646 mStatusBar.hideKeyguard();
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500647 mStatusBar.finishKeyguardFadingAway();
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200648 mBiometricUnlockController.finishKeyguardFadingAway();
Jorim Jaggi83eb6bb2015-08-17 17:38:58 -0700649 }
Jorim Jaggidbc3dce2014-08-01 01:16:36 +0200650 }
Selim Cinek84b2acc2019-07-07 00:40:38 -0700651 updateLockIcon();
Jorim Jaggi67b29d52017-06-09 18:00:00 -0700652 updateStates();
Lucas Dupin1a8588d2018-08-21 12:18:47 -0700653 mStatusBarWindowController.setKeyguardShowing(false);
Selim Cinekbaa23272014-07-08 18:01:07 +0200654 mViewMediatorCallback.keyguardGone();
Jorim Jaggie29b2db2014-05-30 23:17:03 +0200655 }
Tej Singhdd7bd352018-02-09 19:33:15 -0800656 StatsLog.write(StatsLog.KEYGUARD_STATE_CHANGED,
657 StatsLog.KEYGUARD_STATE_CHANGED__STATE__HIDDEN);
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100658 }
659
Selim Cinek06c12d62019-07-01 19:44:18 -0700660 private boolean needsBypassFading() {
661 return (mBiometricUnlockController.getMode() == MODE_UNLOCK_FADING
662 || mBiometricUnlockController.getMode() == MODE_WAKE_AND_UNLOCK_PULSING
663 || mBiometricUnlockController.getMode() == MODE_WAKE_AND_UNLOCK)
664 && mBypassController.getBypassEnabled();
665 }
666
Lucas Dupinafffbf92019-04-09 19:52:26 -0700667 @Override
Selim Cinekaa8bbf12016-05-04 14:13:20 -0700668 public void onDensityOrFontScaleChanged() {
Adrian Roosfee661c2017-08-04 17:05:45 +0200669 hideBouncer(true /* destroyView */);
Selim Cinekaa8bbf12016-05-04 14:13:20 -0700670 }
671
Lucas Dupinafffbf92019-04-09 19:52:26 -0700672 @Override
Winson Chung1aa24b92019-04-24 15:17:33 -0700673 public void onNavigationModeChanged(int mode) {
674 boolean gesturalNav = QuickStepContract.isGesturalMode(mode);
Lucas Dupinafffbf92019-04-09 19:52:26 -0700675 if (gesturalNav != mGesturalNav) {
676 mGesturalNav = gesturalNav;
677 updateStates();
678 }
679 }
680
Lucas Dupin8c51ce22017-11-21 13:21:05 -0800681 public void onThemeChanged() {
Adrian Roosfee661c2017-08-04 17:05:45 +0200682 hideBouncer(true /* destroyView */);
Lucas Dupinf190a852017-07-31 17:11:26 -0700683 mBouncer.prepare();
Lucas Dupin89516d42017-07-05 13:29:18 -0700684 }
685
Lucas Dupin9e3fa102017-11-08 17:16:55 -0800686 public void onKeyguardFadedAway() {
Lucas Dupin1a8588d2018-08-21 12:18:47 -0700687 mContainer.postDelayed(() -> mStatusBarWindowController.setKeyguardFadingAway(false),
Lucas Dupin9e3fa102017-11-08 17:16:55 -0800688 100);
Dave Mankoff59b94962019-12-16 16:42:15 -0500689 ViewGroupFadeHelper.reset(mNotificationPanelViewController.getView());
Lucas Dupin9e3fa102017-11-08 17:16:55 -0800690 mStatusBar.finishKeyguardFadingAway();
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200691 mBiometricUnlockController.finishKeyguardFadingAway();
Lucas Dupin9e3fa102017-11-08 17:16:55 -0800692 WindowManagerGlobal.getInstance().trimMemory(
693 ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN);
694
Jorim Jaggi90978852015-08-18 19:55:53 -0700695 }
696
Lucas Dupin9e3fa102017-11-08 17:16:55 -0800697 private void wakeAndUnlockDejank() {
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200698 if (mBiometricUnlockController.getMode() == MODE_WAKE_AND_UNLOCK
Jorim Jaggi8adb30c2016-09-13 15:02:22 -0700699 && LatencyTracker.isEnabled(mContext)) {
700 DejankUtils.postAfterTraversal(() ->
701 LatencyTracker.getInstance(mContext).onActionEnd(
702 LatencyTracker.ACTION_FINGERPRINT_WAKE_AND_UNLOCK));
703 }
Jorim Jaggi0d210f62015-07-10 14:24:44 -0700704 }
705
Jorim Jaggi746f7fa2014-08-27 17:52:46 +0200706 private void executeAfterKeyguardGoneAction() {
707 if (mAfterKeyguardGoneAction != null) {
708 mAfterKeyguardGoneAction.onDismiss();
709 mAfterKeyguardGoneAction = null;
710 }
Selim Cinek56e6a322019-10-01 12:06:05 -0700711 mKeyguardGoneCancelAction = null;
Jorim Jaggibcbe9482016-11-23 17:37:49 +0100712 for (int i = 0; i < mAfterKeyguardGoneRunnables.size(); i++) {
713 mAfterKeyguardGoneRunnables.get(i).run();
714 }
715 mAfterKeyguardGoneRunnables.clear();
Jorim Jaggi746f7fa2014-08-27 17:52:46 +0200716 }
717
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100718 /**
719 * Dismisses the keyguard by going to the next screen or making it gone.
720 */
Jorim Jaggi8d5a6e72016-11-02 21:57:33 -0700721 public void dismissAndCollapse() {
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500722 mStatusBar.executeRunnableDismissingKeyguard(null, null, true, false, true);
Jorim Jaggi8d5a6e72016-11-02 21:57:33 -0700723 }
724
Christoph Studer2231c6e2014-12-19 12:40:13 +0100725 /**
726 * WARNING: This method might cause Binder calls.
727 */
Jorim Jaggi15682502014-04-23 12:01:36 +0200728 public boolean isSecure() {
729 return mBouncer.isSecure();
730 }
731
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100732 /**
733 * @return Whether the keyguard is showing
734 */
735 public boolean isShowing() {
Jorim Jaggi03c701e2014-04-02 12:39:51 +0200736 return mShowing;
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100737 }
Jorim Jaggie5c7a892014-04-10 20:37:32 +0200738
739 /**
740 * Notifies this manager that the back button has been pressed.
741 *
Lucas Dupin3f54fe22018-04-08 23:17:40 -0700742 * @param hideImmediately Hide bouncer when {@code true}, keep it around otherwise.
743 * Non-scrimmed bouncers have a special animation tied to the expansion
744 * of the notification panel.
Jorim Jaggie5c7a892014-04-10 20:37:32 +0200745 * @return whether the back press has been handled
746 */
Lucas Dupin3f54fe22018-04-08 23:17:40 -0700747 public boolean onBackPressed(boolean hideImmediately) {
Jorim Jaggie5c7a892014-04-10 20:37:32 +0200748 if (mBouncer.isShowing()) {
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500749 mStatusBar.endAffordanceLaunch();
Fabian Kozynskibaa47b62019-04-26 15:40:43 -0400750 // The second condition is for SIM card locked bouncer
751 if (mBouncer.isScrimmed() && !mBouncer.needsFullscreenBouncer()) {
752 hideBouncer(false);
753 updateStates();
754 } else {
755 reset(hideImmediately);
756 }
Jorim Jaggie5c7a892014-04-10 20:37:32 +0200757 return true;
758 }
759 return false;
760 }
761
Jim Millerf41fc962014-06-18 16:33:51 -0700762 public boolean isBouncerShowing() {
763 return mBouncer.isShowing();
764 }
765
Lucas Dupinfa817a02019-07-02 15:22:54 -0700766 /**
767 * When bouncer is fully visible or {@link KeyguardBouncer#show(boolean)} was called but
768 * animation didn't finish yet.
769 */
770 public boolean bouncerIsOrWillBeShowing() {
Lucas Dupinb7d32742019-07-12 17:46:11 +0900771 return mBouncer.isShowing() || mBouncer.inTransit();
Lucas Dupinfa817a02019-07-02 15:22:54 -0700772 }
773
Jackal Guo42cae962018-04-18 18:41:19 +0800774 public boolean isFullscreenBouncer() {
775 return mBouncer.isFullscreenBouncer();
776 }
777
Jorim Jaggi416493b2014-09-13 03:57:32 +0200778 private long getNavBarShowDelay() {
Lucas Dupinc8f16e82019-09-17 18:24:50 -0400779 if (mKeyguardStateController.isKeyguardFadingAway()) {
780 return mKeyguardStateController.getKeyguardFadingAwayDelay();
Adrian Roos087826a2017-04-19 16:59:09 -0700781 } else if (mBouncer.isShowing()) {
Jorim Jaggi416493b2014-09-13 03:57:32 +0200782 return NAV_BAR_SHOW_DELAY_BOUNCER;
Adrian Roos087826a2017-04-19 16:59:09 -0700783 } else {
784 // No longer dozing, or remote input is active. No delay.
785 return 0;
Jorim Jaggi416493b2014-09-13 03:57:32 +0200786 }
787 }
788
789 private Runnable mMakeNavigationBarVisibleRunnable = new Runnable() {
790 @Override
791 public void run() {
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500792 mStatusBar.getNavigationBarView().getRootView().setVisibility(View.VISIBLE);
Jorim Jaggi416493b2014-09-13 03:57:32 +0200793 }
794 };
795
Xiyuan Xia1b30f792016-01-06 08:50:30 -0800796 protected void updateStates() {
Jorim Jaggie5c7a892014-04-10 20:37:32 +0200797 int vis = mContainer.getSystemUiVisibility();
Adrian Roosb6011622014-05-14 15:52:53 +0200798 boolean showing = mShowing;
799 boolean occluded = mOccluded;
800 boolean bouncerShowing = mBouncer.isShowing();
Jorim Jaggi95e89ca2014-11-24 20:12:50 +0100801 boolean bouncerDismissible = !mBouncer.isFullscreenBouncer();
Adrian Roosd28ccd72016-01-06 15:23:14 +0100802 boolean remoteInputActive = mRemoteInputActive;
Adrian Roosb6011622014-05-14 15:52:53 +0200803
Adrian Roosd28ccd72016-01-06 15:23:14 +0100804 if ((bouncerDismissible || !showing || remoteInputActive) !=
805 (mLastBouncerDismissible || !mLastShowing || mLastRemoteInputActive)
Adrian Roosb6011622014-05-14 15:52:53 +0200806 || mFirstUpdate) {
Adrian Roosd28ccd72016-01-06 15:23:14 +0100807 if (bouncerDismissible || !showing || remoteInputActive) {
Adrian Roosb6011622014-05-14 15:52:53 +0200808 mContainer.setSystemUiVisibility(vis & ~View.STATUS_BAR_DISABLE_BACK);
Jason Monk1e68fb32014-05-02 16:06:20 -0400809 } else {
Adrian Roosb6011622014-05-14 15:52:53 +0200810 mContainer.setSystemUiVisibility(vis | View.STATUS_BAR_DISABLE_BACK);
Jason Monk1e68fb32014-05-02 16:06:20 -0400811 }
Jorim Jaggia6310292014-04-16 14:11:52 +0200812 }
Jorim Jaggi0d210f62015-07-10 14:24:44 -0700813
Xiyuan Xia1b30f792016-01-06 08:50:30 -0800814 boolean navBarVisible = isNavBarVisible();
815 boolean lastNavBarVisible = getLastNavBarVisible();
Jorim Jaggi0d210f62015-07-10 14:24:44 -0700816 if (navBarVisible != lastNavBarVisible || mFirstUpdate) {
Brad Stenning7e411812018-04-13 22:52:39 -0700817 updateNavigationBarVisibility(navBarVisible);
Adrian Roosb6011622014-05-14 15:52:53 +0200818 }
819
820 if (bouncerShowing != mLastBouncerShowing || mFirstUpdate) {
Lucas Dupin1a8588d2018-08-21 12:18:47 -0700821 mStatusBarWindowController.setBouncerShowing(bouncerShowing);
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500822 mStatusBar.setBouncerShowing(bouncerShowing);
Lucas Dupinbea18f72019-07-03 14:29:37 -0700823 updateLockIcon();
Adrian Roosb6011622014-05-14 15:52:53 +0200824 }
825
Adrian Roosb6011622014-05-14 15:52:53 +0200826 if ((showing && !occluded) != (mLastShowing && !mLastOccluded) || mFirstUpdate) {
Heemin Seogacea4972019-11-06 10:27:20 -0800827 mKeyguardUpdateManager.onKeyguardVisibilityChanged(showing && !occluded);
Adrian Roosb6011622014-05-14 15:52:53 +0200828 }
829 if (bouncerShowing != mLastBouncerShowing || mFirstUpdate) {
Heemin Seogacea4972019-11-06 10:27:20 -0800830 mKeyguardUpdateManager.sendKeyguardBouncerChanged(bouncerShowing);
Adrian Roosb6011622014-05-14 15:52:53 +0200831 }
832
833 mFirstUpdate = false;
834 mLastShowing = showing;
835 mLastOccluded = occluded;
836 mLastBouncerShowing = bouncerShowing;
837 mLastBouncerDismissible = bouncerDismissible;
Adrian Roosd28ccd72016-01-06 15:23:14 +0100838 mLastRemoteInputActive = remoteInputActive;
Adrian Roos087826a2017-04-19 16:59:09 -0700839 mLastDozing = mDozing;
Lucas Dupinafffbf92019-04-09 19:52:26 -0700840 mLastPulsing = mPulsing;
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200841 mLastBiometricMode = mBiometricUnlockController.getMode();
Lucas Dupinafffbf92019-04-09 19:52:26 -0700842 mLastGesturalNav = mGesturalNav;
843 mLastIsDocked = mIsDocked;
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500844 mStatusBar.onKeyguardViewManagerStatesUpdated();
Jorim Jaggie5c7a892014-04-10 20:37:32 +0200845 }
Jorim Jaggi8c8bcc12014-04-16 21:36:51 +0200846
Brad Stenning7e411812018-04-13 22:52:39 -0700847 protected void updateNavigationBarVisibility(boolean navBarVisible) {
848 if (mStatusBar.getNavigationBarView() != null) {
849 if (navBarVisible) {
850 long delay = getNavBarShowDelay();
851 if (delay == 0) {
852 mMakeNavigationBarVisibleRunnable.run();
853 } else {
854 mContainer.postOnAnimationDelayed(mMakeNavigationBarVisibleRunnable,
855 delay);
856 }
857 } else {
858 mContainer.removeCallbacks(mMakeNavigationBarVisibleRunnable);
859 mStatusBar.getNavigationBarView().getRootView().setVisibility(View.GONE);
860 }
861 }
862 }
863
Xiyuan Xia1b30f792016-01-06 08:50:30 -0800864 /**
865 * @return Whether the navigation bar should be made visible based on the current state.
866 */
867 protected boolean isNavBarVisible() {
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200868 int biometricMode = mBiometricUnlockController.getMode();
Jorim Jaggif5304ad2017-07-17 18:31:13 +0200869 boolean keyguardShowing = mShowing && !mOccluded;
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200870 boolean hideWhileDozing = mDozing && biometricMode != MODE_WAKE_AND_UNLOCK_PULSING;
Lucas Dupinafffbf92019-04-09 19:52:26 -0700871 boolean keyguardWithGestureNav = (keyguardShowing && !mDozing || mPulsing && !mIsDocked)
872 && mGesturalNav;
Jorim Jaggif5304ad2017-07-17 18:31:13 +0200873 return (!keyguardShowing && !hideWhileDozing || mBouncer.isShowing()
Lucas Dupinafffbf92019-04-09 19:52:26 -0700874 || mRemoteInputActive || keyguardWithGestureNav);
Xiyuan Xia1b30f792016-01-06 08:50:30 -0800875 }
876
877 /**
878 * @return Whether the navigation bar was made visible based on the last known state.
879 */
880 protected boolean getLastNavBarVisible() {
Jorim Jaggif5304ad2017-07-17 18:31:13 +0200881 boolean keyguardShowing = mLastShowing && !mLastOccluded;
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200882 boolean hideWhileDozing = mLastDozing && mLastBiometricMode != MODE_WAKE_AND_UNLOCK_PULSING;
Lucas Dupinafffbf92019-04-09 19:52:26 -0700883 boolean keyguardWithGestureNav = (keyguardShowing && !mLastDozing
884 || mLastPulsing && !mLastIsDocked) && mLastGesturalNav;
Jorim Jaggif5304ad2017-07-17 18:31:13 +0200885 return (!keyguardShowing && !hideWhileDozing || mLastBouncerShowing
Lucas Dupinafffbf92019-04-09 19:52:26 -0700886 || mLastRemoteInputActive || keyguardWithGestureNav);
Xiyuan Xia1b30f792016-01-06 08:50:30 -0800887 }
888
Selim Cinek28540192016-02-19 17:25:08 -0800889 public boolean shouldDismissOnMenuPressed() {
890 return mBouncer.shouldDismissOnMenuPressed();
Jorim Jaggi8c8bcc12014-04-16 21:36:51 +0200891 }
Jorim Jaggidf993512014-05-13 23:06:35 +0200892
893 public boolean interceptMediaKey(KeyEvent event) {
894 return mBouncer.interceptMediaKey(event);
895 }
Jorim Jaggi8de4311c2014-08-11 22:36:20 +0200896
Jorim Jaggife762342016-10-13 14:33:27 +0200897 public void readyForKeyguardDone() {
898 mViewMediatorCallback.readyForKeyguardDone();
899 }
900
Jorim Jaggi84a3e7a2014-08-13 17:58:58 +0200901 public boolean shouldDisableWindowAnimationsForUnlock() {
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500902 return mStatusBar.isInLaunchTransition();
Jorim Jaggi84a3e7a2014-08-13 17:58:58 +0200903 }
904
Issei Suzuki5609ccb2019-06-13 15:04:08 +0200905
906 /**
907 * @return Whether subtle animation should be used for unlocking the device.
908 */
909 public boolean shouldSubtleWindowAnimationsForUnlock() {
Selim Cinek06c12d62019-07-01 19:44:18 -0700910 return needsBypassFading();
Issei Suzuki5609ccb2019-06-13 15:04:08 +0200911 }
912
Jorim Jaggi84a3e7a2014-08-13 17:58:58 +0200913 public boolean isGoingToNotificationShade() {
Heemin Seogacea4972019-11-06 10:27:20 -0800914 return mStatusBarStateController.leaveOpenOnKeyguardHide();
Jorim Jaggi84a3e7a2014-08-13 17:58:58 +0200915 }
Adrian Roos31b844b2014-11-21 13:55:09 +0100916
917 public boolean isSecure(int userId) {
918 return mBouncer.isSecure() || mLockPatternUtils.isSecure(userId);
919 }
Jim Millerab954542014-10-10 18:21:49 -0700920
Jorim Jaggi33ae80e2015-02-04 16:37:11 +0100921 public void keyguardGoingAway() {
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500922 mStatusBar.keyguardGoingAway();
Jorim Jaggi33ae80e2015-02-04 16:37:11 +0100923 }
Jim Miller25d7e512015-03-03 17:12:09 -0800924
Aarthi Balachander0a427ef2018-07-13 15:00:58 -0700925 /**
926 * Called when cancel button in bouncer is pressed.
927 */
928 public void onCancelClicked() {
929 // No-op
930 }
931
Jorim Jaggi5cc86592015-06-08 14:48:28 -0700932 /**
933 * Notifies that the user has authenticated by other means than using the bouncer, for example,
934 * fingerprint.
935 */
Jorim Jaggi25b4d4b2015-08-11 15:54:06 -0700936 public void notifyKeyguardAuthenticated(boolean strongAuth) {
937 mBouncer.notifyKeyguardAuthenticated(strongAuth);
Jorim Jaggi5cc86592015-06-08 14:48:28 -0700938 }
Jorim Jaggi0d210f62015-07-10 14:24:44 -0700939
Jason Chang1e4a4bd2018-05-22 17:30:19 +0800940 public void showBouncerMessage(String message, ColorStateList colorState) {
941 mBouncer.showMessage(message, colorState);
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700942 }
Jorim Jaggib774e552015-08-24 14:52:45 -0700943
944 public ViewRootImpl getViewRootImpl() {
Jason Monk2a6ea9c2017-01-26 11:14:51 -0500945 return mStatusBar.getStatusBarView().getViewRootImpl();
Jorim Jaggib774e552015-08-24 14:52:45 -0700946 }
Adrian Roosfee661c2017-08-04 17:05:45 +0200947
Adrian Roos34e65402017-08-07 19:32:45 +0200948 public void launchPendingWakeupAction() {
949 DismissWithActionRequest request = mPendingWakeupAction;
950 mPendingWakeupAction = null;
Adrian Roosfee661c2017-08-04 17:05:45 +0200951 if (request != null) {
952 if (mShowing) {
953 dismissWithAction(request.dismissAction, request.cancelAction,
Lucas Dupinc80c67e2017-12-04 14:29:10 -0800954 request.afterKeyguardGone, request.message);
Adrian Roosfee661c2017-08-04 17:05:45 +0200955 } else if (request.dismissAction != null) {
956 request.dismissAction.onDismiss();
957 }
958 }
959 }
960
Adrian Roos34e65402017-08-07 19:32:45 +0200961 public void cancelPendingWakeupAction() {
962 DismissWithActionRequest request = mPendingWakeupAction;
963 mPendingWakeupAction = null;
Adrian Roosfee661c2017-08-04 17:05:45 +0200964 if (request != null && request.cancelAction != null) {
965 request.cancelAction.run();
966 }
967 }
968
Lucas Dupinf9ca35e2018-05-16 20:41:35 -0700969 public boolean bouncerNeedsScrimming() {
Lucas Dupin300e3712019-03-27 19:33:36 -0700970 return mOccluded || mBouncer.willDismissWithAction()
Lucas Dupin93f714d2019-03-26 16:49:24 -0700971 || mStatusBar.isFullScreenUserSwitcherState()
Lucas Dupin300e3712019-03-27 19:33:36 -0700972 || (mBouncer.isShowing() && mBouncer.isScrimmed())
973 || mBouncer.isFullscreenBouncer();
Lucas Dupinf9ca35e2018-05-16 20:41:35 -0700974 }
975
Lucas Dupin15a6b6c2018-04-16 14:50:20 +0800976 public void dump(PrintWriter pw) {
977 pw.println("StatusBarKeyguardViewManager:");
978 pw.println(" mShowing: " + mShowing);
979 pw.println(" mOccluded: " + mOccluded);
980 pw.println(" mRemoteInputActive: " + mRemoteInputActive);
981 pw.println(" mDozing: " + mDozing);
982 pw.println(" mGoingToSleepVisibleNotOccluded: " + mGoingToSleepVisibleNotOccluded);
983 pw.println(" mAfterKeyguardGoneAction: " + mAfterKeyguardGoneAction);
984 pw.println(" mAfterKeyguardGoneRunnables: " + mAfterKeyguardGoneRunnables);
985 pw.println(" mPendingWakeupAction: " + mPendingWakeupAction);
986
987 if (mBouncer != null) {
988 mBouncer.dump(pw);
989 }
990 }
991
Evan Laird878c8532018-10-15 15:54:29 -0400992 @Override
993 public void onStateChanged(int newState) {
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700994 updateLockIcon();
Evan Laird878c8532018-10-15 15:54:29 -0400995 }
996
997 @Override
998 public void onDozingChanged(boolean isDozing) {
999 setDozing(isDozing);
1000 }
1001
Lucas Dupin407cc582019-03-11 21:04:31 -07001002 public KeyguardBouncer getBouncer() {
1003 return mBouncer;
1004 }
1005
Adrian Roos34e65402017-08-07 19:32:45 +02001006 private static class DismissWithActionRequest {
Adrian Roosfee661c2017-08-04 17:05:45 +02001007 final OnDismissAction dismissAction;
1008 final Runnable cancelAction;
1009 final boolean afterKeyguardGone;
Lucas Dupinc80c67e2017-12-04 14:29:10 -08001010 final String message;
Adrian Roosfee661c2017-08-04 17:05:45 +02001011
Adrian Roos34e65402017-08-07 19:32:45 +02001012 DismissWithActionRequest(OnDismissAction dismissAction, Runnable cancelAction,
Lucas Dupinc80c67e2017-12-04 14:29:10 -08001013 boolean afterKeyguardGone, String message) {
Adrian Roosfee661c2017-08-04 17:05:45 +02001014 this.dismissAction = dismissAction;
1015 this.cancelAction = cancelAction;
1016 this.afterKeyguardGone = afterKeyguardGone;
Lucas Dupinc80c67e2017-12-04 14:29:10 -08001017 this.message = message;
Adrian Roosfee661c2017-08-04 17:05:45 +02001018 }
1019 }
Jorim Jaggi5cf17872014-03-26 18:31:48 +01001020}