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 | bc9aac1 | 2018-03-04 20:18:15 -0800 | [diff] [blame] | 36 | import com.android.internal.util.LatencyTracker; |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 37 | import com.android.internal.widget.LockPatternUtils; |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 38 | import com.android.keyguard.KeyguardUpdateMonitor; |
Jorim Jaggi | a9d7fcd | 2017-05-18 01:08:12 +0200 | [diff] [blame] | 39 | import com.android.keyguard.KeyguardUpdateMonitorCallback; |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 40 | import com.android.keyguard.ViewMediatorCallback; |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 41 | import com.android.settingslib.animation.AppearAnimationUtils; |
Jorim Jaggi | 8adb30c | 2016-09-13 15:02:22 -0700 | [diff] [blame] | 42 | import com.android.systemui.DejankUtils; |
Jason Monk | 421a941 | 2017-02-06 09:15:21 -0800 | [diff] [blame] | 43 | import com.android.systemui.Dependency; |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 44 | import com.android.systemui.SystemUIFactory; |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 45 | import com.android.systemui.dock.DockManager; |
Jorim Jaggi | 241ae10 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 46 | import com.android.systemui.keyguard.DismissCallbackRegistry; |
Beverly | 8fdb533 | 2019-02-04 14:29:49 -0500 | [diff] [blame] | 47 | import com.android.systemui.plugins.statusbar.StatusBarStateController; |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 48 | import com.android.systemui.shared.system.QuickStepContract; |
Jim Miller | 25d7e51 | 2015-03-03 17:12:09 -0800 | [diff] [blame] | 49 | import com.android.systemui.statusbar.CommandQueue; |
Lucas Dupin | 269feda | 2019-04-29 17:11:02 -0700 | [diff] [blame] | 50 | import com.android.systemui.statusbar.CrossFadeHelper; |
Jason Monk | 297c04e | 2018-08-23 17:16:59 -0400 | [diff] [blame] | 51 | import com.android.systemui.statusbar.NotificationMediaManager; |
Adrian Roos | d28ccd7 | 2016-01-06 15:23:14 +0100 | [diff] [blame] | 52 | import com.android.systemui.statusbar.RemoteInputController; |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 53 | import com.android.systemui.statusbar.StatusBarState; |
Beverly | 8fdb533 | 2019-02-04 14:29:49 -0500 | [diff] [blame] | 54 | import com.android.systemui.statusbar.SysuiStatusBarStateController; |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 55 | import com.android.systemui.statusbar.notification.ViewGroupFadeHelper; |
Lucas Dupin | 15a6b6c | 2018-04-16 14:50:20 +0800 | [diff] [blame] | 56 | import com.android.systemui.statusbar.phone.KeyguardBouncer.BouncerExpansionCallback; |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 57 | import com.android.systemui.statusbar.policy.ConfigurationController; |
Jason Monk | 1fd3fc3 | 2018-08-14 17:20:09 -0400 | [diff] [blame] | 58 | import com.android.systemui.statusbar.policy.KeyguardMonitor; |
Evan Laird | 2d620fa | 2018-10-30 13:03:31 -0400 | [diff] [blame] | 59 | import com.android.systemui.statusbar.policy.KeyguardMonitorImpl; |
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 | |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 64 | /** |
| 65 | * Manages creating, showing, hiding and resetting the keyguard within the status bar. Calls back |
| 66 | * via {@link ViewMediatorCallback} to poke the wake lock and report that the keyguard is done, |
| 67 | * which is in turn, reported to this class by the current |
| 68 | * {@link com.android.keyguard.KeyguardViewBase}. |
| 69 | */ |
Evan Laird | 878c853 | 2018-10-15 15:54:29 -0400 | [diff] [blame] | 70 | public class StatusBarKeyguardViewManager implements RemoteInputController.Callback, |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 71 | StatusBarStateController.StateListener, ConfigurationController.ConfigurationListener, |
Selim Cinek | a678b0e | 2019-07-23 13:12:55 -0700 | [diff] [blame] | 72 | PanelExpansionListener, NavigationModeController.ModeChangedListener { |
Jorim Jaggi | 76a1623 | 2014-08-08 17:00:47 +0200 | [diff] [blame] | 73 | |
| 74 | // 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] | 75 | private static final long HIDE_TIMING_CORRECTION_MS = - 16 * 3; |
Jorim Jaggi | 76a1623 | 2014-08-08 17:00:47 +0200 | [diff] [blame] | 76 | |
Jorim Jaggi | 416493b | 2014-09-13 03:57:32 +0200 | [diff] [blame] | 77 | // Delay for showing the navigation bar when the bouncer appears. This should be kept in sync |
| 78 | // with the appear animations of the PIN/pattern/password views. |
| 79 | private static final long NAV_BAR_SHOW_DELAY_BOUNCER = 320; |
| 80 | |
Jorim Jaggi | 007f0e8 | 2015-08-14 13:56:01 -0700 | [diff] [blame] | 81 | private static final long WAKE_AND_UNLOCK_SCRIM_FADEOUT_DURATION_MS = 200; |
| 82 | |
Jorim Jaggi | e8fde5d | 2016-06-30 23:41:37 -0700 | [diff] [blame] | 83 | // Duration of the Keyguard dismissal animation in case the user is currently locked. This is to |
| 84 | // make everything a bit slower to bridge a gap until the user is unlocked and home screen has |
| 85 | // dranw its first frame. |
| 86 | private static final long KEYGUARD_DISMISS_DURATION_LOCKED = 2000; |
| 87 | |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 88 | private static String TAG = "StatusBarKeyguardViewManager"; |
| 89 | |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 90 | protected final Context mContext; |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 91 | private final StatusBarWindowController mStatusBarWindowController; |
Lucas Dupin | 15a6b6c | 2018-04-16 14:50:20 +0800 | [diff] [blame] | 92 | private final BouncerExpansionCallback mExpansionCallback = new BouncerExpansionCallback() { |
| 93 | @Override |
| 94 | public void onFullyShown() { |
| 95 | updateStates(); |
Lucas Dupin | 3cfd688 | 2019-03-19 15:22:03 -0700 | [diff] [blame] | 96 | mStatusBar.wakeUpIfDozing(SystemClock.uptimeMillis(), mContainer, "BOUNCER_VISIBLE"); |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 97 | updateLockIcon(); |
Lucas Dupin | 15a6b6c | 2018-04-16 14:50:20 +0800 | [diff] [blame] | 98 | } |
| 99 | |
| 100 | @Override |
Lucas Dupin | 8499354 | 2018-10-11 19:23:45 -0700 | [diff] [blame] | 101 | public void onStartingToHide() { |
| 102 | updateStates(); |
| 103 | } |
| 104 | |
| 105 | @Override |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 106 | public void onStartingToShow() { |
| 107 | updateLockIcon(); |
Lucas Dupin | 15a6b6c | 2018-04-16 14:50:20 +0800 | [diff] [blame] | 108 | } |
Lucas Dupin | 27321c4 | 2019-03-20 16:22:24 -0700 | [diff] [blame] | 109 | |
| 110 | @Override |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 111 | public void onFullyHidden() { |
| 112 | updateStates(); |
| 113 | updateLockIcon(); |
Lucas Dupin | 27321c4 | 2019-03-20 16:22:24 -0700 | [diff] [blame] | 114 | } |
Lucas Dupin | 15a6b6c | 2018-04-16 14:50:20 +0800 | [diff] [blame] | 115 | }; |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 116 | private final DockManager.DockEventListener mDockEventListener = |
| 117 | new DockManager.DockEventListener() { |
| 118 | @Override |
| 119 | public void onEvent(int event) { |
| 120 | boolean isDocked = mDockManager.isDocked(); |
| 121 | if (isDocked == mIsDocked) { |
| 122 | return; |
| 123 | } |
| 124 | mIsDocked = isDocked; |
| 125 | updateStates(); |
| 126 | } |
| 127 | }; |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 128 | |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 129 | protected LockPatternUtils mLockPatternUtils; |
| 130 | protected ViewMediatorCallback mViewMediatorCallback; |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 131 | protected StatusBar mStatusBar; |
Lucas Dupin | bc9aac1 | 2018-03-04 20:18:15 -0800 | [diff] [blame] | 132 | private NotificationPanelView mNotificationPanelView; |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 133 | private BiometricUnlockController mBiometricUnlockController; |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 134 | |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 135 | private ViewGroup mContainer; |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 136 | private ViewGroup mLockIconContainer; |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 137 | private View mNotificationContainer; |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 138 | |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 139 | protected KeyguardBouncer mBouncer; |
| 140 | protected boolean mShowing; |
| 141 | protected boolean mOccluded; |
| 142 | protected boolean mRemoteInputActive; |
Adrian Roos | 087826a | 2017-04-19 16:59:09 -0700 | [diff] [blame] | 143 | private boolean mDozing; |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 144 | private boolean mPulsing; |
| 145 | private boolean mGesturalNav; |
| 146 | private boolean mIsDocked; |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 147 | |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 148 | protected boolean mFirstUpdate = true; |
| 149 | protected boolean mLastShowing; |
| 150 | protected boolean mLastOccluded; |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 151 | private boolean mLastBouncerShowing; |
| 152 | private boolean mLastBouncerDismissible; |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 153 | protected boolean mLastRemoteInputActive; |
Adrian Roos | 087826a | 2017-04-19 16:59:09 -0700 | [diff] [blame] | 154 | private boolean mLastDozing; |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 155 | private boolean mLastGesturalNav; |
| 156 | private boolean mLastIsDocked; |
| 157 | private boolean mLastPulsing; |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 158 | private int mLastBiometricMode; |
Lucas Dupin | 16cfe45 | 2018-02-08 13:14:50 -0800 | [diff] [blame] | 159 | private boolean mGoingToSleepVisibleNotOccluded; |
Lucas Dupin | 269feda | 2019-04-29 17:11:02 -0700 | [diff] [blame] | 160 | private boolean mLastLockVisible; |
Adrian Roos | d28ccd7 | 2016-01-06 15:23:14 +0100 | [diff] [blame] | 161 | |
Jorim Jaggi | 746f7fa | 2014-08-27 17:52:46 +0200 | [diff] [blame] | 162 | private OnDismissAction mAfterKeyguardGoneAction; |
Jorim Jaggi | bcbe948 | 2016-11-23 17:37:49 +0100 | [diff] [blame] | 163 | private final ArrayList<Runnable> mAfterKeyguardGoneRunnables = new ArrayList<>(); |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 164 | |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 165 | // 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] | 166 | private DismissWithActionRequest mPendingWakeupAction; |
Evan Laird | 2d620fa | 2018-10-30 13:03:31 -0400 | [diff] [blame] | 167 | private final KeyguardMonitorImpl mKeyguardMonitor = |
| 168 | (KeyguardMonitorImpl) Dependency.get(KeyguardMonitor.class); |
Jason Monk | 297c04e | 2018-08-23 17:16:59 -0400 | [diff] [blame] | 169 | private final NotificationMediaManager mMediaManager = |
| 170 | Dependency.get(NotificationMediaManager.class); |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 171 | private final SysuiStatusBarStateController mStatusBarStateController = |
| 172 | (SysuiStatusBarStateController) Dependency.get(StatusBarStateController.class); |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 173 | private final DockManager mDockManager; |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 174 | private KeyguardBypassController mBypassController; |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 175 | |
Jorim Jaggi | a9d7fcd | 2017-05-18 01:08:12 +0200 | [diff] [blame] | 176 | private final KeyguardUpdateMonitorCallback mUpdateMonitorCallback = |
| 177 | new KeyguardUpdateMonitorCallback() { |
| 178 | @Override |
| 179 | public void onEmergencyCallAction() { |
| 180 | |
| 181 | // Since we won't get a setOccluded call we have to reset the view manually such that |
| 182 | // the bouncer goes away. |
| 183 | if (mOccluded) { |
Lucas Dupin | 28f9029 | 2017-08-08 18:07:49 -0400 | [diff] [blame] | 184 | reset(true /* hideBouncerWhenShowing */); |
Jorim Jaggi | a9d7fcd | 2017-05-18 01:08:12 +0200 | [diff] [blame] | 185 | } |
| 186 | } |
| 187 | }; |
| 188 | |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 189 | public StatusBarKeyguardViewManager(Context context, ViewMediatorCallback callback, |
| 190 | LockPatternUtils lockPatternUtils) { |
| 191 | mContext = context; |
| 192 | mViewMediatorCallback = callback; |
| 193 | mLockPatternUtils = lockPatternUtils; |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 194 | mStatusBarWindowController = Dependency.get(StatusBarWindowController.class); |
Jorim Jaggi | a9d7fcd | 2017-05-18 01:08:12 +0200 | [diff] [blame] | 195 | KeyguardUpdateMonitor.getInstance(context).registerCallback(mUpdateMonitorCallback); |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 196 | mStatusBarStateController.addCallback(this); |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 197 | Dependency.get(ConfigurationController.class).addCallback(this); |
Lucas Dupin | be050b2 | 2019-05-02 16:38:33 -0700 | [diff] [blame] | 198 | mGesturalNav = QuickStepContract.isGesturalMode( |
Winson Chung | 1aa24b9 | 2019-04-24 15:17:33 -0700 | [diff] [blame] | 199 | Dependency.get(NavigationModeController.class).addListener(this)); |
Lucas Dupin | d93e95f | 2019-05-01 00:49:35 +0000 | [diff] [blame] | 200 | mDockManager = Dependency.get(DockManager.class); |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 201 | if (mDockManager != null) { |
| 202 | mDockManager.addListener(mDockEventListener); |
| 203 | mIsDocked = mDockManager.isDocked(); |
| 204 | } |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 205 | } |
| 206 | |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 207 | public void registerStatusBar(StatusBar statusBar, |
Jason Monk | 421a941 | 2017-02-06 09:15:21 -0800 | [diff] [blame] | 208 | ViewGroup container, |
Lucas Dupin | bc9aac1 | 2018-03-04 20:18:15 -0800 | [diff] [blame] | 209 | NotificationPanelView notificationPanelView, |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 210 | BiometricUnlockController biometricUnlockController, |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 211 | DismissCallbackRegistry dismissCallbackRegistry, |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 212 | ViewGroup lockIconContainer, View notificationContainer, |
| 213 | KeyguardBypassController bypassController) { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 214 | mStatusBar = statusBar; |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 215 | mContainer = container; |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 216 | mLockIconContainer = lockIconContainer; |
Lucas Dupin | 269feda | 2019-04-29 17:11:02 -0700 | [diff] [blame] | 217 | if (mLockIconContainer != null) { |
| 218 | mLastLockVisible = mLockIconContainer.getVisibility() == View.VISIBLE; |
| 219 | } |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 220 | mBiometricUnlockController = biometricUnlockController; |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 221 | mBouncer = SystemUIFactory.getInstance().createKeyguardBouncer(mContext, |
Lucas Dupin | 15a6b6c | 2018-04-16 14:50:20 +0800 | [diff] [blame] | 222 | mViewMediatorCallback, mLockPatternUtils, container, dismissCallbackRegistry, |
Lucas Dupin | 04ec6df | 2019-08-15 11:41:52 -0700 | [diff] [blame] | 223 | mExpansionCallback, bypassController); |
Lucas Dupin | bc9aac1 | 2018-03-04 20:18:15 -0800 | [diff] [blame] | 224 | mNotificationPanelView = notificationPanelView; |
Selim Cinek | a678b0e | 2019-07-23 13:12:55 -0700 | [diff] [blame] | 225 | notificationPanelView.addExpansionListener(this); |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 226 | mBypassController = bypassController; |
| 227 | mNotificationContainer = notificationContainer; |
Lucas Dupin | bc9aac1 | 2018-03-04 20:18:15 -0800 | [diff] [blame] | 228 | } |
| 229 | |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 230 | @Override |
| 231 | public void onPanelExpansionChanged(float expansion, boolean tracking) { |
Lucas Dupin | 6f0d71f | 2018-03-23 17:26:06 -0700 | [diff] [blame] | 232 | // We don't want to translate the bounce when: |
| 233 | // • Keyguard is occluded, because we're in a FLAG_SHOW_WHEN_LOCKED activity and need to |
| 234 | // conserve the original animation. |
| 235 | // • The user quickly taps on the display and we show "swipe up to unlock." |
| 236 | // • 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] | 237 | // • Full-screen user switcher is displayed. |
Lucas Dupin | d7344dc | 2018-04-20 12:08:52 +0800 | [diff] [blame] | 238 | if (mNotificationPanelView.isUnlockHintRunning()) { |
Lucas Dupin | f9ca35e | 2018-05-16 20:41:35 -0700 | [diff] [blame] | 239 | mBouncer.setExpansion(KeyguardBouncer.EXPANSION_HIDDEN); |
Lucas Dupin | c516bac | 2018-06-19 10:50:04 -0700 | [diff] [blame] | 240 | } else if (bouncerNeedsScrimming()) { |
Lucas Dupin | f9ca35e | 2018-05-16 20:41:35 -0700 | [diff] [blame] | 241 | mBouncer.setExpansion(KeyguardBouncer.EXPANSION_VISIBLE); |
Lucas Dupin | 1c32743 | 2019-01-03 13:37:53 -0800 | [diff] [blame] | 242 | } else if (mShowing) { |
Lucas Dupin | aaac2cb | 2018-06-08 14:11:41 -0700 | [diff] [blame] | 243 | if (!isWakeAndUnlocking() && !mStatusBar.isInLaunchTransition()) { |
Lucas Dupin | 71dd484 | 2018-05-29 15:41:03 -0700 | [diff] [blame] | 244 | mBouncer.setExpansion(expansion); |
| 245 | } |
Lucas Dupin | f9ca35e | 2018-05-16 20:41:35 -0700 | [diff] [blame] | 246 | if (expansion != KeyguardBouncer.EXPANSION_HIDDEN && tracking |
| 247 | && mStatusBar.isKeyguardCurrentlySecure() |
Lucas Dupin | 52a9587 | 2018-04-20 10:28:07 +0800 | [diff] [blame] | 248 | && !mBouncer.isShowing() && !mBouncer.isAnimatingAway()) { |
Lucas Dupin | 71dd484 | 2018-05-29 15:41:03 -0700 | [diff] [blame] | 249 | mBouncer.show(false /* resetSecuritySelection */, false /* scrimmed */); |
Lucas Dupin | 3d565fa | 2018-03-20 15:40:14 -0700 | [diff] [blame] | 250 | } |
Lucas Dupin | f6a1f17 | 2019-04-18 20:57:40 -0700 | [diff] [blame] | 251 | } else if (mPulsing && expansion == KeyguardBouncer.EXPANSION_VISIBLE) { |
| 252 | // Panel expanded while pulsing but didn't translate the bouncer (because we are |
| 253 | // unlocked.) Let's simply wake-up to dismiss the lock screen. |
| 254 | mStatusBar.wakeUpIfDozing(SystemClock.uptimeMillis(), mContainer, "BOUNCER_VISIBLE"); |
Lucas Dupin | bc9aac1 | 2018-03-04 20:18:15 -0800 | [diff] [blame] | 255 | } |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 256 | } |
| 257 | |
| 258 | @Override |
| 259 | public void onQsExpansionChanged(float expansion) { |
| 260 | updateLockIcon(); |
| 261 | } |
| 262 | |
| 263 | private void updateLockIcon() { |
Brad Stenning | 691c274 | 2019-04-19 11:48:00 -0700 | [diff] [blame] | 264 | // Not all form factors have a lock icon |
| 265 | if (mLockIconContainer == null) { |
| 266 | return; |
| 267 | } |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 268 | boolean keyguardWithoutQs = mStatusBarStateController.getState() == StatusBarState.KEYGUARD |
| 269 | && !mNotificationPanelView.isQsExpanded(); |
Lucas Dupin | 269feda | 2019-04-29 17:11:02 -0700 | [diff] [blame] | 270 | boolean lockVisible = (mBouncer.isShowing() || keyguardWithoutQs) |
Selim Cinek | 84b2acc | 2019-07-07 00:40:38 -0700 | [diff] [blame] | 271 | && !mBouncer.isAnimatingAway() && !mKeyguardMonitor.isKeyguardFadingAway(); |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 272 | |
Lucas Dupin | 269feda | 2019-04-29 17:11:02 -0700 | [diff] [blame] | 273 | if (mLastLockVisible != lockVisible) { |
| 274 | mLastLockVisible = lockVisible; |
| 275 | if (lockVisible) { |
| 276 | CrossFadeHelper.fadeIn(mLockIconContainer, |
| 277 | AppearAnimationUtils.DEFAULT_APPEAR_DURATION /* duration */, |
| 278 | 0 /* delay */); |
| 279 | } else { |
Selim Cinek | 84b2acc | 2019-07-07 00:40:38 -0700 | [diff] [blame] | 280 | final long duration; |
| 281 | if (needsBypassFading()) { |
| 282 | duration = KeyguardBypassController.BYPASS_PANEL_FADE_DURATION; |
| 283 | } else { |
| 284 | duration = AppearAnimationUtils.DEFAULT_APPEAR_DURATION / 2; |
| 285 | } |
Lucas Dupin | 269feda | 2019-04-29 17:11:02 -0700 | [diff] [blame] | 286 | CrossFadeHelper.fadeOut(mLockIconContainer, |
Selim Cinek | 84b2acc | 2019-07-07 00:40:38 -0700 | [diff] [blame] | 287 | duration /* duration */, |
Lucas Dupin | 269feda | 2019-04-29 17:11:02 -0700 | [diff] [blame] | 288 | 0 /* delay */, null /* runnable */); |
| 289 | } |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 290 | } |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 291 | } |
| 292 | |
| 293 | /** |
| 294 | * Show the keyguard. Will handle creating and attaching to the view manager |
| 295 | * lazily. |
| 296 | */ |
| 297 | public void show(Bundle options) { |
Jorim Jaggi | 03c701e | 2014-04-02 12:39:51 +0200 | [diff] [blame] | 298 | mShowing = true; |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 299 | mStatusBarWindowController.setKeyguardShowing(true); |
Evan Laird | 2d620fa | 2018-10-30 13:03:31 -0400 | [diff] [blame] | 300 | mKeyguardMonitor.notifyKeyguardState( |
| 301 | mShowing, mKeyguardMonitor.isSecure(), mKeyguardMonitor.isOccluded()); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 302 | reset(true /* hideBouncerWhenShowing */); |
Tej Singh | dd7bd35 | 2018-02-09 19:33:15 -0800 | [diff] [blame] | 303 | StatsLog.write(StatsLog.KEYGUARD_STATE_CHANGED, |
| 304 | StatsLog.KEYGUARD_STATE_CHANGED__STATE__SHOWN); |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 305 | } |
| 306 | |
Jorim Jaggi | a005f1b | 2014-04-16 19:06:10 +0200 | [diff] [blame] | 307 | /** |
| 308 | * Shows the notification keyguard or the bouncer depending on |
| 309 | * {@link KeyguardBouncer#needsFullscreenBouncer()}. |
| 310 | */ |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 311 | protected void showBouncerOrKeyguard(boolean hideBouncerWhenShowing) { |
Adrian Roos | 41eecff | 2017-06-29 14:09:52 +0200 | [diff] [blame] | 312 | if (mBouncer.needsFullscreenBouncer() && !mDozing) { |
Jorim Jaggi | a005f1b | 2014-04-16 19:06:10 +0200 | [diff] [blame] | 313 | // The keyguard might be showing (already). So we need to hide it. |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 314 | mStatusBar.hideKeyguard(); |
Jorim Jaggi | 95e89ca | 2014-11-24 20:12:50 +0100 | [diff] [blame] | 315 | mBouncer.show(true /* resetSecuritySelection */); |
Jorim Jaggi | a005f1b | 2014-04-16 19:06:10 +0200 | [diff] [blame] | 316 | } else { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 317 | mStatusBar.showKeyguard(); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 318 | if (hideBouncerWhenShowing) { |
Jian Jin | d1b6398 | 2018-05-21 15:20:40 -0700 | [diff] [blame] | 319 | hideBouncer(shouldDestroyViewOnReset() /* destroyView */); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 320 | mBouncer.prepare(); |
| 321 | } |
Jorim Jaggi | a005f1b | 2014-04-16 19:06:10 +0200 | [diff] [blame] | 322 | } |
Adrian Roos | 61676aa | 2017-08-03 16:24:32 +0200 | [diff] [blame] | 323 | updateStates(); |
Jorim Jaggi | a005f1b | 2014-04-16 19:06:10 +0200 | [diff] [blame] | 324 | } |
| 325 | |
Jian Jin | d1b6398 | 2018-05-21 15:20:40 -0700 | [diff] [blame] | 326 | protected boolean shouldDestroyViewOnReset() { |
| 327 | return false; |
| 328 | } |
| 329 | |
Lucas Dupin | 3c9df5a | 2018-02-27 11:32:16 -0800 | [diff] [blame] | 330 | private void hideBouncer(boolean destroyView) { |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 331 | if (mBouncer == null) { |
| 332 | return; |
| 333 | } |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 334 | mBouncer.hide(destroyView); |
Adrian Roos | 34e6540 | 2017-08-07 19:32:45 +0200 | [diff] [blame] | 335 | cancelPendingWakeupAction(); |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 336 | } |
| 337 | |
Lucas Dupin | f9ca35e | 2018-05-16 20:41:35 -0700 | [diff] [blame] | 338 | public void showBouncer(boolean scrimmed) { |
| 339 | if (mShowing && !mBouncer.isShowing()) { |
| 340 | mBouncer.show(false /* resetSecuritySelection */, scrimmed); |
Dan Sandler | 3806c77 | 2014-05-08 14:52:10 -0400 | [diff] [blame] | 341 | } |
Jorim Jaggi | 4222d9a | 2014-04-23 16:13:15 +0200 | [diff] [blame] | 342 | updateStates(); |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 343 | } |
| 344 | |
Jorim Jaggi | d944986 | 2015-05-29 14:49:08 -0700 | [diff] [blame] | 345 | public void dismissWithAction(OnDismissAction r, Runnable cancelAction, |
| 346 | boolean afterKeyguardGone) { |
Lucas Dupin | c80c67e | 2017-12-04 14:29:10 -0800 | [diff] [blame] | 347 | dismissWithAction(r, cancelAction, afterKeyguardGone, null /* message */); |
| 348 | } |
| 349 | |
| 350 | public void dismissWithAction(OnDismissAction r, Runnable cancelAction, |
| 351 | boolean afterKeyguardGone, String message) { |
Adrian Roos | 0002a45 | 2014-07-03 13:46:07 +0200 | [diff] [blame] | 352 | if (mShowing) { |
Adrian Roos | 34e6540 | 2017-08-07 19:32:45 +0200 | [diff] [blame] | 353 | cancelPendingWakeupAction(); |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 354 | // If we're dozing, this needs to be delayed until after we wake up - unless we're |
| 355 | // wake-and-unlocking, because there dozing will last until the end of the transition. |
| 356 | if (mDozing && !isWakeAndUnlocking()) { |
Adrian Roos | 34e6540 | 2017-08-07 19:32:45 +0200 | [diff] [blame] | 357 | mPendingWakeupAction = new DismissWithActionRequest( |
Lucas Dupin | c80c67e | 2017-12-04 14:29:10 -0800 | [diff] [blame] | 358 | r, cancelAction, afterKeyguardGone, message); |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 359 | return; |
| 360 | } |
| 361 | |
Jorim Jaggi | 746f7fa | 2014-08-27 17:52:46 +0200 | [diff] [blame] | 362 | if (!afterKeyguardGone) { |
Jorim Jaggi | d944986 | 2015-05-29 14:49:08 -0700 | [diff] [blame] | 363 | mBouncer.showWithDismissAction(r, cancelAction); |
Jorim Jaggi | 746f7fa | 2014-08-27 17:52:46 +0200 | [diff] [blame] | 364 | } else { |
Jorim Jaggi | 746f7fa | 2014-08-27 17:52:46 +0200 | [diff] [blame] | 365 | mAfterKeyguardGoneAction = r; |
Jorim Jaggi | 8d5a6e7 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 366 | mBouncer.show(false /* resetSecuritySelection */); |
Jorim Jaggi | 746f7fa | 2014-08-27 17:52:46 +0200 | [diff] [blame] | 367 | } |
Adrian Roos | 7d7090d | 2014-05-21 13:10:23 +0200 | [diff] [blame] | 368 | } |
| 369 | updateStates(); |
| 370 | } |
| 371 | |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 372 | private boolean isWakeAndUnlocking() { |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 373 | int mode = mBiometricUnlockController.getMode(); |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 374 | return mode == MODE_WAKE_AND_UNLOCK || mode == MODE_WAKE_AND_UNLOCK_PULSING; |
| 375 | } |
| 376 | |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 377 | /** |
Jorim Jaggi | bcbe948 | 2016-11-23 17:37:49 +0100 | [diff] [blame] | 378 | * Adds a {@param runnable} to be executed after Keyguard is gone. |
| 379 | */ |
| 380 | public void addAfterKeyguardGoneRunnable(Runnable runnable) { |
| 381 | mAfterKeyguardGoneRunnables.add(runnable); |
| 382 | } |
| 383 | |
| 384 | /** |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 385 | * Reset the state of the view. |
| 386 | */ |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 387 | public void reset(boolean hideBouncerWhenShowing) { |
Jorim Jaggi | 43bdbbd | 2014-05-09 16:05:53 +0200 | [diff] [blame] | 388 | if (mShowing) { |
Adrian Roos | 7a56d1a | 2017-08-04 15:04:43 +0200 | [diff] [blame] | 389 | if (mOccluded && !mDozing) { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 390 | mStatusBar.hideKeyguard(); |
Adrian Roos | 91ffdc4 | 2017-08-04 18:14:41 +0200 | [diff] [blame] | 391 | if (hideBouncerWhenShowing || mBouncer.needsFullscreenBouncer()) { |
| 392 | hideBouncer(false /* destroyView */); |
| 393 | } |
Jorim Jaggi | 43bdbbd | 2014-05-09 16:05:53 +0200 | [diff] [blame] | 394 | } else { |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 395 | showBouncerOrKeyguard(hideBouncerWhenShowing); |
Jorim Jaggi | 43bdbbd | 2014-05-09 16:05:53 +0200 | [diff] [blame] | 396 | } |
Selim Cinek | 1fcafc4 | 2015-07-20 14:39:25 -0700 | [diff] [blame] | 397 | KeyguardUpdateMonitor.getInstance(mContext).sendKeyguardReset(); |
Jorim Jaggi | 43bdbbd | 2014-05-09 16:05:53 +0200 | [diff] [blame] | 398 | updateStates(); |
Dan Sandler | 3806c77 | 2014-05-08 14:52:10 -0400 | [diff] [blame] | 399 | } |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 400 | } |
| 401 | |
Lucas Dupin | 16cfe45 | 2018-02-08 13:14:50 -0800 | [diff] [blame] | 402 | public boolean isGoingToSleepVisibleNotOccluded() { |
| 403 | return mGoingToSleepVisibleNotOccluded; |
| 404 | } |
| 405 | |
Jorim Jaggi | 18f18ae | 2015-09-10 15:48:21 -0700 | [diff] [blame] | 406 | public void onStartedGoingToSleep() { |
Lucas Dupin | 16cfe45 | 2018-02-08 13:14:50 -0800 | [diff] [blame] | 407 | mGoingToSleepVisibleNotOccluded = isShowing() && !isOccluded(); |
Jorim Jaggi | 18f18ae | 2015-09-10 15:48:21 -0700 | [diff] [blame] | 408 | } |
| 409 | |
Jorim Jaggi | 0d210f6 | 2015-07-10 14:24:44 -0700 | [diff] [blame] | 410 | public void onFinishedGoingToSleep() { |
Lucas Dupin | 16cfe45 | 2018-02-08 13:14:50 -0800 | [diff] [blame] | 411 | mGoingToSleepVisibleNotOccluded = false; |
Jorim Jaggi | 03c701e | 2014-04-02 12:39:51 +0200 | [diff] [blame] | 412 | mBouncer.onScreenTurnedOff(); |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 413 | } |
| 414 | |
Jorim Jaggi | 0d210f6 | 2015-07-10 14:24:44 -0700 | [diff] [blame] | 415 | public void onStartedWakingUp() { |
Adrian Roos | 731d4df | 2017-07-18 15:10:39 +0200 | [diff] [blame] | 416 | // TODO: remove |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 417 | } |
| 418 | |
Jorim Jaggi | 9373911 | 2015-08-13 15:53:14 -0700 | [diff] [blame] | 419 | public void onScreenTurningOn() { |
Adrian Roos | 731d4df | 2017-07-18 15:10:39 +0200 | [diff] [blame] | 420 | // TODO: remove |
Selim Cinek | 372d1bd | 2015-08-14 13:19:37 -0700 | [diff] [blame] | 421 | } |
| 422 | |
Jorim Jaggi | 0d210f6 | 2015-07-10 14:24:44 -0700 | [diff] [blame] | 423 | public void onScreenTurnedOn() { |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 424 | // TODO: remove |
Jorim Jaggi | 0d210f6 | 2015-07-10 14:24:44 -0700 | [diff] [blame] | 425 | } |
| 426 | |
Adrian Roos | d28ccd7 | 2016-01-06 15:23:14 +0100 | [diff] [blame] | 427 | @Override |
| 428 | public void onRemoteInputActive(boolean active) { |
| 429 | mRemoteInputActive = active; |
| 430 | updateStates(); |
| 431 | } |
| 432 | |
Evan Laird | 878c853 | 2018-10-15 15:54:29 -0400 | [diff] [blame] | 433 | private void setDozing(boolean dozing) { |
Adrian Roos | 41eecff | 2017-06-29 14:09:52 +0200 | [diff] [blame] | 434 | if (mDozing != dozing) { |
| 435 | mDozing = dozing; |
Adrian Roos | 61676aa | 2017-08-03 16:24:32 +0200 | [diff] [blame] | 436 | if (dozing || mBouncer.needsFullscreenBouncer() || mOccluded) { |
| 437 | reset(dozing /* hideBouncerWhenShowing */); |
| 438 | } |
Adrian Roos | 41eecff | 2017-06-29 14:09:52 +0200 | [diff] [blame] | 439 | updateStates(); |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 440 | |
| 441 | if (!dozing) { |
Adrian Roos | 34e6540 | 2017-08-07 19:32:45 +0200 | [diff] [blame] | 442 | launchPendingWakeupAction(); |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 443 | } |
Adrian Roos | 41eecff | 2017-06-29 14:09:52 +0200 | [diff] [blame] | 444 | } |
Adrian Roos | 087826a | 2017-04-19 16:59:09 -0700 | [diff] [blame] | 445 | } |
| 446 | |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 447 | /** |
| 448 | * If {@link StatusBar} is pulsing. |
| 449 | */ |
| 450 | public void setPulsing(boolean pulsing) { |
| 451 | if (mPulsing != pulsing) { |
| 452 | mPulsing = pulsing; |
| 453 | updateStates(); |
| 454 | } |
| 455 | } |
| 456 | |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 457 | public void setNeedsInput(boolean needsInput) { |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 458 | mStatusBarWindowController.setKeyguardNeedsInput(needsInput); |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 459 | } |
| 460 | |
Adrian Roos | d5c2db6 | 2016-03-08 16:11:31 -0800 | [diff] [blame] | 461 | public boolean isUnlockWithWallpaper() { |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 462 | return mStatusBarWindowController.isShowingWallpaper(); |
Adrian Roos | d5c2db6 | 2016-03-08 16:11:31 -0800 | [diff] [blame] | 463 | } |
| 464 | |
Jorim Jaggi | 6626f54 | 2016-08-22 13:08:44 -0700 | [diff] [blame] | 465 | public void setOccluded(boolean occluded, boolean animate) { |
Selim Cinek | 3a49ba2 | 2017-08-10 11:17:39 -0700 | [diff] [blame] | 466 | mStatusBar.setOccluded(occluded); |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 467 | if (occluded && !mOccluded && mShowing) { |
Tej Singh | dd7bd35 | 2018-02-09 19:33:15 -0800 | [diff] [blame] | 468 | StatsLog.write(StatsLog.KEYGUARD_STATE_CHANGED, |
| 469 | StatsLog.KEYGUARD_STATE_CHANGED__STATE__OCCLUDED); |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 470 | if (mStatusBar.isInLaunchTransition()) { |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 471 | mOccluded = true; |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 472 | mStatusBar.fadeKeyguardAfterLaunchTransition(null /* beforeFading */, |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 473 | new Runnable() { |
| 474 | @Override |
| 475 | public void run() { |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 476 | mStatusBarWindowController.setKeyguardOccluded(mOccluded); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 477 | reset(true /* hideBouncerWhenShowing */); |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 478 | } |
| 479 | }); |
| 480 | return; |
| 481 | } |
Tej Singh | dd7bd35 | 2018-02-09 19:33:15 -0800 | [diff] [blame] | 482 | } else if (!occluded && mOccluded && mShowing) { |
| 483 | StatsLog.write(StatsLog.KEYGUARD_STATE_CHANGED, |
| 484 | StatsLog.KEYGUARD_STATE_CHANGED__STATE__SHOWN); |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 485 | } |
Lucas Dupin | 28f9029 | 2017-08-08 18:07:49 -0400 | [diff] [blame] | 486 | boolean isOccluding = !mOccluded && occluded; |
Jorim Jaggi | a631029 | 2014-04-16 14:11:52 +0200 | [diff] [blame] | 487 | mOccluded = occluded; |
Adrian Roos | 909fe2d | 2016-10-12 12:03:24 -0700 | [diff] [blame] | 488 | if (mShowing) { |
Jason Monk | 297c04e | 2018-08-23 17:16:59 -0400 | [diff] [blame] | 489 | mMediaManager.updateMediaMetaData(false, animate && !occluded); |
Adrian Roos | 909fe2d | 2016-10-12 12:03:24 -0700 | [diff] [blame] | 490 | } |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 491 | mStatusBarWindowController.setKeyguardOccluded(occluded); |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 492 | |
Adrian Roos | 7a56d1a | 2017-08-04 15:04:43 +0200 | [diff] [blame] | 493 | // setDozing(false) will call reset once we stop dozing. |
| 494 | if (!mDozing) { |
| 495 | // If Keyguard is reshown, don't hide the bouncer as it might just have been requested |
| 496 | // by a FLAG_DISMISS_KEYGUARD_ACTIVITY. |
Lucas Dupin | 28f9029 | 2017-08-08 18:07:49 -0400 | [diff] [blame] | 497 | reset(isOccluding /* hideBouncerWhenShowing*/); |
Adrian Roos | 7a56d1a | 2017-08-04 15:04:43 +0200 | [diff] [blame] | 498 | } |
Lucas Dupin | e9e7071 | 2019-05-01 14:41:49 -0700 | [diff] [blame] | 499 | if (animate && !occluded && mShowing && !mBouncer.isShowing()) { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 500 | mStatusBar.animateKeyguardUnoccluding(); |
Jorim Jaggi | 6626f54 | 2016-08-22 13:08:44 -0700 | [diff] [blame] | 501 | } |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 502 | } |
| 503 | |
Dan Sandler | 4b22bdf | 2014-06-05 00:58:02 -0400 | [diff] [blame] | 504 | public boolean isOccluded() { |
| 505 | return mOccluded; |
| 506 | } |
| 507 | |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 508 | /** |
Jorim Jaggi | 76a1623 | 2014-08-08 17:00:47 +0200 | [diff] [blame] | 509 | * Starts the animation before we dismiss Keyguard, i.e. an disappearing animation on the |
| 510 | * security view of the bouncer. |
| 511 | * |
Jorim Jaggi | 8de4311c | 2014-08-11 22:36:20 +0200 | [diff] [blame] | 512 | * @param finishRunnable the runnable to be run after the animation finished, or {@code null} if |
| 513 | * no action should be run |
Jorim Jaggi | 76a1623 | 2014-08-08 17:00:47 +0200 | [diff] [blame] | 514 | */ |
| 515 | public void startPreHideAnimation(Runnable finishRunnable) { |
| 516 | if (mBouncer.isShowing()) { |
| 517 | mBouncer.startPreHideAnimation(finishRunnable); |
Lucas Dupin | 9375255 | 2018-03-19 21:32:19 -0700 | [diff] [blame] | 518 | mNotificationPanelView.onBouncerPreHideAnimation(); |
Jorim Jaggi | 8de4311c | 2014-08-11 22:36:20 +0200 | [diff] [blame] | 519 | } else if (finishRunnable != null) { |
Jorim Jaggi | 76a1623 | 2014-08-08 17:00:47 +0200 | [diff] [blame] | 520 | finishRunnable.run(); |
| 521 | } |
Lucas Dupin | d61974d | 2019-03-29 16:09:26 -0700 | [diff] [blame] | 522 | mNotificationPanelView.blockExpansionForCurrentTouch(); |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 523 | updateLockIcon(); |
Jorim Jaggi | 76a1623 | 2014-08-08 17:00:47 +0200 | [diff] [blame] | 524 | } |
| 525 | |
| 526 | /** |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 527 | * Hides the keyguard view |
| 528 | */ |
Jorim Jaggi | e8fde5d | 2016-06-30 23:41:37 -0700 | [diff] [blame] | 529 | public void hide(long startTime, long fadeoutDuration) { |
Jorim Jaggi | 03c701e | 2014-04-02 12:39:51 +0200 | [diff] [blame] | 530 | mShowing = false; |
Evan Laird | 2d620fa | 2018-10-30 13:03:31 -0400 | [diff] [blame] | 531 | mKeyguardMonitor.notifyKeyguardState( |
| 532 | mShowing, mKeyguardMonitor.isSecure(), mKeyguardMonitor.isOccluded()); |
Adrian Roos | 34e6540 | 2017-08-07 19:32:45 +0200 | [diff] [blame] | 533 | launchPendingWakeupAction(); |
Jorim Jaggi | 44cf919 | 2014-06-17 19:16:00 -0700 | [diff] [blame] | 534 | |
Jorim Jaggi | 031f795 | 2016-09-01 16:39:26 -0700 | [diff] [blame] | 535 | if (KeyguardUpdateMonitor.getInstance(mContext).needsSlowUnlockTransition()) { |
Jorim Jaggi | e8fde5d | 2016-06-30 23:41:37 -0700 | [diff] [blame] | 536 | fadeoutDuration = KEYGUARD_DISMISS_DURATION_LOCKED; |
| 537 | } |
Jorim Jaggi | e29b2db | 2014-05-30 23:17:03 +0200 | [diff] [blame] | 538 | long uptimeMillis = SystemClock.uptimeMillis(); |
Jorim Jaggi | 76a1623 | 2014-08-08 17:00:47 +0200 | [diff] [blame] | 539 | long delay = Math.max(0, startTime + HIDE_TIMING_CORRECTION_MS - uptimeMillis); |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 540 | |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 541 | if (mStatusBar.isInLaunchTransition() ) { |
| 542 | mStatusBar.fadeKeyguardAfterLaunchTransition(new Runnable() { |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 543 | @Override |
| 544 | public void run() { |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 545 | mStatusBarWindowController.setKeyguardShowing(false); |
| 546 | mStatusBarWindowController.setKeyguardFadingAway(true); |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 547 | hideBouncer(true /* destroyView */); |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 548 | updateStates(); |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 549 | } |
| 550 | }, new Runnable() { |
| 551 | @Override |
| 552 | public void run() { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 553 | mStatusBar.hideKeyguard(); |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 554 | mStatusBarWindowController.setKeyguardFadingAway(false); |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 555 | mViewMediatorCallback.keyguardGone(); |
Jorim Jaggi | 746f7fa | 2014-08-27 17:52:46 +0200 | [diff] [blame] | 556 | executeAfterKeyguardGoneAction(); |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 557 | } |
| 558 | }); |
| 559 | } else { |
Jorim Jaggi | 8d5a6e7 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 560 | executeAfterKeyguardGoneAction(); |
Jorim Jaggi | e93698b | 2016-11-11 18:24:38 -0800 | [diff] [blame] | 561 | boolean wakeUnlockPulsing = |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 562 | mBiometricUnlockController.getMode() == MODE_WAKE_AND_UNLOCK_PULSING; |
Selim Cinek | c075f15 | 2019-07-24 15:32:17 -0700 | [diff] [blame] | 563 | boolean needsFading = needsBypassFading(); |
| 564 | if (needsFading) { |
| 565 | delay = 0; |
| 566 | fadeoutDuration = KeyguardBypassController.BYPASS_PANEL_FADE_DURATION; |
| 567 | } else if (wakeUnlockPulsing) { |
Jorim Jaggi | e93698b | 2016-11-11 18:24:38 -0800 | [diff] [blame] | 568 | delay = 0; |
| 569 | fadeoutDuration = 240; |
| 570 | } |
Selim Cinek | c075f15 | 2019-07-24 15:32:17 -0700 | [diff] [blame] | 571 | mStatusBar.setKeyguardFadingAway(startTime, delay, fadeoutDuration, needsFading); |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 572 | mBiometricUnlockController.startKeyguardFadingAway(); |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 573 | hideBouncer(true /* destroyView */); |
Jorim Jaggi | e93698b | 2016-11-11 18:24:38 -0800 | [diff] [blame] | 574 | if (wakeUnlockPulsing) { |
Selim Cinek | c075f15 | 2019-07-24 15:32:17 -0700 | [diff] [blame] | 575 | if (needsFading) { |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 576 | ViewGroupFadeHelper.fadeOutAllChildrenExcept(mNotificationPanelView, |
| 577 | mNotificationContainer, |
Selim Cinek | c075f15 | 2019-07-24 15:32:17 -0700 | [diff] [blame] | 578 | fadeoutDuration, |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 579 | () -> { |
| 580 | mStatusBar.hideKeyguard(); |
| 581 | onKeyguardFadedAway(); |
| 582 | }); |
| 583 | } else { |
| 584 | mStatusBar.fadeKeyguardWhilePulsing(); |
| 585 | } |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 586 | wakeAndUnlockDejank(); |
Jorim Jaggi | dbc3dce | 2014-08-01 01:16:36 +0200 | [diff] [blame] | 587 | } else { |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 588 | boolean staying = mStatusBarStateController.leaveOpenOnKeyguardHide(); |
Jorim Jaggi | 83eb6bb | 2015-08-17 17:38:58 -0700 | [diff] [blame] | 589 | if (!staying) { |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 590 | mStatusBarWindowController.setKeyguardFadingAway(true); |
Selim Cinek | c075f15 | 2019-07-24 15:32:17 -0700 | [diff] [blame] | 591 | if (needsFading) { |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 592 | ViewGroupFadeHelper.fadeOutAllChildrenExcept(mNotificationPanelView, |
| 593 | mNotificationContainer, |
Selim Cinek | c075f15 | 2019-07-24 15:32:17 -0700 | [diff] [blame] | 594 | fadeoutDuration, |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 595 | () -> { |
| 596 | mStatusBar.hideKeyguard(); |
| 597 | }); |
| 598 | } else { |
| 599 | mStatusBar.hideKeyguard(); |
| 600 | } |
Lucas Dupin | f0a67e3 | 2018-09-19 15:23:54 -0700 | [diff] [blame] | 601 | // hide() will happen asynchronously and might arrive after the scrims |
| 602 | // were already hidden, this means that the transition callback won't |
| 603 | // be triggered anymore and StatusBarWindowController will be forever in |
| 604 | // the fadingAway state. |
| 605 | mStatusBar.updateScrimController(); |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 606 | wakeAndUnlockDejank(); |
Jorim Jaggi | 83eb6bb | 2015-08-17 17:38:58 -0700 | [diff] [blame] | 607 | } else { |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 608 | mStatusBar.hideKeyguard(); |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 609 | mStatusBar.finishKeyguardFadingAway(); |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 610 | mBiometricUnlockController.finishKeyguardFadingAway(); |
Jorim Jaggi | 83eb6bb | 2015-08-17 17:38:58 -0700 | [diff] [blame] | 611 | } |
Jorim Jaggi | dbc3dce | 2014-08-01 01:16:36 +0200 | [diff] [blame] | 612 | } |
Selim Cinek | 84b2acc | 2019-07-07 00:40:38 -0700 | [diff] [blame] | 613 | updateLockIcon(); |
Jorim Jaggi | 67b29d5 | 2017-06-09 18:00:00 -0700 | [diff] [blame] | 614 | updateStates(); |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 615 | mStatusBarWindowController.setKeyguardShowing(false); |
Selim Cinek | baa2327 | 2014-07-08 18:01:07 +0200 | [diff] [blame] | 616 | mViewMediatorCallback.keyguardGone(); |
Jorim Jaggi | e29b2db | 2014-05-30 23:17:03 +0200 | [diff] [blame] | 617 | } |
Tej Singh | dd7bd35 | 2018-02-09 19:33:15 -0800 | [diff] [blame] | 618 | StatsLog.write(StatsLog.KEYGUARD_STATE_CHANGED, |
| 619 | StatsLog.KEYGUARD_STATE_CHANGED__STATE__HIDDEN); |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 620 | } |
| 621 | |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 622 | private boolean needsBypassFading() { |
| 623 | return (mBiometricUnlockController.getMode() == MODE_UNLOCK_FADING |
| 624 | || mBiometricUnlockController.getMode() == MODE_WAKE_AND_UNLOCK_PULSING |
| 625 | || mBiometricUnlockController.getMode() == MODE_WAKE_AND_UNLOCK) |
| 626 | && mBypassController.getBypassEnabled(); |
| 627 | } |
| 628 | |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 629 | @Override |
Selim Cinek | aa8bbf1 | 2016-05-04 14:13:20 -0700 | [diff] [blame] | 630 | public void onDensityOrFontScaleChanged() { |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 631 | hideBouncer(true /* destroyView */); |
Selim Cinek | aa8bbf1 | 2016-05-04 14:13:20 -0700 | [diff] [blame] | 632 | } |
| 633 | |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 634 | @Override |
Winson Chung | 1aa24b9 | 2019-04-24 15:17:33 -0700 | [diff] [blame] | 635 | public void onNavigationModeChanged(int mode) { |
| 636 | boolean gesturalNav = QuickStepContract.isGesturalMode(mode); |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 637 | if (gesturalNav != mGesturalNav) { |
| 638 | mGesturalNav = gesturalNav; |
| 639 | updateStates(); |
| 640 | } |
| 641 | } |
| 642 | |
Lucas Dupin | 8c51ce2 | 2017-11-21 13:21:05 -0800 | [diff] [blame] | 643 | public void onThemeChanged() { |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 644 | hideBouncer(true /* destroyView */); |
Lucas Dupin | f190a85 | 2017-07-31 17:11:26 -0700 | [diff] [blame] | 645 | mBouncer.prepare(); |
Lucas Dupin | 89516d4 | 2017-07-05 13:29:18 -0700 | [diff] [blame] | 646 | } |
| 647 | |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 648 | public void onKeyguardFadedAway() { |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 649 | mContainer.postDelayed(() -> mStatusBarWindowController.setKeyguardFadingAway(false), |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 650 | 100); |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 651 | ViewGroupFadeHelper.reset(mNotificationPanelView); |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 652 | mStatusBar.finishKeyguardFadingAway(); |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 653 | mBiometricUnlockController.finishKeyguardFadingAway(); |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 654 | WindowManagerGlobal.getInstance().trimMemory( |
| 655 | ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN); |
| 656 | |
Jorim Jaggi | 9097885 | 2015-08-18 19:55:53 -0700 | [diff] [blame] | 657 | } |
| 658 | |
Lucas Dupin | 9e3fa10 | 2017-11-08 17:16:55 -0800 | [diff] [blame] | 659 | private void wakeAndUnlockDejank() { |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 660 | if (mBiometricUnlockController.getMode() == MODE_WAKE_AND_UNLOCK |
Jorim Jaggi | 8adb30c | 2016-09-13 15:02:22 -0700 | [diff] [blame] | 661 | && LatencyTracker.isEnabled(mContext)) { |
| 662 | DejankUtils.postAfterTraversal(() -> |
| 663 | LatencyTracker.getInstance(mContext).onActionEnd( |
| 664 | LatencyTracker.ACTION_FINGERPRINT_WAKE_AND_UNLOCK)); |
| 665 | } |
Jorim Jaggi | 0d210f6 | 2015-07-10 14:24:44 -0700 | [diff] [blame] | 666 | } |
| 667 | |
Jorim Jaggi | 746f7fa | 2014-08-27 17:52:46 +0200 | [diff] [blame] | 668 | private void executeAfterKeyguardGoneAction() { |
| 669 | if (mAfterKeyguardGoneAction != null) { |
| 670 | mAfterKeyguardGoneAction.onDismiss(); |
| 671 | mAfterKeyguardGoneAction = null; |
| 672 | } |
Jorim Jaggi | bcbe948 | 2016-11-23 17:37:49 +0100 | [diff] [blame] | 673 | for (int i = 0; i < mAfterKeyguardGoneRunnables.size(); i++) { |
| 674 | mAfterKeyguardGoneRunnables.get(i).run(); |
| 675 | } |
| 676 | mAfterKeyguardGoneRunnables.clear(); |
Jorim Jaggi | 746f7fa | 2014-08-27 17:52:46 +0200 | [diff] [blame] | 677 | } |
| 678 | |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 679 | /** |
| 680 | * Dismisses the keyguard by going to the next screen or making it gone. |
| 681 | */ |
Jorim Jaggi | 8d5a6e7 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 682 | public void dismissAndCollapse() { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 683 | mStatusBar.executeRunnableDismissingKeyguard(null, null, true, false, true); |
Jorim Jaggi | 8d5a6e7 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 684 | } |
| 685 | |
Christoph Studer | 2231c6e | 2014-12-19 12:40:13 +0100 | [diff] [blame] | 686 | /** |
| 687 | * WARNING: This method might cause Binder calls. |
| 688 | */ |
Jorim Jaggi | 1568250 | 2014-04-23 12:01:36 +0200 | [diff] [blame] | 689 | public boolean isSecure() { |
| 690 | return mBouncer.isSecure(); |
| 691 | } |
| 692 | |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 693 | /** |
| 694 | * @return Whether the keyguard is showing |
| 695 | */ |
| 696 | public boolean isShowing() { |
Jorim Jaggi | 03c701e | 2014-04-02 12:39:51 +0200 | [diff] [blame] | 697 | return mShowing; |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 698 | } |
Jorim Jaggi | e5c7a89 | 2014-04-10 20:37:32 +0200 | [diff] [blame] | 699 | |
| 700 | /** |
| 701 | * Notifies this manager that the back button has been pressed. |
| 702 | * |
Lucas Dupin | 3f54fe2 | 2018-04-08 23:17:40 -0700 | [diff] [blame] | 703 | * @param hideImmediately Hide bouncer when {@code true}, keep it around otherwise. |
| 704 | * Non-scrimmed bouncers have a special animation tied to the expansion |
| 705 | * of the notification panel. |
Jorim Jaggi | e5c7a89 | 2014-04-10 20:37:32 +0200 | [diff] [blame] | 706 | * @return whether the back press has been handled |
| 707 | */ |
Lucas Dupin | 3f54fe2 | 2018-04-08 23:17:40 -0700 | [diff] [blame] | 708 | public boolean onBackPressed(boolean hideImmediately) { |
Jorim Jaggi | e5c7a89 | 2014-04-10 20:37:32 +0200 | [diff] [blame] | 709 | if (mBouncer.isShowing()) { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 710 | mStatusBar.endAffordanceLaunch(); |
Fabian Kozynski | baa47b6 | 2019-04-26 15:40:43 -0400 | [diff] [blame] | 711 | // The second condition is for SIM card locked bouncer |
| 712 | if (mBouncer.isScrimmed() && !mBouncer.needsFullscreenBouncer()) { |
| 713 | hideBouncer(false); |
| 714 | updateStates(); |
| 715 | } else { |
| 716 | reset(hideImmediately); |
| 717 | } |
Jorim Jaggi | e5c7a89 | 2014-04-10 20:37:32 +0200 | [diff] [blame] | 718 | return true; |
| 719 | } |
| 720 | return false; |
| 721 | } |
| 722 | |
Jim Miller | f41fc96 | 2014-06-18 16:33:51 -0700 | [diff] [blame] | 723 | public boolean isBouncerShowing() { |
| 724 | return mBouncer.isShowing(); |
| 725 | } |
| 726 | |
Lucas Dupin | fa817a0 | 2019-07-02 15:22:54 -0700 | [diff] [blame] | 727 | /** |
| 728 | * When bouncer is fully visible or {@link KeyguardBouncer#show(boolean)} was called but |
| 729 | * animation didn't finish yet. |
| 730 | */ |
| 731 | public boolean bouncerIsOrWillBeShowing() { |
Lucas Dupin | b7d3274 | 2019-07-12 17:46:11 +0900 | [diff] [blame] | 732 | return mBouncer.isShowing() || mBouncer.inTransit(); |
Lucas Dupin | fa817a0 | 2019-07-02 15:22:54 -0700 | [diff] [blame] | 733 | } |
| 734 | |
Jackal Guo | 42cae96 | 2018-04-18 18:41:19 +0800 | [diff] [blame] | 735 | public boolean isFullscreenBouncer() { |
| 736 | return mBouncer.isFullscreenBouncer(); |
| 737 | } |
| 738 | |
Jorim Jaggi | 416493b | 2014-09-13 03:57:32 +0200 | [diff] [blame] | 739 | private long getNavBarShowDelay() { |
Jason Monk | 1fd3fc3 | 2018-08-14 17:20:09 -0400 | [diff] [blame] | 740 | if (mKeyguardMonitor.isKeyguardFadingAway()) { |
| 741 | return mKeyguardMonitor.getKeyguardFadingAwayDelay(); |
Adrian Roos | 087826a | 2017-04-19 16:59:09 -0700 | [diff] [blame] | 742 | } else if (mBouncer.isShowing()) { |
Jorim Jaggi | 416493b | 2014-09-13 03:57:32 +0200 | [diff] [blame] | 743 | return NAV_BAR_SHOW_DELAY_BOUNCER; |
Adrian Roos | 087826a | 2017-04-19 16:59:09 -0700 | [diff] [blame] | 744 | } else { |
| 745 | // No longer dozing, or remote input is active. No delay. |
| 746 | return 0; |
Jorim Jaggi | 416493b | 2014-09-13 03:57:32 +0200 | [diff] [blame] | 747 | } |
| 748 | } |
| 749 | |
| 750 | private Runnable mMakeNavigationBarVisibleRunnable = new Runnable() { |
| 751 | @Override |
| 752 | public void run() { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 753 | mStatusBar.getNavigationBarView().getRootView().setVisibility(View.VISIBLE); |
Jorim Jaggi | 416493b | 2014-09-13 03:57:32 +0200 | [diff] [blame] | 754 | } |
| 755 | }; |
| 756 | |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 757 | protected void updateStates() { |
Jorim Jaggi | e5c7a89 | 2014-04-10 20:37:32 +0200 | [diff] [blame] | 758 | int vis = mContainer.getSystemUiVisibility(); |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 759 | boolean showing = mShowing; |
| 760 | boolean occluded = mOccluded; |
| 761 | boolean bouncerShowing = mBouncer.isShowing(); |
Jorim Jaggi | 95e89ca | 2014-11-24 20:12:50 +0100 | [diff] [blame] | 762 | boolean bouncerDismissible = !mBouncer.isFullscreenBouncer(); |
Adrian Roos | d28ccd7 | 2016-01-06 15:23:14 +0100 | [diff] [blame] | 763 | boolean remoteInputActive = mRemoteInputActive; |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 764 | |
Adrian Roos | d28ccd7 | 2016-01-06 15:23:14 +0100 | [diff] [blame] | 765 | if ((bouncerDismissible || !showing || remoteInputActive) != |
| 766 | (mLastBouncerDismissible || !mLastShowing || mLastRemoteInputActive) |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 767 | || mFirstUpdate) { |
Adrian Roos | d28ccd7 | 2016-01-06 15:23:14 +0100 | [diff] [blame] | 768 | if (bouncerDismissible || !showing || remoteInputActive) { |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 769 | mContainer.setSystemUiVisibility(vis & ~View.STATUS_BAR_DISABLE_BACK); |
Jason Monk | 1e68fb3 | 2014-05-02 16:06:20 -0400 | [diff] [blame] | 770 | } else { |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 771 | mContainer.setSystemUiVisibility(vis | View.STATUS_BAR_DISABLE_BACK); |
Jason Monk | 1e68fb3 | 2014-05-02 16:06:20 -0400 | [diff] [blame] | 772 | } |
Jorim Jaggi | a631029 | 2014-04-16 14:11:52 +0200 | [diff] [blame] | 773 | } |
Jorim Jaggi | 0d210f6 | 2015-07-10 14:24:44 -0700 | [diff] [blame] | 774 | |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 775 | boolean navBarVisible = isNavBarVisible(); |
| 776 | boolean lastNavBarVisible = getLastNavBarVisible(); |
Jorim Jaggi | 0d210f6 | 2015-07-10 14:24:44 -0700 | [diff] [blame] | 777 | if (navBarVisible != lastNavBarVisible || mFirstUpdate) { |
Brad Stenning | 7e41181 | 2018-04-13 22:52:39 -0700 | [diff] [blame] | 778 | updateNavigationBarVisibility(navBarVisible); |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 779 | } |
| 780 | |
| 781 | if (bouncerShowing != mLastBouncerShowing || mFirstUpdate) { |
Lucas Dupin | 1a8588d | 2018-08-21 12:18:47 -0700 | [diff] [blame] | 782 | mStatusBarWindowController.setBouncerShowing(bouncerShowing); |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 783 | mStatusBar.setBouncerShowing(bouncerShowing); |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 784 | } |
| 785 | |
| 786 | KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext); |
| 787 | if ((showing && !occluded) != (mLastShowing && !mLastOccluded) || mFirstUpdate) { |
Jorim Jaggi | 6a15d52 | 2015-09-22 15:55:33 -0700 | [diff] [blame] | 788 | updateMonitor.onKeyguardVisibilityChanged(showing && !occluded); |
Adrian Roos | b601162 | 2014-05-14 15:52:53 +0200 | [diff] [blame] | 789 | } |
| 790 | if (bouncerShowing != mLastBouncerShowing || mFirstUpdate) { |
| 791 | updateMonitor.sendKeyguardBouncerChanged(bouncerShowing); |
| 792 | } |
| 793 | |
| 794 | mFirstUpdate = false; |
| 795 | mLastShowing = showing; |
| 796 | mLastOccluded = occluded; |
| 797 | mLastBouncerShowing = bouncerShowing; |
| 798 | mLastBouncerDismissible = bouncerDismissible; |
Adrian Roos | d28ccd7 | 2016-01-06 15:23:14 +0100 | [diff] [blame] | 799 | mLastRemoteInputActive = remoteInputActive; |
Adrian Roos | 087826a | 2017-04-19 16:59:09 -0700 | [diff] [blame] | 800 | mLastDozing = mDozing; |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 801 | mLastPulsing = mPulsing; |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 802 | mLastBiometricMode = mBiometricUnlockController.getMode(); |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 803 | mLastGesturalNav = mGesturalNav; |
| 804 | mLastIsDocked = mIsDocked; |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 805 | mStatusBar.onKeyguardViewManagerStatesUpdated(); |
Jorim Jaggi | e5c7a89 | 2014-04-10 20:37:32 +0200 | [diff] [blame] | 806 | } |
Jorim Jaggi | 8c8bcc1 | 2014-04-16 21:36:51 +0200 | [diff] [blame] | 807 | |
Brad Stenning | 7e41181 | 2018-04-13 22:52:39 -0700 | [diff] [blame] | 808 | protected void updateNavigationBarVisibility(boolean navBarVisible) { |
| 809 | if (mStatusBar.getNavigationBarView() != null) { |
| 810 | if (navBarVisible) { |
| 811 | long delay = getNavBarShowDelay(); |
| 812 | if (delay == 0) { |
| 813 | mMakeNavigationBarVisibleRunnable.run(); |
| 814 | } else { |
| 815 | mContainer.postOnAnimationDelayed(mMakeNavigationBarVisibleRunnable, |
| 816 | delay); |
| 817 | } |
| 818 | } else { |
| 819 | mContainer.removeCallbacks(mMakeNavigationBarVisibleRunnable); |
| 820 | mStatusBar.getNavigationBarView().getRootView().setVisibility(View.GONE); |
| 821 | } |
| 822 | } |
| 823 | } |
| 824 | |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 825 | /** |
| 826 | * @return Whether the navigation bar should be made visible based on the current state. |
| 827 | */ |
| 828 | protected boolean isNavBarVisible() { |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 829 | int biometricMode = mBiometricUnlockController.getMode(); |
Jorim Jaggi | f5304ad | 2017-07-17 18:31:13 +0200 | [diff] [blame] | 830 | boolean keyguardShowing = mShowing && !mOccluded; |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 831 | boolean hideWhileDozing = mDozing && biometricMode != MODE_WAKE_AND_UNLOCK_PULSING; |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 832 | boolean keyguardWithGestureNav = (keyguardShowing && !mDozing || mPulsing && !mIsDocked) |
| 833 | && mGesturalNav; |
Jorim Jaggi | f5304ad | 2017-07-17 18:31:13 +0200 | [diff] [blame] | 834 | return (!keyguardShowing && !hideWhileDozing || mBouncer.isShowing() |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 835 | || mRemoteInputActive || keyguardWithGestureNav); |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 836 | } |
| 837 | |
| 838 | /** |
| 839 | * @return Whether the navigation bar was made visible based on the last known state. |
| 840 | */ |
| 841 | protected boolean getLastNavBarVisible() { |
Jorim Jaggi | f5304ad | 2017-07-17 18:31:13 +0200 | [diff] [blame] | 842 | boolean keyguardShowing = mLastShowing && !mLastOccluded; |
Gilad Bretter | cb51b8b | 2018-03-22 17:04:51 +0200 | [diff] [blame] | 843 | boolean hideWhileDozing = mLastDozing && mLastBiometricMode != MODE_WAKE_AND_UNLOCK_PULSING; |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 844 | boolean keyguardWithGestureNav = (keyguardShowing && !mLastDozing |
| 845 | || mLastPulsing && !mLastIsDocked) && mLastGesturalNav; |
Jorim Jaggi | f5304ad | 2017-07-17 18:31:13 +0200 | [diff] [blame] | 846 | return (!keyguardShowing && !hideWhileDozing || mLastBouncerShowing |
Lucas Dupin | afffbf9 | 2019-04-09 19:52:26 -0700 | [diff] [blame] | 847 | || mLastRemoteInputActive || keyguardWithGestureNav); |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 848 | } |
| 849 | |
Selim Cinek | 2854019 | 2016-02-19 17:25:08 -0800 | [diff] [blame] | 850 | public boolean shouldDismissOnMenuPressed() { |
| 851 | return mBouncer.shouldDismissOnMenuPressed(); |
Jorim Jaggi | 8c8bcc1 | 2014-04-16 21:36:51 +0200 | [diff] [blame] | 852 | } |
Jorim Jaggi | df99351 | 2014-05-13 23:06:35 +0200 | [diff] [blame] | 853 | |
| 854 | public boolean interceptMediaKey(KeyEvent event) { |
| 855 | return mBouncer.interceptMediaKey(event); |
| 856 | } |
Jorim Jaggi | 8de4311c | 2014-08-11 22:36:20 +0200 | [diff] [blame] | 857 | |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 858 | public void readyForKeyguardDone() { |
| 859 | mViewMediatorCallback.readyForKeyguardDone(); |
| 860 | } |
| 861 | |
Jorim Jaggi | 84a3e7a | 2014-08-13 17:58:58 +0200 | [diff] [blame] | 862 | public boolean shouldDisableWindowAnimationsForUnlock() { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 863 | return mStatusBar.isInLaunchTransition(); |
Jorim Jaggi | 84a3e7a | 2014-08-13 17:58:58 +0200 | [diff] [blame] | 864 | } |
| 865 | |
Issei Suzuki | 5609ccb | 2019-06-13 15:04:08 +0200 | [diff] [blame] | 866 | |
| 867 | /** |
| 868 | * @return Whether subtle animation should be used for unlocking the device. |
| 869 | */ |
| 870 | public boolean shouldSubtleWindowAnimationsForUnlock() { |
Selim Cinek | 06c12d6 | 2019-07-01 19:44:18 -0700 | [diff] [blame] | 871 | return needsBypassFading(); |
Issei Suzuki | 5609ccb | 2019-06-13 15:04:08 +0200 | [diff] [blame] | 872 | } |
| 873 | |
Jorim Jaggi | 84a3e7a | 2014-08-13 17:58:58 +0200 | [diff] [blame] | 874 | public boolean isGoingToNotificationShade() { |
Beverly | 8fdb533 | 2019-02-04 14:29:49 -0500 | [diff] [blame] | 875 | return ((SysuiStatusBarStateController) Dependency.get(StatusBarStateController.class)) |
| 876 | .leaveOpenOnKeyguardHide(); |
Jorim Jaggi | 84a3e7a | 2014-08-13 17:58:58 +0200 | [diff] [blame] | 877 | } |
Adrian Roos | 31b844b | 2014-11-21 13:55:09 +0100 | [diff] [blame] | 878 | |
| 879 | public boolean isSecure(int userId) { |
| 880 | return mBouncer.isSecure() || mLockPatternUtils.isSecure(userId); |
| 881 | } |
Jim Miller | ab95454 | 2014-10-10 18:21:49 -0700 | [diff] [blame] | 882 | |
Jorim Jaggi | 33ae80e | 2015-02-04 16:37:11 +0100 | [diff] [blame] | 883 | public void keyguardGoingAway() { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 884 | mStatusBar.keyguardGoingAway(); |
Jorim Jaggi | 33ae80e | 2015-02-04 16:37:11 +0100 | [diff] [blame] | 885 | } |
Jim Miller | 25d7e51 | 2015-03-03 17:12:09 -0800 | [diff] [blame] | 886 | |
Jorim Jaggi | f3b3bee | 2015-04-16 14:57:34 -0700 | [diff] [blame] | 887 | public void animateCollapsePanels(float speedUpFactor) { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 888 | mStatusBar.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE, true /* force */, |
Jorim Jaggi | f3b3bee | 2015-04-16 14:57:34 -0700 | [diff] [blame] | 889 | false /* delayed */, speedUpFactor); |
Jim Miller | 25d7e51 | 2015-03-03 17:12:09 -0800 | [diff] [blame] | 890 | } |
Jorim Jaggi | 5cc8659 | 2015-06-08 14:48:28 -0700 | [diff] [blame] | 891 | |
Aarthi Balachander | 0a427ef | 2018-07-13 15:00:58 -0700 | [diff] [blame] | 892 | |
| 893 | /** |
| 894 | * Called when cancel button in bouncer is pressed. |
| 895 | */ |
| 896 | public void onCancelClicked() { |
| 897 | // No-op |
| 898 | } |
| 899 | |
Jorim Jaggi | 5cc8659 | 2015-06-08 14:48:28 -0700 | [diff] [blame] | 900 | /** |
| 901 | * Notifies that the user has authenticated by other means than using the bouncer, for example, |
| 902 | * fingerprint. |
| 903 | */ |
Jorim Jaggi | 25b4d4b | 2015-08-11 15:54:06 -0700 | [diff] [blame] | 904 | public void notifyKeyguardAuthenticated(boolean strongAuth) { |
| 905 | mBouncer.notifyKeyguardAuthenticated(strongAuth); |
Jorim Jaggi | 5cc8659 | 2015-06-08 14:48:28 -0700 | [diff] [blame] | 906 | } |
Jorim Jaggi | 0d210f6 | 2015-07-10 14:24:44 -0700 | [diff] [blame] | 907 | |
Jason Chang | 1e4a4bd | 2018-05-22 17:30:19 +0800 | [diff] [blame] | 908 | public void showBouncerMessage(String message, ColorStateList colorState) { |
| 909 | mBouncer.showMessage(message, colorState); |
Selim Cinek | cfafe4e | 2015-08-11 14:58:44 -0700 | [diff] [blame] | 910 | } |
Jorim Jaggi | b774e55 | 2015-08-24 14:52:45 -0700 | [diff] [blame] | 911 | |
| 912 | public ViewRootImpl getViewRootImpl() { |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 913 | return mStatusBar.getStatusBarView().getViewRootImpl(); |
Jorim Jaggi | b774e55 | 2015-08-24 14:52:45 -0700 | [diff] [blame] | 914 | } |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 915 | |
Adrian Roos | 34e6540 | 2017-08-07 19:32:45 +0200 | [diff] [blame] | 916 | public void launchPendingWakeupAction() { |
| 917 | DismissWithActionRequest request = mPendingWakeupAction; |
| 918 | mPendingWakeupAction = null; |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 919 | if (request != null) { |
| 920 | if (mShowing) { |
| 921 | dismissWithAction(request.dismissAction, request.cancelAction, |
Lucas Dupin | c80c67e | 2017-12-04 14:29:10 -0800 | [diff] [blame] | 922 | request.afterKeyguardGone, request.message); |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 923 | } else if (request.dismissAction != null) { |
| 924 | request.dismissAction.onDismiss(); |
| 925 | } |
| 926 | } |
| 927 | } |
| 928 | |
Adrian Roos | 34e6540 | 2017-08-07 19:32:45 +0200 | [diff] [blame] | 929 | public void cancelPendingWakeupAction() { |
| 930 | DismissWithActionRequest request = mPendingWakeupAction; |
| 931 | mPendingWakeupAction = null; |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 932 | if (request != null && request.cancelAction != null) { |
| 933 | request.cancelAction.run(); |
| 934 | } |
| 935 | } |
| 936 | |
Lucas Dupin | f9ca35e | 2018-05-16 20:41:35 -0700 | [diff] [blame] | 937 | public boolean bouncerNeedsScrimming() { |
Lucas Dupin | 300e371 | 2019-03-27 19:33:36 -0700 | [diff] [blame] | 938 | return mOccluded || mBouncer.willDismissWithAction() |
Lucas Dupin | 93f714d | 2019-03-26 16:49:24 -0700 | [diff] [blame] | 939 | || mStatusBar.isFullScreenUserSwitcherState() |
Lucas Dupin | 300e371 | 2019-03-27 19:33:36 -0700 | [diff] [blame] | 940 | || (mBouncer.isShowing() && mBouncer.isScrimmed()) |
| 941 | || mBouncer.isFullscreenBouncer(); |
Lucas Dupin | f9ca35e | 2018-05-16 20:41:35 -0700 | [diff] [blame] | 942 | } |
| 943 | |
Lucas Dupin | 15a6b6c | 2018-04-16 14:50:20 +0800 | [diff] [blame] | 944 | public void dump(PrintWriter pw) { |
| 945 | pw.println("StatusBarKeyguardViewManager:"); |
| 946 | pw.println(" mShowing: " + mShowing); |
| 947 | pw.println(" mOccluded: " + mOccluded); |
| 948 | pw.println(" mRemoteInputActive: " + mRemoteInputActive); |
| 949 | pw.println(" mDozing: " + mDozing); |
| 950 | pw.println(" mGoingToSleepVisibleNotOccluded: " + mGoingToSleepVisibleNotOccluded); |
| 951 | pw.println(" mAfterKeyguardGoneAction: " + mAfterKeyguardGoneAction); |
| 952 | pw.println(" mAfterKeyguardGoneRunnables: " + mAfterKeyguardGoneRunnables); |
| 953 | pw.println(" mPendingWakeupAction: " + mPendingWakeupAction); |
| 954 | |
| 955 | if (mBouncer != null) { |
| 956 | mBouncer.dump(pw); |
| 957 | } |
| 958 | } |
| 959 | |
Evan Laird | 878c853 | 2018-10-15 15:54:29 -0400 | [diff] [blame] | 960 | @Override |
| 961 | public void onStateChanged(int newState) { |
Lucas Dupin | 2e838ac | 2019-04-17 16:50:58 -0700 | [diff] [blame] | 962 | updateLockIcon(); |
Evan Laird | 878c853 | 2018-10-15 15:54:29 -0400 | [diff] [blame] | 963 | } |
| 964 | |
| 965 | @Override |
| 966 | public void onDozingChanged(boolean isDozing) { |
| 967 | setDozing(isDozing); |
| 968 | } |
| 969 | |
Lucas Dupin | 407cc58 | 2019-03-11 21:04:31 -0700 | [diff] [blame] | 970 | public KeyguardBouncer getBouncer() { |
| 971 | return mBouncer; |
| 972 | } |
| 973 | |
Adrian Roos | 34e6540 | 2017-08-07 19:32:45 +0200 | [diff] [blame] | 974 | private static class DismissWithActionRequest { |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 975 | final OnDismissAction dismissAction; |
| 976 | final Runnable cancelAction; |
| 977 | final boolean afterKeyguardGone; |
Lucas Dupin | c80c67e | 2017-12-04 14:29:10 -0800 | [diff] [blame] | 978 | final String message; |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 979 | |
Adrian Roos | 34e6540 | 2017-08-07 19:32:45 +0200 | [diff] [blame] | 980 | DismissWithActionRequest(OnDismissAction dismissAction, Runnable cancelAction, |
Lucas Dupin | c80c67e | 2017-12-04 14:29:10 -0800 | [diff] [blame] | 981 | boolean afterKeyguardGone, String message) { |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 982 | this.dismissAction = dismissAction; |
| 983 | this.cancelAction = cancelAction; |
| 984 | this.afterKeyguardGone = afterKeyguardGone; |
Lucas Dupin | c80c67e | 2017-12-04 14:29:10 -0800 | [diff] [blame] | 985 | this.message = message; |
Adrian Roos | fee661c | 2017-08-04 17:05:45 +0200 | [diff] [blame] | 986 | } |
| 987 | } |
Jorim Jaggi | 5cf1787 | 2014-03-26 18:31:48 +0100 | [diff] [blame] | 988 | } |