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