Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package com.android.systemui.statusbar.phone; |
| 18 | |
Jason Monk | 297c04e | 2018-08-23 17:16:59 -0400 | [diff] [blame] | 19 | import static com.android.systemui.plugins.ActivityStarter.OnDismissAction; |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 20 | import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_UNLOCK_FADING; |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 21 | import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK; |
| 22 | import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING; |
Jorim Jaggi | f5304ad | 2017-07-17 18:31:13 +0200 | [diff] [blame] | 23 | |
Jorim Jaggi | 786afcb | 2014-09-25 02:41:29 +0200 | [diff] [blame] | 24 | import android.content.ComponentCallbacks2; |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 25 | import android.content.Context; |
Jason Chang | 1e4a4bd | 2018-05-22 17:30:19 +0800 | [diff] [blame] | 26 | import android.content.res.ColorStateList; |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 27 | import android.os.Bundle; |
Jorim Jaggi | e29b2db | 2014-05-30 23:17:03 +0200 | [diff] [blame] | 28 | import android.os.SystemClock; |
Tej Singh | dd7bd35 | 2018-02-09 19:33:15 -0800 | [diff] [blame] | 29 | import android.util.StatsLog; |
Jorim Jaggi | df99351 | 2014-05-13 23:06:35 +0200 | [diff] [blame] | 30 | import android.view.KeyEvent; |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 31 | import android.view.View; |
| 32 | import android.view.ViewGroup; |
Jorim Jaggi | b774e55 | 2015-08-24 14:52:45 -0700 | [diff] [blame] | 33 | import android.view.ViewRootImpl; |
Jorim Jaggi | 786afcb | 2014-09-25 02:41:29 +0200 | [diff] [blame] | 34 | import android.view.WindowManagerGlobal; |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 35 | |
Lucas Dupin | d236ee3 | 2019-10-08 15:33:59 -0700 | [diff] [blame] | 36 | import androidx.annotation.VisibleForTesting; |
| 37 | |
Lucas Dupin | bc9aac1 | 2018-03-04 20:18:15 -0800 | [diff] [blame] | 38 | import com.android.internal.util.LatencyTracker; |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 39 | import com.android.internal.widget.LockPatternUtils; |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 40 | import com.android.keyguard.KeyguardUpdateMonitor; |
Jorim Jaggi | a9d7fcd | 2017-05-18 01:08:12 +0200 | [diff] [blame] | 41 | import com.android.keyguard.KeyguardUpdateMonitorCallback; |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 42 | import com.android.keyguard.ViewMediatorCallback; |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 43 | import com.android.settingslib.animation.AppearAnimationUtils; |
Jorim Jaggi | 8adb30c | 2016-09-13 15:02:22 -0700 | [diff] [blame] | 44 | import com.android.systemui.DejankUtils; |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 45 | import com.android.systemui.SystemUIFactory; |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 46 | import com.android.systemui.dock.DockManager; |
Jorim Jaggi | 241ae10 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 47 | import com.android.systemui.keyguard.DismissCallbackRegistry; |
Dave Mankoff | c195ea8 | 2019-06-28 16:33:25 -0400 | [diff] [blame] | 48 | import com.android.systemui.plugins.FalsingManager; |
Beverly | 8fdb533 | 2019-02-04 14:29:49 -0500 | [diff] [blame] | 49 | import com.android.systemui.plugins.statusbar.StatusBarStateController; |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 50 | import com.android.systemui.shared.system.QuickStepContract; |
Lucas Dupin | 269feda | 2019-04-29 17:11:02 -0700 | [diff] [blame] | 51 | import com.android.systemui.statusbar.CrossFadeHelper; |
Jason Monk | 297c04e | 2018-08-23 17:16:59 -0400 | [diff] [blame] | 52 | import com.android.systemui.statusbar.NotificationMediaManager; |
Adrian Roos | d28ccd7 | 2016-01-06 15:23:14 +0100 | [diff] [blame] | 53 | import com.android.systemui.statusbar.RemoteInputController; |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 54 | import com.android.systemui.statusbar.StatusBarState; |
Beverly | 8fdb533 | 2019-02-04 14:29:49 -0500 | [diff] [blame] | 55 | import com.android.systemui.statusbar.SysuiStatusBarStateController; |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 56 | import com.android.systemui.statusbar.notification.ViewGroupFadeHelper; |
Lucas Dupin | 15a6b6c | 2018-04-16 14:50:20 +0800 | [diff] [blame] | 57 | import com.android.systemui.statusbar.phone.KeyguardBouncer.BouncerExpansionCallback; |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 58 | import com.android.systemui.statusbar.policy.ConfigurationController; |
Lucas Dupin | c8f16e8 | 2019-09-17 18:24:50 -0400 | [diff] [blame] | 59 | import com.android.systemui.statusbar.policy.KeyguardStateController; |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 60 | |
Lucas Dupin | 15a6b6c | 2018-04-16 14:50:20 +0800 | [diff] [blame] | 61 | import java.io.PrintWriter; |
Jorim Jaggi | bcbe948 | 2016-11-23 17:37:49 +0100 | [diff] [blame] | 62 | import java.util.ArrayList; |
| 63 | |
Heemin Seog | acea497 | 2019-11-06 10:27:20 -0800 | [diff] [blame] | 64 | import javax.inject.Inject; |
| 65 | import javax.inject.Singleton; |
| 66 | |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 67 | /** |
| 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 Seog | acea497 | 2019-11-06 10:27:20 -0800 | [diff] [blame] | 73 | @Singleton |
Evan Laird | 878c853 | 2018-10-15 15:54:29 -0400 | [diff] [blame] | 74 | public class StatusBarKeyguardViewManager implements RemoteInputController.Callback, |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 75 | StatusBarStateController.StateListener, ConfigurationController.ConfigurationListener, |
Selim Cinek | a678b0e | 2019-07-23 13:12:55 -0700 | [diff] [blame] | 76 | PanelExpansionListener, NavigationModeController.ModeChangedListener { |
Jorim Jaggi | 76a1623 | 2014-08-08 17:00:47 +0200 | [diff] [blame] | 77 | |
| 78 | // When hiding the Keyguard with timing supplied from WindowManager, better be early than late. |
Jorim Jaggi | 56fd70c | 2016-10-27 19:57:08 -0700 | [diff] [blame] | 79 | private static final long HIDE_TIMING_CORRECTION_MS = - 16 * 3; |
Jorim Jaggi | 76a1623 | 2014-08-08 17:00:47 +0200 | [diff] [blame] | 80 | |
Jorim Jaggi | 416493b | 2014-09-13 03:57:32 +0200 | [diff] [blame] | 81 | // 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 Jaggi | 007f0e8 | 2015-08-14 13:56:01 -0700 | [diff] [blame] | 85 | private static final long WAKE_AND_UNLOCK_SCRIM_FADEOUT_DURATION_MS = 200; |
| 86 | |
Jorim Jaggi | e8fde5d | 2016-06-30 23:41:37 -0700 | [diff] [blame] | 87 | // 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 Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 92 | private static String TAG = "StatusBarKeyguardViewManager"; |
| 93 | |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 94 | protected final Context mContext; |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 95 | private final StatusBarWindowController mStatusBarWindowController; |
Lucas Dupin | 15a6b6c | 2018-04-16 14:50:20 +0800 | [diff] [blame] | 96 | private final BouncerExpansionCallback mExpansionCallback = new BouncerExpansionCallback() { |
| 97 | @Override |
| 98 | public void onFullyShown() { |
| 99 | updateStates(); |
Lucas Dupin | 3cfd688 | 2019-03-19 15:22:03 -0700 | [diff] [blame] | 100 | mStatusBar.wakeUpIfDozing(SystemClock.uptimeMillis(), mContainer, "BOUNCER_VISIBLE"); |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 101 | updateLockIcon(); |
Lucas Dupin | 15a6b6c | 2018-04-16 14:50:20 +0800 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | @Override |
Lucas Dupin | 8499354 | 2018-10-11 19:23:45 -0700 | [diff] [blame] | 105 | public void onStartingToHide() { |
| 106 | updateStates(); |
| 107 | } |
| 108 | |
| 109 | @Override |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 110 | public void onStartingToShow() { |
| 111 | updateLockIcon(); |
Lucas Dupin | 15a6b6c | 2018-04-16 14:50:20 +0800 | [diff] [blame] | 112 | } |
Lucas Dupin | 27321c4 | 2019-03-20 16:22:24 -0700 | [diff] [blame] | 113 | |
| 114 | @Override |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 115 | public void onFullyHidden() { |
| 116 | updateStates(); |
| 117 | updateLockIcon(); |
Lucas Dupin | 27321c4 | 2019-03-20 16:22:24 -0700 | [diff] [blame] | 118 | } |
Lucas Dupin | 15a6b6c | 2018-04-16 14:50:20 +0800 | [diff] [blame] | 119 | }; |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 120 | 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 Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 132 | |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 133 | protected LockPatternUtils mLockPatternUtils; |
| 134 | protected ViewMediatorCallback mViewMediatorCallback; |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 135 | protected StatusBar mStatusBar; |
Dave Mankoff | 59b9496 | 2019-12-16 16:42:15 -0500 | [diff] [blame] | 136 | private NotificationPanelViewController mNotificationPanelViewController; |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 137 | private BiometricUnlockController mBiometricUnlockController; |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 138 | |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 139 | private ViewGroup mContainer; |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 140 | private ViewGroup mLockIconContainer; |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 141 | private View mNotificationContainer; |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 142 | |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 143 | protected KeyguardBouncer mBouncer; |
| 144 | protected boolean mShowing; |
| 145 | protected boolean mOccluded; |
| 146 | protected boolean mRemoteInputActive; |
Adrian Roos | 087826a | 2017-04-19 16:59:09 -0700 | [diff] [blame] | 147 | private boolean mDozing; |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 148 | private boolean mPulsing; |
| 149 | private boolean mGesturalNav; |
| 150 | private boolean mIsDocked; |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 151 | |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 152 | protected boolean mFirstUpdate = true; |
| 153 | protected boolean mLastShowing; |
| 154 | protected boolean mLastOccluded; |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 155 | private boolean mLastBouncerShowing; |
| 156 | private boolean mLastBouncerDismissible; |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 157 | protected boolean mLastRemoteInputActive; |
Adrian Roos | 087826a | 2017-04-19 16:59:09 -0700 | [diff] [blame] | 158 | private boolean mLastDozing; |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 159 | private boolean mLastGesturalNav; |
| 160 | private boolean mLastIsDocked; |
| 161 | private boolean mLastPulsing; |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 162 | private int mLastBiometricMode; |
Lucas Dupin | 16cfe45 | 2018-02-08 13:14:50 -0800 | [diff] [blame] | 163 | private boolean mGoingToSleepVisibleNotOccluded; |
Lucas Dupin | 269feda | 2019-04-29 17:11:02 -0700 | [diff] [blame] | 164 | private boolean mLastLockVisible; |
Adrian Roos | d28ccd7 | 2016-01-06 15:23:14 +0100 | [diff] [blame] | 165 | |
Jorim Jaggi | 746f7fa | 2014-08-27 17:52:46 +0200 | [diff] [blame] | 166 | private OnDismissAction mAfterKeyguardGoneAction; |
Selim Cinek | 56e6a32 | 2019-10-01 12:06:05 -0700 | [diff] [blame] | 167 | private Runnable mKeyguardGoneCancelAction; |
Jorim Jaggi | bcbe948 | 2016-11-23 17:37:49 +0100 | [diff] [blame] | 168 | private final ArrayList<Runnable> mAfterKeyguardGoneRunnables = new ArrayList<>(); |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 169 | |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 170 | // Dismiss action to be launched when we stop dozing or the keyguard is gone. |
Adrian Roos | 34e6540 | 2017-08-07 19:32:45 +0200 | [diff] [blame] | 171 | private DismissWithActionRequest mPendingWakeupAction; |
Heemin Seog | acea497 | 2019-11-06 10:27:20 -0800 | [diff] [blame] | 172 | private final KeyguardStateController mKeyguardStateController; |
| 173 | private final NotificationMediaManager mMediaManager; |
| 174 | private final SysuiStatusBarStateController mStatusBarStateController; |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 175 | private final DockManager mDockManager; |
Heemin Seog | acea497 | 2019-11-06 10:27:20 -0800 | [diff] [blame] | 176 | private final KeyguardUpdateMonitor mKeyguardUpdateManager; |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 177 | private KeyguardBypassController mBypassController; |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 178 | |
Jorim Jaggi | a9d7fcd | 2017-05-18 01:08:12 +0200 | [diff] [blame] | 179 | 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 Dupin | 28f9029 | 2017-08-08 18:07:49 -0400 | [diff] [blame] | 187 | reset(true /* hideBouncerWhenShowing */); |
Jorim Jaggi | a9d7fcd | 2017-05-18 01:08:12 +0200 | [diff] [blame] | 188 | } |
| 189 | } |
| 190 | }; |
| 191 | |
Heemin Seog | acea497 | 2019-11-06 10:27:20 -0800 | [diff] [blame] | 192 | @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 Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 205 | mContext = context; |
| 206 | mViewMediatorCallback = callback; |
| 207 | mLockPatternUtils = lockPatternUtils; |
Heemin Seog | acea497 | 2019-11-06 10:27:20 -0800 | [diff] [blame] | 208 | mStatusBarWindowController = statusBarWindowController; |
| 209 | mKeyguardStateController = keyguardStateController; |
| 210 | mMediaManager = notificationMediaManager; |
| 211 | mKeyguardUpdateManager = keyguardUpdateMonitor; |
| 212 | mKeyguardUpdateManager.registerCallback(mUpdateMonitorCallback); |
| 213 | mStatusBarStateController = sysuiStatusBarStateController; |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 214 | mStatusBarStateController.addCallback(this); |
Heemin Seog | acea497 | 2019-11-06 10:27:20 -0800 | [diff] [blame] | 215 | configurationController.addCallback(this); |
Lucas Dupin | be050b2 | 2019-05-02 16:38:33 -0700 | [diff] [blame] | 216 | mGesturalNav = QuickStepContract.isGesturalMode( |
Heemin Seog | acea497 | 2019-11-06 10:27:20 -0800 | [diff] [blame] | 217 | navigationModeController.addListener(this)); |
| 218 | mDockManager = dockManager; |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 219 | if (mDockManager != null) { |
| 220 | mDockManager.addListener(mDockEventListener); |
| 221 | mIsDocked = mDockManager.isDocked(); |
| 222 | } |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 223 | } |
| 224 | |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 225 | public void registerStatusBar(StatusBar statusBar, |
Jason Monk | 421a941 | 2017-02-06 09:15:21 -0800 | [diff] [blame] | 226 | ViewGroup container, |
Dave Mankoff | 59b9496 | 2019-12-16 16:42:15 -0500 | [diff] [blame] | 227 | NotificationPanelViewController notificationPanelViewController, |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 228 | BiometricUnlockController biometricUnlockController, |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 229 | DismissCallbackRegistry dismissCallbackRegistry, |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 230 | ViewGroup lockIconContainer, View notificationContainer, |
Dave Mankoff | c195ea8 | 2019-06-28 16:33:25 -0400 | [diff] [blame] | 231 | KeyguardBypassController bypassController, FalsingManager falsingManager) { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 232 | mStatusBar = statusBar; |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 233 | mContainer = container; |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 234 | mLockIconContainer = lockIconContainer; |
Lucas Dupin | 269feda | 2019-04-29 17:11:02 -0700 | [diff] [blame] | 235 | if (mLockIconContainer != null) { |
| 236 | mLastLockVisible = mLockIconContainer.getVisibility() == View.VISIBLE; |
| 237 | } |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 238 | mBiometricUnlockController = biometricUnlockController; |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 239 | mBouncer = SystemUIFactory.getInstance().createKeyguardBouncer(mContext, |
Lucas Dupin | 15a6b6c | 2018-04-16 14:50:20 +0800 | [diff] [blame] | 240 | mViewMediatorCallback, mLockPatternUtils, container, dismissCallbackRegistry, |
Lucas Dupin | c8f16e8 | 2019-09-17 18:24:50 -0400 | [diff] [blame] | 241 | mExpansionCallback, mKeyguardStateController, falsingManager, bypassController); |
Dave Mankoff | 59b9496 | 2019-12-16 16:42:15 -0500 | [diff] [blame] | 242 | mNotificationPanelViewController = notificationPanelViewController; |
| 243 | notificationPanelViewController.addExpansionListener(this); |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 244 | mBypassController = bypassController; |
| 245 | mNotificationContainer = notificationContainer; |
Lucas Dupin | bc9aac1 | 2018-03-04 20:18:15 -0800 | [diff] [blame] | 246 | } |
| 247 | |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 248 | @Override |
| 249 | public void onPanelExpansionChanged(float expansion, boolean tracking) { |
Lucas Dupin | 6f0d71f | 2018-03-23 17:26:06 -0700 | [diff] [blame] | 250 | // 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 |
jovanak | 5f6dc61 | 2018-03-27 11:59:22 -0700 | [diff] [blame] | 255 | // • Full-screen user switcher is displayed. |
Dave Mankoff | 59b9496 | 2019-12-16 16:42:15 -0500 | [diff] [blame] | 256 | if (mNotificationPanelViewController.isUnlockHintRunning()) { |
Lucas Dupin | f9ca35e | 2018-05-16 20:41:35 -0700 | [diff] [blame] | 257 | mBouncer.setExpansion(KeyguardBouncer.EXPANSION_HIDDEN); |
Lucas Dupin | c516bac | 2018-06-19 10:50:04 -0700 | [diff] [blame] | 258 | } else if (bouncerNeedsScrimming()) { |
Lucas Dupin | f9ca35e | 2018-05-16 20:41:35 -0700 | [diff] [blame] | 259 | mBouncer.setExpansion(KeyguardBouncer.EXPANSION_VISIBLE); |
Lucas Dupin | 1c32743 | 2019-01-03 13:37:53 -0800 | [diff] [blame] | 260 | } else if (mShowing) { |
Lucas Dupin | aaac2cb | 2018-06-08 14:11:41 -0700 | [diff] [blame] | 261 | if (!isWakeAndUnlocking() && !mStatusBar.isInLaunchTransition()) { |
Lucas Dupin | 71dd484 | 2018-05-29 15:41:03 -0700 | [diff] [blame] | 262 | mBouncer.setExpansion(expansion); |
| 263 | } |
Lucas Dupin | f9ca35e | 2018-05-16 20:41:35 -0700 | [diff] [blame] | 264 | if (expansion != KeyguardBouncer.EXPANSION_HIDDEN && tracking |
Lucas Dupin | c8f16e8 | 2019-09-17 18:24:50 -0400 | [diff] [blame] | 265 | && !mKeyguardStateController.canDismissLockScreen() |
Lucas Dupin | 52a9587 | 2018-04-20 10:28:07 +0800 | [diff] [blame] | 266 | && !mBouncer.isShowing() && !mBouncer.isAnimatingAway()) { |
Lucas Dupin | 71dd484 | 2018-05-29 15:41:03 -0700 | [diff] [blame] | 267 | mBouncer.show(false /* resetSecuritySelection */, false /* scrimmed */); |
Lucas Dupin | 3d565fa | 2018-03-20 15:40:14 -0700 | [diff] [blame] | 268 | } |
Lucas Dupin | f6a1f17 | 2019-04-18 20:57:40 -0700 | [diff] [blame] | 269 | } 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 Dupin | bc9aac1 | 2018-03-04 20:18:15 -0800 | [diff] [blame] | 273 | } |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 274 | } |
| 275 | |
| 276 | @Override |
| 277 | public void onQsExpansionChanged(float expansion) { |
| 278 | updateLockIcon(); |
| 279 | } |
| 280 | |
| 281 | private void updateLockIcon() { |
Brad Stenning | 691c274 | 2019-04-19 11:48:00 -0700 | [diff] [blame] | 282 | // Not all form factors have a lock icon |
| 283 | if (mLockIconContainer == null) { |
| 284 | return; |
| 285 | } |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 286 | boolean keyguardWithoutQs = mStatusBarStateController.getState() == StatusBarState.KEYGUARD |
Dave Mankoff | 59b9496 | 2019-12-16 16:42:15 -0500 | [diff] [blame] | 287 | && !mNotificationPanelViewController.isQsExpanded(); |
Lucas Dupin | 269feda | 2019-04-29 17:11:02 -0700 | [diff] [blame] | 288 | boolean lockVisible = (mBouncer.isShowing() || keyguardWithoutQs) |
Lucas Dupin | c8f16e8 | 2019-09-17 18:24:50 -0400 | [diff] [blame] | 289 | && !mBouncer.isAnimatingAway() && !mKeyguardStateController.isKeyguardFadingAway(); |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 290 | |
Lucas Dupin | 269feda | 2019-04-29 17:11:02 -0700 | [diff] [blame] | 291 | 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 Cinek | 84b2acc | 2019-07-07 00:40:38 -0700 | [diff] [blame] | 298 | final long duration; |
Lucas Dupin | fbe69ea | 2019-09-10 15:19:15 -0700 | [diff] [blame] | 299 | final int delay; |
Selim Cinek | 84b2acc | 2019-07-07 00:40:38 -0700 | [diff] [blame] | 300 | if (needsBypassFading()) { |
| 301 | duration = KeyguardBypassController.BYPASS_PANEL_FADE_DURATION; |
Lucas Dupin | fbe69ea | 2019-09-10 15:19:15 -0700 | [diff] [blame] | 302 | delay = 0; |
Selim Cinek | 84b2acc | 2019-07-07 00:40:38 -0700 | [diff] [blame] | 303 | } else { |
| 304 | duration = AppearAnimationUtils.DEFAULT_APPEAR_DURATION / 2; |
Lucas Dupin | fbe69ea | 2019-09-10 15:19:15 -0700 | [diff] [blame] | 305 | delay = 120; |
Selim Cinek | 84b2acc | 2019-07-07 00:40:38 -0700 | [diff] [blame] | 306 | } |
Lucas Dupin | fbe69ea | 2019-09-10 15:19:15 -0700 | [diff] [blame] | 307 | CrossFadeHelper.fadeOut(mLockIconContainer, duration, delay, null /* runnable */); |
Lucas Dupin | 269feda | 2019-04-29 17:11:02 -0700 | [diff] [blame] | 308 | } |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 309 | } |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 310 | } |
| 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 Jaggi | 03c701e | 2014-04-02 12:39:51 +0200 | [diff] [blame] | 317 | mShowing = true; |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 318 | mStatusBarWindowController.setKeyguardShowing(true); |
Lucas Dupin | d236ee3 | 2019-10-08 15:33:59 -0700 | [diff] [blame] | 319 | mKeyguardStateController.notifyKeyguardState(mShowing, |
Lucas Dupin | c8f16e8 | 2019-09-17 18:24:50 -0400 | [diff] [blame] | 320 | mKeyguardStateController.isOccluded()); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 321 | reset(true /* hideBouncerWhenShowing */); |
Tej Singh | dd7bd35 | 2018-02-09 19:33:15 -0800 | [diff] [blame] | 322 | StatsLog.write(StatsLog.KEYGUARD_STATE_CHANGED, |
| 323 | StatsLog.KEYGUARD_STATE_CHANGED__STATE__SHOWN); |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 324 | } |
| 325 | |
Jorim Jaggi | a005f1b | 2014-04-16 19:06:10 +0200 | [diff] [blame] | 326 | /** |
| 327 | * Shows the notification keyguard or the bouncer depending on |
| 328 | * {@link KeyguardBouncer#needsFullscreenBouncer()}. |
| 329 | */ |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 330 | protected void showBouncerOrKeyguard(boolean hideBouncerWhenShowing) { |
Adrian Roos | 41eecff | 2017-06-29 14:09:52 +0200 | [diff] [blame] | 331 | if (mBouncer.needsFullscreenBouncer() && !mDozing) { |
Jorim Jaggi | a005f1b | 2014-04-16 19:06:10 +0200 | [diff] [blame] | 332 | // The keyguard might be showing (already). So we need to hide it. |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 333 | mStatusBar.hideKeyguard(); |
Jorim Jaggi | 95e89ca | 2014-11-24 20:12:50 +0100 | [diff] [blame] | 334 | mBouncer.show(true /* resetSecuritySelection */); |
Jorim Jaggi | a005f1b | 2014-04-16 19:06:10 +0200 | [diff] [blame] | 335 | } else { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 336 | mStatusBar.showKeyguard(); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 337 | if (hideBouncerWhenShowing) { |
Jian Jin | d1b6398 | 2018-05-21 15:20:40 -0700 | [diff] [blame] | 338 | hideBouncer(shouldDestroyViewOnReset() /* destroyView */); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 339 | mBouncer.prepare(); |
| 340 | } |
Jorim Jaggi | a005f1b | 2014-04-16 19:06:10 +0200 | [diff] [blame] | 341 | } |
Adrian Roos | 61676aa | 2017-08-03 16:24:32 +0200 | [diff] [blame] | 342 | updateStates(); |
Jorim Jaggi | a005f1b | 2014-04-16 19:06:10 +0200 | [diff] [blame] | 343 | } |
| 344 | |
Jian Jin | d1b6398 | 2018-05-21 15:20:40 -0700 | [diff] [blame] | 345 | protected boolean shouldDestroyViewOnReset() { |
| 346 | return false; |
| 347 | } |
| 348 | |
Selim Cinek | 56e6a32 | 2019-10-01 12:06:05 -0700 | [diff] [blame] | 349 | @VisibleForTesting |
| 350 | void hideBouncer(boolean destroyView) { |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 351 | if (mBouncer == null) { |
| 352 | return; |
| 353 | } |
Selim Cinek | 56e6a32 | 2019-10-01 12:06:05 -0700 | [diff] [blame] | 354 | 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 Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 363 | mBouncer.hide(destroyView); |
Adrian Roos | 34e6540 | 2017-08-07 19:32:45 +0200 | [diff] [blame] | 364 | cancelPendingWakeupAction(); |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 365 | } |
| 366 | |
Heemin Seog | 98df697 | 2019-12-05 13:01:38 -0800 | [diff] [blame] | 367 | /** |
| 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 Dupin | f9ca35e | 2018-05-16 20:41:35 -0700 | [diff] [blame] | 373 | public void showBouncer(boolean scrimmed) { |
| 374 | if (mShowing && !mBouncer.isShowing()) { |
| 375 | mBouncer.show(false /* resetSecuritySelection */, scrimmed); |
Dan Sandler | 3806c77 | 2014-05-08 14:52:10 -0400 | [diff] [blame] | 376 | } |
Jorim Jaggi | 4222d9a | 2014-04-23 16:13:15 +0200 | [diff] [blame] | 377 | updateStates(); |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 378 | } |
| 379 | |
Jorim Jaggi | d944986 | 2015-05-29 14:49:08 -0700 | [diff] [blame] | 380 | public void dismissWithAction(OnDismissAction r, Runnable cancelAction, |
| 381 | boolean afterKeyguardGone) { |
Lucas Dupin | c80c67e | 2017-12-04 14:29:10 -0800 | [diff] [blame] | 382 | dismissWithAction(r, cancelAction, afterKeyguardGone, null /* message */); |
| 383 | } |
| 384 | |
| 385 | public void dismissWithAction(OnDismissAction r, Runnable cancelAction, |
| 386 | boolean afterKeyguardGone, String message) { |
Adrian Roos | 0002a45 | 2014-07-03 13:46:07 +0200 | [diff] [blame] | 387 | if (mShowing) { |
Adrian Roos | 34e6540 | 2017-08-07 19:32:45 +0200 | [diff] [blame] | 388 | cancelPendingWakeupAction(); |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 389 | // 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 Roos | 34e6540 | 2017-08-07 19:32:45 +0200 | [diff] [blame] | 392 | mPendingWakeupAction = new DismissWithActionRequest( |
Lucas Dupin | c80c67e | 2017-12-04 14:29:10 -0800 | [diff] [blame] | 393 | r, cancelAction, afterKeyguardGone, message); |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 394 | return; |
| 395 | } |
| 396 | |
Jorim Jaggi | 746f7fa | 2014-08-27 17:52:46 +0200 | [diff] [blame] | 397 | if (!afterKeyguardGone) { |
Jorim Jaggi | d944986 | 2015-05-29 14:49:08 -0700 | [diff] [blame] | 398 | mBouncer.showWithDismissAction(r, cancelAction); |
Jorim Jaggi | 746f7fa | 2014-08-27 17:52:46 +0200 | [diff] [blame] | 399 | } else { |
Jorim Jaggi | 746f7fa | 2014-08-27 17:52:46 +0200 | [diff] [blame] | 400 | mAfterKeyguardGoneAction = r; |
Selim Cinek | 56e6a32 | 2019-10-01 12:06:05 -0700 | [diff] [blame] | 401 | mKeyguardGoneCancelAction = cancelAction; |
Jorim Jaggi | 8d5a6e7 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 402 | mBouncer.show(false /* resetSecuritySelection */); |
Jorim Jaggi | 746f7fa | 2014-08-27 17:52:46 +0200 | [diff] [blame] | 403 | } |
Adrian Roos | 7d7090d | 2014-05-21 13:10:23 +0200 | [diff] [blame] | 404 | } |
| 405 | updateStates(); |
| 406 | } |
| 407 | |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 408 | private boolean isWakeAndUnlocking() { |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 409 | int mode = mBiometricUnlockController.getMode(); |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 410 | return mode == MODE_WAKE_AND_UNLOCK || mode == MODE_WAKE_AND_UNLOCK_PULSING; |
| 411 | } |
| 412 | |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 413 | /** |
Jorim Jaggi | bcbe948 | 2016-11-23 17:37:49 +0100 | [diff] [blame] | 414 | * 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 Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 421 | * Reset the state of the view. |
| 422 | */ |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 423 | public void reset(boolean hideBouncerWhenShowing) { |
Jorim Jaggi | 43bdbbd | 2014-05-09 16:05:53 +0200 | [diff] [blame] | 424 | if (mShowing) { |
Adrian Roos | 7a56d1a | 2017-08-04 15:04:43 +0200 | [diff] [blame] | 425 | if (mOccluded && !mDozing) { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 426 | mStatusBar.hideKeyguard(); |
Adrian Roos | 91ffdc4 | 2017-08-04 18:14:41 +0200 | [diff] [blame] | 427 | if (hideBouncerWhenShowing || mBouncer.needsFullscreenBouncer()) { |
| 428 | hideBouncer(false /* destroyView */); |
| 429 | } |
Jorim Jaggi | 43bdbbd | 2014-05-09 16:05:53 +0200 | [diff] [blame] | 430 | } else { |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 431 | showBouncerOrKeyguard(hideBouncerWhenShowing); |
Jorim Jaggi | 43bdbbd | 2014-05-09 16:05:53 +0200 | [diff] [blame] | 432 | } |
Heemin Seog | acea497 | 2019-11-06 10:27:20 -0800 | [diff] [blame] | 433 | mKeyguardUpdateManager.sendKeyguardReset(); |
Jorim Jaggi | 43bdbbd | 2014-05-09 16:05:53 +0200 | [diff] [blame] | 434 | updateStates(); |
Dan Sandler | 3806c77 | 2014-05-08 14:52:10 -0400 | [diff] [blame] | 435 | } |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 436 | } |
| 437 | |
Lucas Dupin | 16cfe45 | 2018-02-08 13:14:50 -0800 | [diff] [blame] | 438 | public boolean isGoingToSleepVisibleNotOccluded() { |
| 439 | return mGoingToSleepVisibleNotOccluded; |
| 440 | } |
| 441 | |
Jorim Jaggi | 18f18ae | 2015-09-10 15:48:21 -0700 | [diff] [blame] | 442 | public void onStartedGoingToSleep() { |
Lucas Dupin | 16cfe45 | 2018-02-08 13:14:50 -0800 | [diff] [blame] | 443 | mGoingToSleepVisibleNotOccluded = isShowing() && !isOccluded(); |
Jorim Jaggi | 18f18ae | 2015-09-10 15:48:21 -0700 | [diff] [blame] | 444 | } |
| 445 | |
Jorim Jaggi | 0d210f6 | 2015-07-10 14:24:44 -0700 | [diff] [blame] | 446 | public void onFinishedGoingToSleep() { |
Lucas Dupin | 16cfe45 | 2018-02-08 13:14:50 -0800 | [diff] [blame] | 447 | mGoingToSleepVisibleNotOccluded = false; |
Jorim Jaggi | 03c701e | 2014-04-02 12:39:51 +0200 | [diff] [blame] | 448 | mBouncer.onScreenTurnedOff(); |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 449 | } |
| 450 | |
Jorim Jaggi | 0d210f6 | 2015-07-10 14:24:44 -0700 | [diff] [blame] | 451 | public void onStartedWakingUp() { |
Adrian Roos | 731d4df | 2017-07-18 15:10:39 +0200 | [diff] [blame] | 452 | // TODO: remove |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 453 | } |
| 454 | |
Jorim Jaggi | 9373911 | 2015-08-13 15:53:14 -0700 | [diff] [blame] | 455 | public void onScreenTurningOn() { |
Adrian Roos | 731d4df | 2017-07-18 15:10:39 +0200 | [diff] [blame] | 456 | // TODO: remove |
Selim Cinek | 372d1bd | 2015-08-14 13:19:37 -0700 | [diff] [blame] | 457 | } |
| 458 | |
Jorim Jaggi | 0d210f6 | 2015-07-10 14:24:44 -0700 | [diff] [blame] | 459 | public void onScreenTurnedOn() { |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 460 | // TODO: remove |
Jorim Jaggi | 0d210f6 | 2015-07-10 14:24:44 -0700 | [diff] [blame] | 461 | } |
| 462 | |
Adrian Roos | d28ccd7 | 2016-01-06 15:23:14 +0100 | [diff] [blame] | 463 | @Override |
| 464 | public void onRemoteInputActive(boolean active) { |
| 465 | mRemoteInputActive = active; |
| 466 | updateStates(); |
| 467 | } |
| 468 | |
Evan Laird | 878c853 | 2018-10-15 15:54:29 -0400 | [diff] [blame] | 469 | private void setDozing(boolean dozing) { |
Adrian Roos | 41eecff | 2017-06-29 14:09:52 +0200 | [diff] [blame] | 470 | if (mDozing != dozing) { |
| 471 | mDozing = dozing; |
Adrian Roos | 61676aa | 2017-08-03 16:24:32 +0200 | [diff] [blame] | 472 | if (dozing || mBouncer.needsFullscreenBouncer() || mOccluded) { |
| 473 | reset(dozing /* hideBouncerWhenShowing */); |
| 474 | } |
Adrian Roos | 41eecff | 2017-06-29 14:09:52 +0200 | [diff] [blame] | 475 | updateStates(); |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 476 | |
| 477 | if (!dozing) { |
Adrian Roos | 34e6540 | 2017-08-07 19:32:45 +0200 | [diff] [blame] | 478 | launchPendingWakeupAction(); |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 479 | } |
Adrian Roos | 41eecff | 2017-06-29 14:09:52 +0200 | [diff] [blame] | 480 | } |
Adrian Roos | 087826a | 2017-04-19 16:59:09 -0700 | [diff] [blame] | 481 | } |
| 482 | |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 483 | /** |
| 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 Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 493 | public void setNeedsInput(boolean needsInput) { |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 494 | mStatusBarWindowController.setKeyguardNeedsInput(needsInput); |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 495 | } |
| 496 | |
Adrian Roos | d5c2db6 | 2016-03-08 16:11:31 -0800 | [diff] [blame] | 497 | public boolean isUnlockWithWallpaper() { |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 498 | return mStatusBarWindowController.isShowingWallpaper(); |
Adrian Roos | d5c2db6 | 2016-03-08 16:11:31 -0800 | [diff] [blame] | 499 | } |
| 500 | |
Jorim Jaggi | 6626f54 | 2016-08-22 13:08:44 -0700 | [diff] [blame] | 501 | public void setOccluded(boolean occluded, boolean animate) { |
Selim Cinek | 3a49ba2 | 2017-08-10 11:17:39 -0700 | [diff] [blame] | 502 | mStatusBar.setOccluded(occluded); |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 503 | if (occluded && !mOccluded && mShowing) { |
Tej Singh | dd7bd35 | 2018-02-09 19:33:15 -0800 | [diff] [blame] | 504 | StatsLog.write(StatsLog.KEYGUARD_STATE_CHANGED, |
| 505 | StatsLog.KEYGUARD_STATE_CHANGED__STATE__OCCLUDED); |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 506 | if (mStatusBar.isInLaunchTransition()) { |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 507 | mOccluded = true; |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 508 | mStatusBar.fadeKeyguardAfterLaunchTransition(null /* beforeFading */, |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 509 | new Runnable() { |
| 510 | @Override |
| 511 | public void run() { |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 512 | mStatusBarWindowController.setKeyguardOccluded(mOccluded); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 513 | reset(true /* hideBouncerWhenShowing */); |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 514 | } |
| 515 | }); |
| 516 | return; |
| 517 | } |
Tej Singh | dd7bd35 | 2018-02-09 19:33:15 -0800 | [diff] [blame] | 518 | } else if (!occluded && mOccluded && mShowing) { |
| 519 | StatsLog.write(StatsLog.KEYGUARD_STATE_CHANGED, |
| 520 | StatsLog.KEYGUARD_STATE_CHANGED__STATE__SHOWN); |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 521 | } |
Lucas Dupin | 28f9029 | 2017-08-08 18:07:49 -0400 | [diff] [blame] | 522 | boolean isOccluding = !mOccluded && occluded; |
Jorim Jaggi | a631029 | 2014-04-16 14:11:52 +0200 | [diff] [blame] | 523 | mOccluded = occluded; |
Adrian Roos | 909fe2d | 2016-10-12 12:03:24 -0700 | [diff] [blame] | 524 | if (mShowing) { |
Jason Monk | 297c04e | 2018-08-23 17:16:59 -0400 | [diff] [blame] | 525 | mMediaManager.updateMediaMetaData(false, animate && !occluded); |
Adrian Roos | 909fe2d | 2016-10-12 12:03:24 -0700 | [diff] [blame] | 526 | } |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 527 | mStatusBarWindowController.setKeyguardOccluded(occluded); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 528 | |
Adrian Roos | 7a56d1a | 2017-08-04 15:04:43 +0200 | [diff] [blame] | 529 | // 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 Dupin | 28f9029 | 2017-08-08 18:07:49 -0400 | [diff] [blame] | 533 | reset(isOccluding /* hideBouncerWhenShowing*/); |
Adrian Roos | 7a56d1a | 2017-08-04 15:04:43 +0200 | [diff] [blame] | 534 | } |
Lucas Dupin | e9e7071 | 2019-05-01 14:41:49 -0700 | [diff] [blame] | 535 | if (animate && !occluded && mShowing && !mBouncer.isShowing()) { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 536 | mStatusBar.animateKeyguardUnoccluding(); |
Jorim Jaggi | 6626f54 | 2016-08-22 13:08:44 -0700 | [diff] [blame] | 537 | } |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 538 | } |
| 539 | |
Dan Sandler | 4b22bdf | 2014-06-05 00:58:02 -0400 | [diff] [blame] | 540 | public boolean isOccluded() { |
| 541 | return mOccluded; |
| 542 | } |
| 543 | |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 544 | /** |
Jorim Jaggi | 76a1623 | 2014-08-08 17:00:47 +0200 | [diff] [blame] | 545 | * Starts the animation before we dismiss Keyguard, i.e. an disappearing animation on the |
| 546 | * security view of the bouncer. |
| 547 | * |
Jorim Jaggi | 8de4311c | 2014-08-11 22:36:20 +0200 | [diff] [blame] | 548 | * @param finishRunnable the runnable to be run after the animation finished, or {@code null} if |
| 549 | * no action should be run |
Jorim Jaggi | 76a1623 | 2014-08-08 17:00:47 +0200 | [diff] [blame] | 550 | */ |
| 551 | public void startPreHideAnimation(Runnable finishRunnable) { |
| 552 | if (mBouncer.isShowing()) { |
| 553 | mBouncer.startPreHideAnimation(finishRunnable); |
Lucas Dupin | fbe69ea | 2019-09-10 15:19:15 -0700 | [diff] [blame] | 554 | mStatusBar.onBouncerPreHideAnimation(); |
Jorim Jaggi | 8de4311c | 2014-08-11 22:36:20 +0200 | [diff] [blame] | 555 | } else if (finishRunnable != null) { |
Jorim Jaggi | 76a1623 | 2014-08-08 17:00:47 +0200 | [diff] [blame] | 556 | finishRunnable.run(); |
| 557 | } |
Dave Mankoff | 59b9496 | 2019-12-16 16:42:15 -0500 | [diff] [blame] | 558 | mNotificationPanelViewController.blockExpansionForCurrentTouch(); |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 559 | updateLockIcon(); |
Jorim Jaggi | 76a1623 | 2014-08-08 17:00:47 +0200 | [diff] [blame] | 560 | } |
| 561 | |
| 562 | /** |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 563 | * Hides the keyguard view |
| 564 | */ |
Jorim Jaggi | e8fde5d | 2016-06-30 23:41:37 -0700 | [diff] [blame] | 565 | public void hide(long startTime, long fadeoutDuration) { |
Jorim Jaggi | 03c701e | 2014-04-02 12:39:51 +0200 | [diff] [blame] | 566 | mShowing = false; |
Lucas Dupin | c8f16e8 | 2019-09-17 18:24:50 -0400 | [diff] [blame] | 567 | mKeyguardStateController.notifyKeyguardState(mShowing, |
Lucas Dupin | d236ee3 | 2019-10-08 15:33:59 -0700 | [diff] [blame] | 568 | mKeyguardStateController.isOccluded()); |
Adrian Roos | 34e6540 | 2017-08-07 19:32:45 +0200 | [diff] [blame] | 569 | launchPendingWakeupAction(); |
Jorim Jaggi | 44cf919 | 2014-06-17 19:16:00 -0700 | [diff] [blame] | 570 | |
Heemin Seog | acea497 | 2019-11-06 10:27:20 -0800 | [diff] [blame] | 571 | if (mKeyguardUpdateManager.needsSlowUnlockTransition()) { |
Jorim Jaggi | e8fde5d | 2016-06-30 23:41:37 -0700 | [diff] [blame] | 572 | fadeoutDuration = KEYGUARD_DISMISS_DURATION_LOCKED; |
| 573 | } |
Jorim Jaggi | e29b2db | 2014-05-30 23:17:03 +0200 | [diff] [blame] | 574 | long uptimeMillis = SystemClock.uptimeMillis(); |
Jorim Jaggi | 76a1623 | 2014-08-08 17:00:47 +0200 | [diff] [blame] | 575 | long delay = Math.max(0, startTime + HIDE_TIMING_CORRECTION_MS - uptimeMillis); |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 576 | |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 577 | if (mStatusBar.isInLaunchTransition() ) { |
| 578 | mStatusBar.fadeKeyguardAfterLaunchTransition(new Runnable() { |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 579 | @Override |
| 580 | public void run() { |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 581 | mStatusBarWindowController.setKeyguardShowing(false); |
| 582 | mStatusBarWindowController.setKeyguardFadingAway(true); |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 583 | hideBouncer(true /* destroyView */); |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 584 | updateStates(); |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 585 | } |
| 586 | }, new Runnable() { |
| 587 | @Override |
| 588 | public void run() { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 589 | mStatusBar.hideKeyguard(); |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 590 | mStatusBarWindowController.setKeyguardFadingAway(false); |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 591 | mViewMediatorCallback.keyguardGone(); |
Jorim Jaggi | 746f7fa | 2014-08-27 17:52:46 +0200 | [diff] [blame] | 592 | executeAfterKeyguardGoneAction(); |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 593 | } |
| 594 | }); |
| 595 | } else { |
Jorim Jaggi | 8d5a6e7 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 596 | executeAfterKeyguardGoneAction(); |
Jorim Jaggi | e93698b | 2016-11-11 18:24:38 -0800 | [diff] [blame] | 597 | boolean wakeUnlockPulsing = |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 598 | mBiometricUnlockController.getMode() == MODE_WAKE_AND_UNLOCK_PULSING; |
Selim Cinek | c075f15 | 2019-07-24 15:32:17 -0700 | [diff] [blame] | 599 | boolean needsFading = needsBypassFading(); |
| 600 | if (needsFading) { |
| 601 | delay = 0; |
| 602 | fadeoutDuration = KeyguardBypassController.BYPASS_PANEL_FADE_DURATION; |
| 603 | } else if (wakeUnlockPulsing) { |
Jorim Jaggi | e93698b | 2016-11-11 18:24:38 -0800 | [diff] [blame] | 604 | delay = 0; |
| 605 | fadeoutDuration = 240; |
| 606 | } |
Selim Cinek | c075f15 | 2019-07-24 15:32:17 -0700 | [diff] [blame] | 607 | mStatusBar.setKeyguardFadingAway(startTime, delay, fadeoutDuration, needsFading); |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 608 | mBiometricUnlockController.startKeyguardFadingAway(); |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 609 | hideBouncer(true /* destroyView */); |
Jorim Jaggi | e93698b | 2016-11-11 18:24:38 -0800 | [diff] [blame] | 610 | if (wakeUnlockPulsing) { |
Selim Cinek | c075f15 | 2019-07-24 15:32:17 -0700 | [diff] [blame] | 611 | if (needsFading) { |
Dave Mankoff | 59b9496 | 2019-12-16 16:42:15 -0500 | [diff] [blame] | 612 | ViewGroupFadeHelper.fadeOutAllChildrenExcept( |
| 613 | mNotificationPanelViewController.getView(), |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 614 | mNotificationContainer, |
Selim Cinek | c075f15 | 2019-07-24 15:32:17 -0700 | [diff] [blame] | 615 | fadeoutDuration, |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 616 | () -> { |
| 617 | mStatusBar.hideKeyguard(); |
| 618 | onKeyguardFadedAway(); |
| 619 | }); |
| 620 | } else { |
| 621 | mStatusBar.fadeKeyguardWhilePulsing(); |
| 622 | } |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 623 | wakeAndUnlockDejank(); |
Jorim Jaggi | dbc3dce | 2014-08-01 01:16:36 +0200 | [diff] [blame] | 624 | } else { |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 625 | boolean staying = mStatusBarStateController.leaveOpenOnKeyguardHide(); |
Jorim Jaggi | 83eb6bb | 2015-08-17 17:38:58 -0700 | [diff] [blame] | 626 | if (!staying) { |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 627 | mStatusBarWindowController.setKeyguardFadingAway(true); |
Selim Cinek | c075f15 | 2019-07-24 15:32:17 -0700 | [diff] [blame] | 628 | if (needsFading) { |
Dave Mankoff | 59b9496 | 2019-12-16 16:42:15 -0500 | [diff] [blame] | 629 | ViewGroupFadeHelper.fadeOutAllChildrenExcept( |
| 630 | mNotificationPanelViewController.getView(), |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 631 | mNotificationContainer, |
Selim Cinek | c075f15 | 2019-07-24 15:32:17 -0700 | [diff] [blame] | 632 | fadeoutDuration, |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 633 | () -> { |
| 634 | mStatusBar.hideKeyguard(); |
| 635 | }); |
| 636 | } else { |
| 637 | mStatusBar.hideKeyguard(); |
| 638 | } |
Lucas Dupin | f0a67e3 | 2018-09-19 15:23:54 -0700 | [diff] [blame] | 639 | // 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 Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 644 | wakeAndUnlockDejank(); |
Jorim Jaggi | 83eb6bb | 2015-08-17 17:38:58 -0700 | [diff] [blame] | 645 | } else { |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 646 | mStatusBar.hideKeyguard(); |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 647 | mStatusBar.finishKeyguardFadingAway(); |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 648 | mBiometricUnlockController.finishKeyguardFadingAway(); |
Jorim Jaggi | 83eb6bb | 2015-08-17 17:38:58 -0700 | [diff] [blame] | 649 | } |
Jorim Jaggi | dbc3dce | 2014-08-01 01:16:36 +0200 | [diff] [blame] | 650 | } |
Selim Cinek | 84b2acc | 2019-07-07 00:40:38 -0700 | [diff] [blame] | 651 | updateLockIcon(); |
Jorim Jaggi | 67b29d5 | 2017-06-09 18:00:00 -0700 | [diff] [blame] | 652 | updateStates(); |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 653 | mStatusBarWindowController.setKeyguardShowing(false); |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 654 | mViewMediatorCallback.keyguardGone(); |
Jorim Jaggi | e29b2db | 2014-05-30 23:17:03 +0200 | [diff] [blame] | 655 | } |
Tej Singh | dd7bd35 | 2018-02-09 19:33:15 -0800 | [diff] [blame] | 656 | StatsLog.write(StatsLog.KEYGUARD_STATE_CHANGED, |
| 657 | StatsLog.KEYGUARD_STATE_CHANGED__STATE__HIDDEN); |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 658 | } |
| 659 | |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 660 | 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 Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 667 | @Override |
Selim Cinek | aa8bbf1 | 2016-05-04 14:13:20 -0700 | [diff] [blame] | 668 | public void onDensityOrFontScaleChanged() { |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 669 | hideBouncer(true /* destroyView */); |
Selim Cinek | aa8bbf1 | 2016-05-04 14:13:20 -0700 | [diff] [blame] | 670 | } |
| 671 | |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 672 | @Override |
Winson Chung | 1aa24b9 | 2019-04-24 15:17:33 -0700 | [diff] [blame] | 673 | public void onNavigationModeChanged(int mode) { |
| 674 | boolean gesturalNav = QuickStepContract.isGesturalMode(mode); |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 675 | if (gesturalNav != mGesturalNav) { |
| 676 | mGesturalNav = gesturalNav; |
| 677 | updateStates(); |
| 678 | } |
| 679 | } |
| 680 | |
Lucas Dupin | 8c51ce2 | 2017-11-21 13:21:05 -0800 | [diff] [blame] | 681 | public void onThemeChanged() { |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 682 | hideBouncer(true /* destroyView */); |
Lucas Dupin | f190a85 | 2017-07-31 17:11:26 -0700 | [diff] [blame] | 683 | mBouncer.prepare(); |
Lucas Dupin | 89516d4 | 2017-07-05 13:29:18 -0700 | [diff] [blame] | 684 | } |
| 685 | |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 686 | public void onKeyguardFadedAway() { |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 687 | mContainer.postDelayed(() -> mStatusBarWindowController.setKeyguardFadingAway(false), |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 688 | 100); |
Dave Mankoff | 59b9496 | 2019-12-16 16:42:15 -0500 | [diff] [blame] | 689 | ViewGroupFadeHelper.reset(mNotificationPanelViewController.getView()); |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 690 | mStatusBar.finishKeyguardFadingAway(); |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 691 | mBiometricUnlockController.finishKeyguardFadingAway(); |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 692 | WindowManagerGlobal.getInstance().trimMemory( |
| 693 | ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN); |
| 694 | |
Jorim Jaggi | 9097885 | 2015-08-18 19:55:53 -0700 | [diff] [blame] | 695 | } |
| 696 | |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 697 | private void wakeAndUnlockDejank() { |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 698 | if (mBiometricUnlockController.getMode() == MODE_WAKE_AND_UNLOCK |
Jorim Jaggi | 8adb30c | 2016-09-13 15:02:22 -0700 | [diff] [blame] | 699 | && LatencyTracker.isEnabled(mContext)) { |
| 700 | DejankUtils.postAfterTraversal(() -> |
| 701 | LatencyTracker.getInstance(mContext).onActionEnd( |
| 702 | LatencyTracker.ACTION_FINGERPRINT_WAKE_AND_UNLOCK)); |
| 703 | } |
Jorim Jaggi | 0d210f6 | 2015-07-10 14:24:44 -0700 | [diff] [blame] | 704 | } |
| 705 | |
Jorim Jaggi | 746f7fa | 2014-08-27 17:52:46 +0200 | [diff] [blame] | 706 | private void executeAfterKeyguardGoneAction() { |
| 707 | if (mAfterKeyguardGoneAction != null) { |
| 708 | mAfterKeyguardGoneAction.onDismiss(); |
| 709 | mAfterKeyguardGoneAction = null; |
| 710 | } |
Selim Cinek | 56e6a32 | 2019-10-01 12:06:05 -0700 | [diff] [blame] | 711 | mKeyguardGoneCancelAction = null; |
Jorim Jaggi | bcbe948 | 2016-11-23 17:37:49 +0100 | [diff] [blame] | 712 | for (int i = 0; i < mAfterKeyguardGoneRunnables.size(); i++) { |
| 713 | mAfterKeyguardGoneRunnables.get(i).run(); |
| 714 | } |
| 715 | mAfterKeyguardGoneRunnables.clear(); |
Jorim Jaggi | 746f7fa | 2014-08-27 17:52:46 +0200 | [diff] [blame] | 716 | } |
| 717 | |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 718 | /** |
| 719 | * Dismisses the keyguard by going to the next screen or making it gone. |
| 720 | */ |
Jorim Jaggi | 8d5a6e7 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 721 | public void dismissAndCollapse() { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 722 | mStatusBar.executeRunnableDismissingKeyguard(null, null, true, false, true); |
Jorim Jaggi | 8d5a6e7 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 723 | } |
| 724 | |
Christoph Studer | 2231c6e | 2014-12-19 12:40:13 +0100 | [diff] [blame] | 725 | /** |
| 726 | * WARNING: This method might cause Binder calls. |
| 727 | */ |
Jorim Jaggi | 1568250 | 2014-04-23 12:01:36 +0200 | [diff] [blame] | 728 | public boolean isSecure() { |
| 729 | return mBouncer.isSecure(); |
| 730 | } |
| 731 | |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 732 | /** |
| 733 | * @return Whether the keyguard is showing |
| 734 | */ |
| 735 | public boolean isShowing() { |
Jorim Jaggi | 03c701e | 2014-04-02 12:39:51 +0200 | [diff] [blame] | 736 | return mShowing; |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 737 | } |
Jorim Jaggi | e5c7a89 | 2014-04-10 20:37:32 +0200 | [diff] [blame] | 738 | |
| 739 | /** |
| 740 | * Notifies this manager that the back button has been pressed. |
| 741 | * |
Lucas Dupin | 3f54fe2 | 2018-04-08 23:17:40 -0700 | [diff] [blame] | 742 | * @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 Jaggi | e5c7a89 | 2014-04-10 20:37:32 +0200 | [diff] [blame] | 745 | * @return whether the back press has been handled |
| 746 | */ |
Lucas Dupin | 3f54fe2 | 2018-04-08 23:17:40 -0700 | [diff] [blame] | 747 | public boolean onBackPressed(boolean hideImmediately) { |
Jorim Jaggi | e5c7a89 | 2014-04-10 20:37:32 +0200 | [diff] [blame] | 748 | if (mBouncer.isShowing()) { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 749 | mStatusBar.endAffordanceLaunch(); |
Fabian Kozynski | baa47b6 | 2019-04-26 15:40:43 -0400 | [diff] [blame] | 750 | // 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 Jaggi | e5c7a89 | 2014-04-10 20:37:32 +0200 | [diff] [blame] | 757 | return true; |
| 758 | } |
| 759 | return false; |
| 760 | } |
| 761 | |
Jim Miller | f41fc96 | 2014-06-18 16:33:51 -0700 | [diff] [blame] | 762 | public boolean isBouncerShowing() { |
| 763 | return mBouncer.isShowing(); |
| 764 | } |
| 765 | |
Lucas Dupin | fa817a0 | 2019-07-02 15:22:54 -0700 | [diff] [blame] | 766 | /** |
| 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 Dupin | b7d3274 | 2019-07-12 17:46:11 +0900 | [diff] [blame] | 771 | return mBouncer.isShowing() || mBouncer.inTransit(); |
Lucas Dupin | fa817a0 | 2019-07-02 15:22:54 -0700 | [diff] [blame] | 772 | } |
| 773 | |
Jackal Guo | 42cae96 | 2018-04-18 18:41:19 +0800 | [diff] [blame] | 774 | public boolean isFullscreenBouncer() { |
| 775 | return mBouncer.isFullscreenBouncer(); |
| 776 | } |
| 777 | |
Jorim Jaggi | 416493b | 2014-09-13 03:57:32 +0200 | [diff] [blame] | 778 | private long getNavBarShowDelay() { |
Lucas Dupin | c8f16e8 | 2019-09-17 18:24:50 -0400 | [diff] [blame] | 779 | if (mKeyguardStateController.isKeyguardFadingAway()) { |
| 780 | return mKeyguardStateController.getKeyguardFadingAwayDelay(); |
Adrian Roos | 087826a | 2017-04-19 16:59:09 -0700 | [diff] [blame] | 781 | } else if (mBouncer.isShowing()) { |
Jorim Jaggi | 416493b | 2014-09-13 03:57:32 +0200 | [diff] [blame] | 782 | return NAV_BAR_SHOW_DELAY_BOUNCER; |
Adrian Roos | 087826a | 2017-04-19 16:59:09 -0700 | [diff] [blame] | 783 | } else { |
| 784 | // No longer dozing, or remote input is active. No delay. |
| 785 | return 0; |
Jorim Jaggi | 416493b | 2014-09-13 03:57:32 +0200 | [diff] [blame] | 786 | } |
| 787 | } |
| 788 | |
| 789 | private Runnable mMakeNavigationBarVisibleRunnable = new Runnable() { |
| 790 | @Override |
| 791 | public void run() { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 792 | mStatusBar.getNavigationBarView().getRootView().setVisibility(View.VISIBLE); |
Jorim Jaggi | 416493b | 2014-09-13 03:57:32 +0200 | [diff] [blame] | 793 | } |
| 794 | }; |
| 795 | |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 796 | protected void updateStates() { |
Jorim Jaggi | e5c7a89 | 2014-04-10 20:37:32 +0200 | [diff] [blame] | 797 | int vis = mContainer.getSystemUiVisibility(); |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 798 | boolean showing = mShowing; |
| 799 | boolean occluded = mOccluded; |
| 800 | boolean bouncerShowing = mBouncer.isShowing(); |
Jorim Jaggi | 95e89ca | 2014-11-24 20:12:50 +0100 | [diff] [blame] | 801 | boolean bouncerDismissible = !mBouncer.isFullscreenBouncer(); |
Adrian Roos | d28ccd7 | 2016-01-06 15:23:14 +0100 | [diff] [blame] | 802 | boolean remoteInputActive = mRemoteInputActive; |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 803 | |
Adrian Roos | d28ccd7 | 2016-01-06 15:23:14 +0100 | [diff] [blame] | 804 | if ((bouncerDismissible || !showing || remoteInputActive) != |
| 805 | (mLastBouncerDismissible || !mLastShowing || mLastRemoteInputActive) |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 806 | || mFirstUpdate) { |
Adrian Roos | d28ccd7 | 2016-01-06 15:23:14 +0100 | [diff] [blame] | 807 | if (bouncerDismissible || !showing || remoteInputActive) { |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 808 | mContainer.setSystemUiVisibility(vis & ~View.STATUS_BAR_DISABLE_BACK); |
Jason Monk | 1e68fb3 | 2014-05-02 16:06:20 -0400 | [diff] [blame] | 809 | } else { |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 810 | mContainer.setSystemUiVisibility(vis | View.STATUS_BAR_DISABLE_BACK); |
Jason Monk | 1e68fb3 | 2014-05-02 16:06:20 -0400 | [diff] [blame] | 811 | } |
Jorim Jaggi | a631029 | 2014-04-16 14:11:52 +0200 | [diff] [blame] | 812 | } |
Jorim Jaggi | 0d210f6 | 2015-07-10 14:24:44 -0700 | [diff] [blame] | 813 | |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 814 | boolean navBarVisible = isNavBarVisible(); |
| 815 | boolean lastNavBarVisible = getLastNavBarVisible(); |
Jorim Jaggi | 0d210f6 | 2015-07-10 14:24:44 -0700 | [diff] [blame] | 816 | if (navBarVisible != lastNavBarVisible || mFirstUpdate) { |
Brad Stenning | 7e41181 | 2018-04-13 22:52:39 -0700 | [diff] [blame] | 817 | updateNavigationBarVisibility(navBarVisible); |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 818 | } |
| 819 | |
| 820 | if (bouncerShowing != mLastBouncerShowing || mFirstUpdate) { |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 821 | mStatusBarWindowController.setBouncerShowing(bouncerShowing); |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 822 | mStatusBar.setBouncerShowing(bouncerShowing); |
Lucas Dupin | bea18f7 | 2019-07-03 14:29:37 -0700 | [diff] [blame] | 823 | updateLockIcon(); |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 824 | } |
| 825 | |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 826 | if ((showing && !occluded) != (mLastShowing && !mLastOccluded) || mFirstUpdate) { |
Heemin Seog | acea497 | 2019-11-06 10:27:20 -0800 | [diff] [blame] | 827 | mKeyguardUpdateManager.onKeyguardVisibilityChanged(showing && !occluded); |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 828 | } |
| 829 | if (bouncerShowing != mLastBouncerShowing || mFirstUpdate) { |
Heemin Seog | acea497 | 2019-11-06 10:27:20 -0800 | [diff] [blame] | 830 | mKeyguardUpdateManager.sendKeyguardBouncerChanged(bouncerShowing); |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 831 | } |
| 832 | |
| 833 | mFirstUpdate = false; |
| 834 | mLastShowing = showing; |
| 835 | mLastOccluded = occluded; |
| 836 | mLastBouncerShowing = bouncerShowing; |
| 837 | mLastBouncerDismissible = bouncerDismissible; |
Adrian Roos | d28ccd7 | 2016-01-06 15:23:14 +0100 | [diff] [blame] | 838 | mLastRemoteInputActive = remoteInputActive; |
Adrian Roos | 087826a | 2017-04-19 16:59:09 -0700 | [diff] [blame] | 839 | mLastDozing = mDozing; |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 840 | mLastPulsing = mPulsing; |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 841 | mLastBiometricMode = mBiometricUnlockController.getMode(); |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 842 | mLastGesturalNav = mGesturalNav; |
| 843 | mLastIsDocked = mIsDocked; |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 844 | mStatusBar.onKeyguardViewManagerStatesUpdated(); |
Jorim Jaggi | e5c7a89 | 2014-04-10 20:37:32 +0200 | [diff] [blame] | 845 | } |
Jorim Jaggi | 8c8bcc1 | 2014-04-16 21:36:51 +0200 | [diff] [blame] | 846 | |
Brad Stenning | 7e41181 | 2018-04-13 22:52:39 -0700 | [diff] [blame] | 847 | 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 Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 864 | /** |
| 865 | * @return Whether the navigation bar should be made visible based on the current state. |
| 866 | */ |
| 867 | protected boolean isNavBarVisible() { |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 868 | int biometricMode = mBiometricUnlockController.getMode(); |
Jorim Jaggi | f5304ad | 2017-07-17 18:31:13 +0200 | [diff] [blame] | 869 | boolean keyguardShowing = mShowing && !mOccluded; |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 870 | boolean hideWhileDozing = mDozing && biometricMode != MODE_WAKE_AND_UNLOCK_PULSING; |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 871 | boolean keyguardWithGestureNav = (keyguardShowing && !mDozing || mPulsing && !mIsDocked) |
| 872 | && mGesturalNav; |
Jorim Jaggi | f5304ad | 2017-07-17 18:31:13 +0200 | [diff] [blame] | 873 | return (!keyguardShowing && !hideWhileDozing || mBouncer.isShowing() |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 874 | || mRemoteInputActive || keyguardWithGestureNav); |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 875 | } |
| 876 | |
| 877 | /** |
| 878 | * @return Whether the navigation bar was made visible based on the last known state. |
| 879 | */ |
| 880 | protected boolean getLastNavBarVisible() { |
Jorim Jaggi | f5304ad | 2017-07-17 18:31:13 +0200 | [diff] [blame] | 881 | boolean keyguardShowing = mLastShowing && !mLastOccluded; |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 882 | boolean hideWhileDozing = mLastDozing && mLastBiometricMode != MODE_WAKE_AND_UNLOCK_PULSING; |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 883 | boolean keyguardWithGestureNav = (keyguardShowing && !mLastDozing |
| 884 | || mLastPulsing && !mLastIsDocked) && mLastGesturalNav; |
Jorim Jaggi | f5304ad | 2017-07-17 18:31:13 +0200 | [diff] [blame] | 885 | return (!keyguardShowing && !hideWhileDozing || mLastBouncerShowing |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 886 | || mLastRemoteInputActive || keyguardWithGestureNav); |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 887 | } |
| 888 | |
Selim Cinek | 2854019 | 2016-02-19 17:25:08 -0800 | [diff] [blame] | 889 | public boolean shouldDismissOnMenuPressed() { |
| 890 | return mBouncer.shouldDismissOnMenuPressed(); |
Jorim Jaggi | 8c8bcc1 | 2014-04-16 21:36:51 +0200 | [diff] [blame] | 891 | } |
Jorim Jaggi | df99351 | 2014-05-13 23:06:35 +0200 | [diff] [blame] | 892 | |
| 893 | public boolean interceptMediaKey(KeyEvent event) { |
| 894 | return mBouncer.interceptMediaKey(event); |
| 895 | } |
Jorim Jaggi | 8de4311c | 2014-08-11 22:36:20 +0200 | [diff] [blame] | 896 | |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 897 | public void readyForKeyguardDone() { |
| 898 | mViewMediatorCallback.readyForKeyguardDone(); |
| 899 | } |
| 900 | |
Jorim Jaggi | 84a3e7a | 2014-08-13 17:58:58 +0200 | [diff] [blame] | 901 | public boolean shouldDisableWindowAnimationsForUnlock() { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 902 | return mStatusBar.isInLaunchTransition(); |
Jorim Jaggi | 84a3e7a | 2014-08-13 17:58:58 +0200 | [diff] [blame] | 903 | } |
| 904 | |
Issei Suzuki | 5609ccb | 2019-06-13 15:04:08 +0200 | [diff] [blame] | 905 | |
| 906 | /** |
| 907 | * @return Whether subtle animation should be used for unlocking the device. |
| 908 | */ |
| 909 | public boolean shouldSubtleWindowAnimationsForUnlock() { |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 910 | return needsBypassFading(); |
Issei Suzuki | 5609ccb | 2019-06-13 15:04:08 +0200 | [diff] [blame] | 911 | } |
| 912 | |
Jorim Jaggi | 84a3e7a | 2014-08-13 17:58:58 +0200 | [diff] [blame] | 913 | public boolean isGoingToNotificationShade() { |
Heemin Seog | acea497 | 2019-11-06 10:27:20 -0800 | [diff] [blame] | 914 | return mStatusBarStateController.leaveOpenOnKeyguardHide(); |
Jorim Jaggi | 84a3e7a | 2014-08-13 17:58:58 +0200 | [diff] [blame] | 915 | } |
Adrian Roos | 31b844b | 2014-11-21 13:55:09 +0100 | [diff] [blame] | 916 | |
| 917 | public boolean isSecure(int userId) { |
| 918 | return mBouncer.isSecure() || mLockPatternUtils.isSecure(userId); |
| 919 | } |
Jim Miller | ab95454 | 2014-10-10 18:21:49 -0700 | [diff] [blame] | 920 | |
Jorim Jaggi | 33ae80e | 2015-02-04 16:37:11 +0100 | [diff] [blame] | 921 | public void keyguardGoingAway() { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 922 | mStatusBar.keyguardGoingAway(); |
Jorim Jaggi | 33ae80e | 2015-02-04 16:37:11 +0100 | [diff] [blame] | 923 | } |
Jim Miller | 25d7e51 | 2015-03-03 17:12:09 -0800 | [diff] [blame] | 924 | |
Aarthi Balachander | 0a427ef | 2018-07-13 15:00:58 -0700 | [diff] [blame] | 925 | /** |
| 926 | * Called when cancel button in bouncer is pressed. |
| 927 | */ |
| 928 | public void onCancelClicked() { |
| 929 | // No-op |
| 930 | } |
| 931 | |
Jorim Jaggi | 5cc8659 | 2015-06-08 14:48:28 -0700 | [diff] [blame] | 932 | /** |
| 933 | * Notifies that the user has authenticated by other means than using the bouncer, for example, |
| 934 | * fingerprint. |
| 935 | */ |
Jorim Jaggi | 25b4d4b | 2015-08-11 15:54:06 -0700 | [diff] [blame] | 936 | public void notifyKeyguardAuthenticated(boolean strongAuth) { |
| 937 | mBouncer.notifyKeyguardAuthenticated(strongAuth); |
Jorim Jaggi | 5cc8659 | 2015-06-08 14:48:28 -0700 | [diff] [blame] | 938 | } |
Jorim Jaggi | 0d210f6 | 2015-07-10 14:24:44 -0700 | [diff] [blame] | 939 | |
Jason Chang | 1e4a4bd | 2018-05-22 17:30:19 +0800 | [diff] [blame] | 940 | public void showBouncerMessage(String message, ColorStateList colorState) { |
| 941 | mBouncer.showMessage(message, colorState); |
Selim Cinek | cfafe4e | 2015-08-11 14:58:44 -0700 | [diff] [blame] | 942 | } |
Jorim Jaggi | b774e55 | 2015-08-24 14:52:45 -0700 | [diff] [blame] | 943 | |
| 944 | public ViewRootImpl getViewRootImpl() { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 945 | return mStatusBar.getStatusBarView().getViewRootImpl(); |
Jorim Jaggi | b774e55 | 2015-08-24 14:52:45 -0700 | [diff] [blame] | 946 | } |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 947 | |
Adrian Roos | 34e6540 | 2017-08-07 19:32:45 +0200 | [diff] [blame] | 948 | public void launchPendingWakeupAction() { |
| 949 | DismissWithActionRequest request = mPendingWakeupAction; |
| 950 | mPendingWakeupAction = null; |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 951 | if (request != null) { |
| 952 | if (mShowing) { |
| 953 | dismissWithAction(request.dismissAction, request.cancelAction, |
Lucas Dupin | c80c67e | 2017-12-04 14:29:10 -0800 | [diff] [blame] | 954 | request.afterKeyguardGone, request.message); |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 955 | } else if (request.dismissAction != null) { |
| 956 | request.dismissAction.onDismiss(); |
| 957 | } |
| 958 | } |
| 959 | } |
| 960 | |
Adrian Roos | 34e6540 | 2017-08-07 19:32:45 +0200 | [diff] [blame] | 961 | public void cancelPendingWakeupAction() { |
| 962 | DismissWithActionRequest request = mPendingWakeupAction; |
| 963 | mPendingWakeupAction = null; |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 964 | if (request != null && request.cancelAction != null) { |
| 965 | request.cancelAction.run(); |
| 966 | } |
| 967 | } |
| 968 | |
Lucas Dupin | f9ca35e | 2018-05-16 20:41:35 -0700 | [diff] [blame] | 969 | public boolean bouncerNeedsScrimming() { |
Lucas Dupin | 300e371 | 2019-03-27 19:33:36 -0700 | [diff] [blame] | 970 | return mOccluded || mBouncer.willDismissWithAction() |
Lucas Dupin | 93f714d | 2019-03-26 16:49:24 -0700 | [diff] [blame] | 971 | || mStatusBar.isFullScreenUserSwitcherState() |
Lucas Dupin | 300e371 | 2019-03-27 19:33:36 -0700 | [diff] [blame] | 972 | || (mBouncer.isShowing() && mBouncer.isScrimmed()) |
| 973 | || mBouncer.isFullscreenBouncer(); |
Lucas Dupin | f9ca35e | 2018-05-16 20:41:35 -0700 | [diff] [blame] | 974 | } |
| 975 | |
Lucas Dupin | 15a6b6c | 2018-04-16 14:50:20 +0800 | [diff] [blame] | 976 | 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 Laird | 878c853 | 2018-10-15 15:54:29 -0400 | [diff] [blame] | 992 | @Override |
| 993 | public void onStateChanged(int newState) { |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 994 | updateLockIcon(); |
Evan Laird | 878c853 | 2018-10-15 15:54:29 -0400 | [diff] [blame] | 995 | } |
| 996 | |
| 997 | @Override |
| 998 | public void onDozingChanged(boolean isDozing) { |
| 999 | setDozing(isDozing); |
| 1000 | } |
| 1001 | |
Lucas Dupin | 407cc58 | 2019-03-11 21:04:31 -0700 | [diff] [blame] | 1002 | public KeyguardBouncer getBouncer() { |
| 1003 | return mBouncer; |
| 1004 | } |
| 1005 | |
Adrian Roos | 34e6540 | 2017-08-07 19:32:45 +0200 | [diff] [blame] | 1006 | private static class DismissWithActionRequest { |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 1007 | final OnDismissAction dismissAction; |
| 1008 | final Runnable cancelAction; |
| 1009 | final boolean afterKeyguardGone; |
Lucas Dupin | c80c67e | 2017-12-04 14:29:10 -0800 | [diff] [blame] | 1010 | final String message; |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 1011 | |
Adrian Roos | 34e6540 | 2017-08-07 19:32:45 +0200 | [diff] [blame] | 1012 | DismissWithActionRequest(OnDismissAction dismissAction, Runnable cancelAction, |
Lucas Dupin | c80c67e | 2017-12-04 14:29:10 -0800 | [diff] [blame] | 1013 | boolean afterKeyguardGone, String message) { |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 1014 | this.dismissAction = dismissAction; |
| 1015 | this.cancelAction = cancelAction; |
| 1016 | this.afterKeyguardGone = afterKeyguardGone; |
Lucas Dupin | c80c67e | 2017-12-04 14:29:10 -0800 | [diff] [blame] | 1017 | this.message = message; |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 1018 | } |
| 1019 | } |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 1020 | } |