blob: ca12deb3904eb9849aee8ab07af2bdd46eb11cad [file] [log] [blame]
Adrian Roos12c1ef52014-06-04 13:54:08 +02001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
15 */
16
17package com.android.systemui.statusbar;
18
Beverly8c785892018-01-31 17:25:52 -050019import android.animation.Animator;
20import android.animation.AnimatorListenerAdapter;
Bartosz Fabianowski5f045002016-12-01 10:36:18 +010021import android.app.admin.DevicePolicyManager;
Adrian Roos12c1ef52014-06-04 13:54:08 +020022import android.content.Context;
Jason Chang2386a372018-04-24 16:05:30 +080023import android.content.res.ColorStateList;
Lucas Dupinff6628d2018-10-15 10:12:37 -070024import android.content.res.Resources;
Jorim Jaggi27c9b742015-04-09 10:34:49 -070025import android.graphics.Color;
Lucas Dupinff6628d2018-10-15 10:12:37 -070026import android.hardware.biometrics.BiometricSourceType;
Gilad Brettercb51b8b2018-03-22 17:04:51 +020027import android.hardware.face.FaceManager;
Selim Cinekcfafe4e2015-08-11 14:58:44 -070028import android.hardware.fingerprint.FingerprintManager;
Adrian Roos12c1ef52014-06-04 13:54:08 +020029import android.os.BatteryManager;
30import android.os.BatteryStats;
31import android.os.Handler;
32import android.os.Message;
33import android.os.RemoteException;
34import android.os.ServiceManager;
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -060035import android.os.UserManager;
Adrian Roos12c1ef52014-06-04 13:54:08 +020036import android.text.TextUtils;
37import android.text.format.Formatter;
38import android.util.Log;
39import android.view.View;
Bartosz Fabianowski5f045002016-12-01 10:36:18 +010040import android.view.ViewGroup;
Adrian Roos12c1ef52014-06-04 13:54:08 +020041
Adrian Roosc1b50322017-02-27 21:07:58 +010042import com.android.internal.annotations.VisibleForTesting;
Selim Cinekcfafe4e2015-08-11 14:58:44 -070043import com.android.internal.app.IBatteryStats;
Lucas Dupin2e838ac2019-04-17 16:50:58 -070044import com.android.internal.logging.nano.MetricsProto;
45import com.android.internal.widget.LockPatternUtils;
Lucas Dupineff8ef02019-06-06 11:14:01 -070046import com.android.internal.widget.ViewClippingUtil;
Selim Cinekcfafe4e2015-08-11 14:58:44 -070047import com.android.keyguard.KeyguardUpdateMonitor;
48import com.android.keyguard.KeyguardUpdateMonitorCallback;
Jason Monk58be7a62017-02-01 20:17:51 -050049import com.android.settingslib.Utils;
Jason Monk9c7844c2017-01-18 15:21:53 -050050import com.android.systemui.Dependency;
Beverly8c785892018-01-31 17:25:52 -050051import com.android.systemui.Interpolators;
Selim Cinekcfafe4e2015-08-11 14:58:44 -070052import com.android.systemui.R;
Beverly8fdb5332019-02-04 14:29:49 -050053import com.android.systemui.plugins.statusbar.StatusBarStateController;
54import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
Selim Cinekcfafe4e2015-08-11 14:58:44 -070055import com.android.systemui.statusbar.phone.KeyguardIndicationTextView;
56import com.android.systemui.statusbar.phone.LockIcon;
Lucas Dupin2e838ac2019-04-17 16:50:58 -070057import com.android.systemui.statusbar.phone.LockscreenGestureLogger;
Lucas Dupin0df60fe2019-04-23 10:19:27 -070058import com.android.systemui.statusbar.phone.ShadeController;
Selim Cinekcfafe4e2015-08-11 14:58:44 -070059import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
Lucas Dupin8e2fd012019-04-25 16:40:54 -070060import com.android.systemui.statusbar.phone.UnlockMethodCache;
Lucas Dupin0df60fe2019-04-23 10:19:27 -070061import com.android.systemui.statusbar.policy.AccessibilityController;
Zachary Iqbalf50284c2017-01-22 18:54:46 -080062import com.android.systemui.statusbar.policy.UserInfoController;
Adrian Roosc1b50322017-02-27 21:07:58 +010063import com.android.systemui.util.wakelock.SettableWakeLock;
64import com.android.systemui.util.wakelock.WakeLock;
Selim Cinekcfafe4e2015-08-11 14:58:44 -070065
Lucas Dupin3fcdd472018-01-19 19:06:45 -080066import java.io.FileDescriptor;
67import java.io.PrintWriter;
Lucas Dupin4272f442018-01-13 22:00:35 -080068import java.text.NumberFormat;
Lucas Dupin8d595d22018-03-08 10:34:58 -080069import java.util.IllegalFormatConversionException;
Lucas Dupin4272f442018-01-13 22:00:35 -080070
Adrian Roos12c1ef52014-06-04 13:54:08 +020071/**
Selim Cinekcfafe4e2015-08-11 14:58:44 -070072 * Controls the indications and error messages shown on the Keyguard
Adrian Roos12c1ef52014-06-04 13:54:08 +020073 */
Lucas Dupin8e2fd012019-04-25 16:40:54 -070074public class KeyguardIndicationController implements StateListener,
75 UnlockMethodCache.OnUnlockMethodChangedListener {
Adrian Roos12c1ef52014-06-04 13:54:08 +020076
Adrian Roos0c859ae2015-11-23 16:47:50 -080077 private static final String TAG = "KeyguardIndication";
78 private static final boolean DEBUG_CHARGING_SPEED = false;
Adrian Roos12c1ef52014-06-04 13:54:08 +020079
80 private static final int MSG_HIDE_TRANSIENT = 1;
Gilad Brettercb51b8b2018-03-22 17:04:51 +020081 private static final int MSG_CLEAR_BIOMETRIC_MSG = 2;
82 private static final long TRANSIENT_BIOMETRIC_ERROR_TIMEOUT = 1300;
Adrian Roos12c1ef52014-06-04 13:54:08 +020083
84 private final Context mContext;
Lucas Dupin0df60fe2019-04-23 10:19:27 -070085 private final ShadeController mShadeController;
86 private final AccessibilityController mAccessibilityController;
Lucas Dupin8e2fd012019-04-25 16:40:54 -070087 private final UnlockMethodCache mUnlockMethodCache;
88 private final StatusBarStateController mStatusBarStateController;
89 private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
Lucas Dupin987f1932017-05-13 21:02:52 -070090 private ViewGroup mIndicationArea;
91 private KeyguardIndicationTextView mTextView;
92 private KeyguardIndicationTextView mDisclosure;
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -060093 private final UserManager mUserManager;
Adrian Roos12c1ef52014-06-04 13:54:08 +020094 private final IBatteryStats mBatteryInfo;
Adrian Roosc1b50322017-02-27 21:07:58 +010095 private final SettableWakeLock mWakeLock;
Lucas Dupin2e838ac2019-04-17 16:50:58 -070096 private final LockPatternUtils mLockPatternUtils;
Adrian Roos12c1ef52014-06-04 13:54:08 +020097
Adrian Roos7b043112015-07-10 13:00:33 -070098 private final int mSlowThreshold;
99 private final int mFastThreshold;
Lucas Dupin05904652019-04-09 16:16:15 -0700100 private final LockIcon mLockIcon;
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700101 private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700102 private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger();
Adrian Roos7b043112015-07-10 13:00:33 -0700103
Adrian Roos12c1ef52014-06-04 13:54:08 +0200104 private String mRestingIndication;
Lucas Dupinef886542018-01-03 16:03:07 -0800105 private CharSequence mTransientIndication;
Jason Chang2386a372018-04-24 16:05:30 +0800106 private ColorStateList mTransientTextColorState;
107 private ColorStateList mInitialTextColorState;
Adrian Roos12c1ef52014-06-04 13:54:08 +0200108 private boolean mVisible;
109
110 private boolean mPowerPluggedIn;
Beverly2034c832018-03-19 11:18:51 -0400111 private boolean mPowerPluggedInWired;
Adrian Roos12c1ef52014-06-04 13:54:08 +0200112 private boolean mPowerCharged;
Adrian Roos7b043112015-07-10 13:00:33 -0700113 private int mChargingSpeed;
Adrian Roos0c859ae2015-11-23 16:47:50 -0800114 private int mChargingWattage;
Lucas Dupin4272f442018-01-13 22:00:35 -0800115 private int mBatteryLevel;
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700116 private String mMessageToShowOnScreenOn;
Adrian Roos12c1ef52014-06-04 13:54:08 +0200117
Zachary Iqbal8f4c2422017-04-20 17:56:42 -0700118 private KeyguardUpdateMonitorCallback mUpdateMonitorCallback;
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800119
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100120 private final DevicePolicyManager mDevicePolicyManager;
Adrian Roos91ba3072017-02-14 16:50:46 +0100121 private boolean mDozing;
Lucas Dupineff8ef02019-06-06 11:14:01 -0700122 private final ViewClippingUtil.ClippingParameters mClippingParams =
123 new ViewClippingUtil.ClippingParameters() {
124 @Override
125 public boolean shouldFinish(View view) {
126 return view == mIndicationArea;
127 }
128 };
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100129
Adrian Roosaf45b602017-03-14 13:10:25 -0700130 /**
131 * Creates a new KeyguardIndicationController and registers callbacks.
132 */
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100133 public KeyguardIndicationController(Context context, ViewGroup indicationArea,
134 LockIcon lockIcon) {
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700135 this(context, indicationArea, lockIcon, new LockPatternUtils(context),
Lucas Dupin0df60fe2019-04-23 10:19:27 -0700136 WakeLock.createPartial(context, "Doze:KeyguardIndication"),
137 Dependency.get(ShadeController.class),
Lucas Dupin8e2fd012019-04-25 16:40:54 -0700138 Dependency.get(AccessibilityController.class),
139 UnlockMethodCache.getInstance(context),
140 Dependency.get(StatusBarStateController.class),
141 KeyguardUpdateMonitor.getInstance(context));
Adrian Roosc1b50322017-02-27 21:07:58 +0100142 }
143
Adrian Roosaf45b602017-03-14 13:10:25 -0700144 /**
Lucas Dupin8e2fd012019-04-25 16:40:54 -0700145 * Creates a new KeyguardIndicationController for testing.
Adrian Roosaf45b602017-03-14 13:10:25 -0700146 */
Adrian Roosc1b50322017-02-27 21:07:58 +0100147 @VisibleForTesting
148 KeyguardIndicationController(Context context, ViewGroup indicationArea, LockIcon lockIcon,
Lucas Dupin0df60fe2019-04-23 10:19:27 -0700149 LockPatternUtils lockPatternUtils, WakeLock wakeLock, ShadeController shadeController,
Lucas Dupin8e2fd012019-04-25 16:40:54 -0700150 AccessibilityController accessibilityController, UnlockMethodCache unlockMethodCache,
151 StatusBarStateController statusBarStateController,
152 KeyguardUpdateMonitor keyguardUpdateMonitor) {
Adrian Roos12c1ef52014-06-04 13:54:08 +0200153 mContext = context;
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700154 mLockIcon = lockIcon;
Lucas Dupin0df60fe2019-04-23 10:19:27 -0700155 mShadeController = shadeController;
156 mAccessibilityController = accessibilityController;
Lucas Dupin8e2fd012019-04-25 16:40:54 -0700157 mUnlockMethodCache = unlockMethodCache;
158 mStatusBarStateController = statusBarStateController;
159 mKeyguardUpdateMonitor = keyguardUpdateMonitor;
Brad Stenning691c2742019-04-19 11:48:00 -0700160 // lock icon is not used on all form factors.
161 if (mLockIcon != null) {
Lucas Dupin0df60fe2019-04-23 10:19:27 -0700162 mLockIcon.setOnLongClickListener(this::handleLockLongClick);
163 mLockIcon.setOnClickListener(this::handleLockClick);
Brad Stenning691c2742019-04-19 11:48:00 -0700164 }
Lucas Dupinee4c9b72019-02-18 17:04:58 -0800165 mWakeLock = new SettableWakeLock(wakeLock, TAG);
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700166 mLockPatternUtils = lockPatternUtils;
Adrian Roos12c1ef52014-06-04 13:54:08 +0200167
Adrian Roos7b043112015-07-10 13:00:33 -0700168 Resources res = context.getResources();
169 mSlowThreshold = res.getInteger(R.integer.config_chargingSlowlyThreshold);
170 mFastThreshold = res.getInteger(R.integer.config_chargingFastThreshold);
171
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -0600172 mUserManager = context.getSystemService(UserManager.class);
Adrian Roos12c1ef52014-06-04 13:54:08 +0200173 mBatteryInfo = IBatteryStats.Stub.asInterface(
174 ServiceManager.getService(BatteryStats.SERVICE_NAME));
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -0600175
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100176 mDevicePolicyManager = (DevicePolicyManager) context.getSystemService(
177 Context.DEVICE_POLICY_SERVICE);
Lucas Dupin00ebe132019-04-26 16:17:56 -0700178 setIndicationArea(indicationArea);
Adrian Roosaf45b602017-03-14 13:10:25 -0700179 updateDisclosure();
Adrian Roosaf45b602017-03-14 13:10:25 -0700180
Lucas Dupin8e2fd012019-04-25 16:40:54 -0700181 mKeyguardUpdateMonitor.registerCallback(getKeyguardCallback());
182 mKeyguardUpdateMonitor.registerCallback(mTickReceiver);
183 mStatusBarStateController.addCallback(this);
184 mUnlockMethodCache.addListener(this);
Evan Laird878c8532018-10-15 15:54:29 -0400185 }
186
Lucas Dupin00ebe132019-04-26 16:17:56 -0700187 public void setIndicationArea(ViewGroup indicationArea) {
188 mIndicationArea = indicationArea;
189 mTextView = indicationArea.findViewById(R.id.keyguard_indication_text);
190 mInitialTextColorState = mTextView != null ?
191 mTextView.getTextColors() : ColorStateList.valueOf(Color.WHITE);
192 mDisclosure = indicationArea.findViewById(R.id.keyguard_indication_enterprise_disclosure);
193 updateIndication(false /* animate */);
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100194 }
195
Lucas Dupin0df60fe2019-04-23 10:19:27 -0700196 private boolean handleLockLongClick(View view) {
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700197 mLockscreenGestureLogger.write(MetricsProto.MetricsEvent.ACTION_LS_LOCK,
198 0 /* lengthDp - N/A */, 0 /* velocityDp - N/A */);
199 showTransientIndication(R.string.keyguard_indication_trust_disabled);
Lucas Dupinca88e5f2019-05-14 16:11:08 -0700200 mKeyguardUpdateMonitor.onLockIconPressed();
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700201 mLockPatternUtils.requireCredentialEntry(KeyguardUpdateMonitor.getCurrentUser());
202
203 return true;
204 }
205
Lucas Dupin0df60fe2019-04-23 10:19:27 -0700206 private void handleLockClick(View view) {
207 if (!mAccessibilityController.isAccessibilityEnabled()) {
208 return;
209 }
Lucas Dupind54f00e2019-05-06 17:44:03 -0700210 mShadeController.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE, true /* force */);
Lucas Dupin0df60fe2019-04-23 10:19:27 -0700211 }
212
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800213 /**
214 * Gets the {@link KeyguardUpdateMonitorCallback} instance associated with this
215 * {@link KeyguardIndicationController}.
216 *
217 * <p>Subclasses may override this method to extend or change the callback behavior by extending
218 * the {@link BaseKeyguardCallback}.
219 *
220 * @return A KeyguardUpdateMonitorCallback. Multiple calls to this method <b>must</b> return the
221 * same instance.
222 */
223 protected KeyguardUpdateMonitorCallback getKeyguardCallback() {
Zachary Iqbal8f4c2422017-04-20 17:56:42 -0700224 if (mUpdateMonitorCallback == null) {
225 mUpdateMonitorCallback = new BaseKeyguardCallback();
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800226 }
Zachary Iqbal8f4c2422017-04-20 17:56:42 -0700227 return mUpdateMonitorCallback;
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800228 }
229
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100230 private void updateDisclosure() {
231 if (mDevicePolicyManager == null) {
232 return;
233 }
234
Adrian Roos91ba3072017-02-14 16:50:46 +0100235 if (!mDozing && mDevicePolicyManager.isDeviceManaged()) {
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100236 final CharSequence organizationName =
237 mDevicePolicyManager.getDeviceOwnerOrganizationName();
238 if (organizationName != null) {
239 mDisclosure.switchIndication(mContext.getResources().getString(
240 R.string.do_disclosure_with_name, organizationName));
241 } else {
242 mDisclosure.switchIndication(R.string.do_disclosure_generic);
243 }
244 mDisclosure.setVisibility(View.VISIBLE);
245 } else {
246 mDisclosure.setVisibility(View.GONE);
247 }
Adrian Roos12c1ef52014-06-04 13:54:08 +0200248 }
249
250 public void setVisible(boolean visible) {
251 mVisible = visible;
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100252 mIndicationArea.setVisibility(visible ? View.VISIBLE : View.GONE);
Adrian Roos12c1ef52014-06-04 13:54:08 +0200253 if (visible) {
Kevin Chyn4c4001c2017-08-25 14:23:36 -0700254 // If this is called after an error message was already shown, we should not clear it.
255 // Otherwise the error message won't be shown
256 if (!mHandler.hasMessages(MSG_HIDE_TRANSIENT)) {
257 hideTransientIndication();
258 }
Beverly8c785892018-01-31 17:25:52 -0500259 updateIndication(false);
Kevin Chyn4c4001c2017-08-25 14:23:36 -0700260 } else if (!visible) {
261 // If we unlock and return to keyguard quickly, previous error should not be shown
262 hideTransientIndication();
Adrian Roos12c1ef52014-06-04 13:54:08 +0200263 }
264 }
265
266 /**
267 * Sets the indication that is shown if nothing else is showing.
268 */
269 public void setRestingIndication(String restingIndication) {
270 mRestingIndication = restingIndication;
Beverly8c785892018-01-31 17:25:52 -0500271 updateIndication(false);
Adrian Roos12c1ef52014-06-04 13:54:08 +0200272 }
273
274 /**
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800275 * Sets the active controller managing changes and callbacks to user information.
276 */
277 public void setUserInfoController(UserInfoController userInfoController) {
278 }
279
280 /**
Zachary Iqbal8f4c2422017-04-20 17:56:42 -0700281 * Returns the indication text indicating that trust has been granted.
282 *
283 * @return {@code null} or an empty string if a trust indication text should not be shown.
284 */
Lucas Dupin8e2fd012019-04-25 16:40:54 -0700285 @VisibleForTesting
286 String getTrustGrantedIndication() {
Lucas Dupin859f2c82019-04-17 18:30:00 -0700287 return mContext.getString(R.string.keyguard_indication_trust_unlocked);
Zachary Iqbaldc05aa02017-05-17 18:52:49 -0700288 }
289
290 /**
291 * Returns the indication text indicating that trust is currently being managed.
292 *
293 * @return {@code null} or an empty string if a trust managed text should not be shown.
294 */
Lucas Dupin859f2c82019-04-17 18:30:00 -0700295 private String getTrustManagedIndication() {
Zachary Iqbal8f4c2422017-04-20 17:56:42 -0700296 return null;
297 }
298
299 /**
Adrian Roos12c1ef52014-06-04 13:54:08 +0200300 * Hides transient indication in {@param delayMs}.
301 */
302 public void hideTransientIndicationDelayed(long delayMs) {
303 mHandler.sendMessageDelayed(
304 mHandler.obtainMessage(MSG_HIDE_TRANSIENT), delayMs);
305 }
306
307 /**
308 * Shows {@param transientIndication} until it is hidden by {@link #hideTransientIndication}.
309 */
310 public void showTransientIndication(int transientIndication) {
311 showTransientIndication(mContext.getResources().getString(transientIndication));
312 }
313
314 /**
315 * Shows {@param transientIndication} until it is hidden by {@link #hideTransientIndication}.
316 */
Lucas Dupinef886542018-01-03 16:03:07 -0800317 public void showTransientIndication(CharSequence transientIndication) {
Jason Chang2386a372018-04-24 16:05:30 +0800318 showTransientIndication(transientIndication, mInitialTextColorState);
Jorim Jaggi27c9b742015-04-09 10:34:49 -0700319 }
320
321 /**
322 * Shows {@param transientIndication} until it is hidden by {@link #hideTransientIndication}.
323 */
Jason Chang2386a372018-04-24 16:05:30 +0800324 public void showTransientIndication(CharSequence transientIndication,
325 ColorStateList textColorState) {
Adrian Roos12c1ef52014-06-04 13:54:08 +0200326 mTransientIndication = transientIndication;
Jason Chang2386a372018-04-24 16:05:30 +0800327 mTransientTextColorState = textColorState;
Adrian Roos12c1ef52014-06-04 13:54:08 +0200328 mHandler.removeMessages(MSG_HIDE_TRANSIENT);
Adrian Roosc1b50322017-02-27 21:07:58 +0100329 if (mDozing && !TextUtils.isEmpty(mTransientIndication)) {
330 // Make sure this doesn't get stuck and burns in. Acquire wakelock until its cleared.
331 mWakeLock.setAcquired(true);
332 hideTransientIndicationDelayed(BaseKeyguardCallback.HIDE_DELAY_MS);
333 }
Beverly8c785892018-01-31 17:25:52 -0500334
335 updateIndication(false);
Adrian Roos12c1ef52014-06-04 13:54:08 +0200336 }
337
338 /**
339 * Hides transient indication.
340 */
341 public void hideTransientIndication() {
342 if (mTransientIndication != null) {
343 mTransientIndication = null;
344 mHandler.removeMessages(MSG_HIDE_TRANSIENT);
Beverly8c785892018-01-31 17:25:52 -0500345 updateIndication(false);
Adrian Roos12c1ef52014-06-04 13:54:08 +0200346 }
347 }
348
Beverly8c785892018-01-31 17:25:52 -0500349 protected final void updateIndication(boolean animate) {
Adrian Roosc1b50322017-02-27 21:07:58 +0100350 if (TextUtils.isEmpty(mTransientIndication)) {
351 mWakeLock.setAcquired(false);
352 }
353
Adrian Roos12c1ef52014-06-04 13:54:08 +0200354 if (mVisible) {
Lucas Dupin53d50622017-05-13 15:54:14 -0700355 // Walk down a precedence-ordered list of what indication
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -0600356 // should be shown based on user or device state
Lucas Dupinff6628d2018-10-15 10:12:37 -0700357 if (mDozing) {
Lucas Dupin07ed3df2019-03-26 21:23:59 -0700358 // When dozing we ignore any text color and use white instead, because
359 // colors can be hard to read in low brightness.
360 mTextView.setTextColor(Color.WHITE);
Lucas Dupinff6628d2018-10-15 10:12:37 -0700361 if (!TextUtils.isEmpty(mTransientIndication)) {
Lucas Dupinff6628d2018-10-15 10:12:37 -0700362 mTextView.switchIndication(mTransientIndication);
Lucas Dupin07ed3df2019-03-26 21:23:59 -0700363 } else if (mPowerPluggedIn) {
364 String indication = computePowerIndication();
365 if (animate) {
366 animateText(mTextView, indication);
367 } else {
368 mTextView.switchIndication(indication);
369 }
370 } else {
371 String percentage = NumberFormat.getPercentInstance()
372 .format(mBatteryLevel / 100f);
373 mTextView.switchIndication(percentage);
Lucas Dupinff6628d2018-10-15 10:12:37 -0700374 }
Lucas Dupinff6628d2018-10-15 10:12:37 -0700375 return;
376 }
377
Jorim Jaggifabc7432017-05-15 02:40:05 +0200378 int userId = KeyguardUpdateMonitor.getCurrentUser();
Zachary Iqbaldc05aa02017-05-17 18:52:49 -0700379 String trustGrantedIndication = getTrustGrantedIndication();
380 String trustManagedIndication = getTrustManagedIndication();
Zachary Iqbal8f4c2422017-04-20 17:56:42 -0700381 if (!mUserManager.isUserUnlocked(userId)) {
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -0600382 mTextView.switchIndication(com.android.internal.R.string.lockscreen_storage_locked);
Jason Chang2386a372018-04-24 16:05:30 +0800383 mTextView.setTextColor(mInitialTextColorState);
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -0600384 } else if (!TextUtils.isEmpty(mTransientIndication)) {
385 mTextView.switchIndication(mTransientIndication);
Jason Chang2386a372018-04-24 16:05:30 +0800386 mTextView.setTextColor(mTransientTextColorState);
Zachary Iqbaldc05aa02017-05-17 18:52:49 -0700387 } else if (!TextUtils.isEmpty(trustGrantedIndication)
Lucas Dupin8e2fd012019-04-25 16:40:54 -0700388 && mKeyguardUpdateMonitor.getUserHasTrust(userId)) {
Zachary Iqbaldc05aa02017-05-17 18:52:49 -0700389 mTextView.switchIndication(trustGrantedIndication);
Jason Chang2386a372018-04-24 16:05:30 +0800390 mTextView.setTextColor(mInitialTextColorState);
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -0600391 } else if (mPowerPluggedIn) {
392 String indication = computePowerIndication();
393 if (DEBUG_CHARGING_SPEED) {
394 indication += ", " + (mChargingWattage / 1000) + " mW";
395 }
Jason Chang2386a372018-04-24 16:05:30 +0800396 mTextView.setTextColor(mInitialTextColorState);
Beverly85499d92018-02-14 15:55:16 -0500397 if (animate) {
398 animateText(mTextView, indication);
399 } else {
400 mTextView.switchIndication(indication);
401 }
Zachary Iqbaldc05aa02017-05-17 18:52:49 -0700402 } else if (!TextUtils.isEmpty(trustManagedIndication)
Lucas Dupin8e2fd012019-04-25 16:40:54 -0700403 && mKeyguardUpdateMonitor.getUserTrustIsManaged(userId)
404 && !mKeyguardUpdateMonitor.getUserHasTrust(userId)) {
Zachary Iqbaldc05aa02017-05-17 18:52:49 -0700405 mTextView.switchIndication(trustManagedIndication);
Jason Chang2386a372018-04-24 16:05:30 +0800406 mTextView.setTextColor(mInitialTextColorState);
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -0600407 } else {
408 mTextView.switchIndication(mRestingIndication);
Jason Chang2386a372018-04-24 16:05:30 +0800409 mTextView.setTextColor(mInitialTextColorState);
Adrian Roos7b043112015-07-10 13:00:33 -0700410 }
Adrian Roos12c1ef52014-06-04 13:54:08 +0200411 }
Adrian Roos12c1ef52014-06-04 13:54:08 +0200412 }
413
Beverly85499d92018-02-14 15:55:16 -0500414 // animates textView - textView moves up and bounces down
415 private void animateText(KeyguardIndicationTextView textView, String indication) {
416 int yTranslation = mContext.getResources().getInteger(
417 R.integer.wired_charging_keyguard_text_animation_distance);
418 int animateUpDuration = mContext.getResources().getInteger(
419 R.integer.wired_charging_keyguard_text_animation_duration_up);
420 int animateDownDuration = mContext.getResources().getInteger(
421 R.integer.wired_charging_keyguard_text_animation_duration_down);
Lucas Dupindef43692018-07-02 15:22:58 -0700422 textView.animate().cancel();
423 float translation = textView.getTranslationY();
Lucas Dupineff8ef02019-06-06 11:14:01 -0700424 ViewClippingUtil.setClippingDeactivated(textView, true, mClippingParams);
Beverly85499d92018-02-14 15:55:16 -0500425 textView.animate()
426 .translationYBy(yTranslation)
427 .setInterpolator(Interpolators.LINEAR)
428 .setDuration(animateUpDuration)
429 .setListener(new AnimatorListenerAdapter() {
Lucas Dupindef43692018-07-02 15:22:58 -0700430 private boolean mCancelled;
431
Beverly85499d92018-02-14 15:55:16 -0500432 @Override
433 public void onAnimationStart(Animator animation) {
434 textView.switchIndication(indication);
435 }
Lucas Dupindef43692018-07-02 15:22:58 -0700436
437 @Override
438 public void onAnimationCancel(Animator animation) {
439 textView.setTranslationY(translation);
440 mCancelled = true;
441 }
442
Beverly85499d92018-02-14 15:55:16 -0500443 @Override
444 public void onAnimationEnd(Animator animation) {
Lucas Dupindef43692018-07-02 15:22:58 -0700445 if (mCancelled) {
Lucas Dupineff8ef02019-06-06 11:14:01 -0700446 ViewClippingUtil.setClippingDeactivated(textView, false,
447 mClippingParams);
Lucas Dupindef43692018-07-02 15:22:58 -0700448 return;
449 }
Beverly85499d92018-02-14 15:55:16 -0500450 textView.animate()
451 .setDuration(animateDownDuration)
452 .setInterpolator(Interpolators.BOUNCE)
Lucas Dupindef43692018-07-02 15:22:58 -0700453 .translationY(translation)
454 .setListener(new AnimatorListenerAdapter() {
455 @Override
456 public void onAnimationCancel(Animator animation) {
457 textView.setTranslationY(translation);
458 }
Lucas Dupineff8ef02019-06-06 11:14:01 -0700459
460 @Override
461 public void onAnimationEnd(Animator animation) {
462 ViewClippingUtil.setClippingDeactivated(textView, false,
463 mClippingParams);
464 }
Lucas Dupindef43692018-07-02 15:22:58 -0700465 });
Beverly85499d92018-02-14 15:55:16 -0500466 }
467 });
468 }
469
Adrian Roos12c1ef52014-06-04 13:54:08 +0200470 private String computePowerIndication() {
471 if (mPowerCharged) {
472 return mContext.getResources().getString(R.string.keyguard_charged);
473 }
474
475 // Try fetching charging time from battery stats.
Adrian Roos7e39e592015-09-23 17:03:47 -0700476 long chargingTimeRemaining = 0;
Adrian Roos12c1ef52014-06-04 13:54:08 +0200477 try {
Adrian Roos7e39e592015-09-23 17:03:47 -0700478 chargingTimeRemaining = mBatteryInfo.computeChargeTimeRemaining();
479
Adrian Roos12c1ef52014-06-04 13:54:08 +0200480 } catch (RemoteException e) {
481 Log.e(TAG, "Error calling IBatteryStats: ", e);
482 }
Adrian Roos7e39e592015-09-23 17:03:47 -0700483 final boolean hasChargingTime = chargingTimeRemaining > 0;
Adrian Roos12c1ef52014-06-04 13:54:08 +0200484
Adrian Roos7b043112015-07-10 13:00:33 -0700485 int chargingId;
Beverly7d7f6992019-02-11 13:58:27 -0500486 if (mPowerPluggedInWired) {
487 switch (mChargingSpeed) {
488 case KeyguardUpdateMonitor.BatteryStatus.CHARGING_FAST:
489 chargingId = hasChargingTime
490 ? R.string.keyguard_indication_charging_time_fast
491 : R.string.keyguard_plugged_in_charging_fast;
492 break;
493 case KeyguardUpdateMonitor.BatteryStatus.CHARGING_SLOWLY:
494 chargingId = hasChargingTime
495 ? R.string.keyguard_indication_charging_time_slowly
496 : R.string.keyguard_plugged_in_charging_slowly;
497 break;
498 default:
499 chargingId = hasChargingTime
500 ? R.string.keyguard_indication_charging_time
501 : R.string.keyguard_plugged_in;
502 break;
503 }
504 } else {
505 chargingId = hasChargingTime
506 ? R.string.keyguard_indication_charging_time_wireless
507 : R.string.keyguard_plugged_in_wireless;
Adrian Roos7b043112015-07-10 13:00:33 -0700508 }
Adrian Roos7e39e592015-09-23 17:03:47 -0700509
Lucas Dupin8d595d22018-03-08 10:34:58 -0800510 String percentage = NumberFormat.getPercentInstance()
511 .format(mBatteryLevel / 100f);
Adrian Roos7e39e592015-09-23 17:03:47 -0700512 if (hasChargingTime) {
Lucas Dupin8d595d22018-03-08 10:34:58 -0800513 // We now have battery percentage in these strings and it's expected that all
514 // locales will also have it in the future. For now, we still have to support the old
515 // format until all languages get the new translations.
Adrian Roos7e39e592015-09-23 17:03:47 -0700516 String chargingTimeFormatted = Formatter.formatShortElapsedTimeRoundingUpToMinutes(
517 mContext, chargingTimeRemaining);
Lucas Dupin8d595d22018-03-08 10:34:58 -0800518 try {
519 return mContext.getResources().getString(chargingId, chargingTimeFormatted,
520 percentage);
521 } catch (IllegalFormatConversionException e) {
522 return mContext.getResources().getString(chargingId, chargingTimeFormatted);
523 }
Adrian Roos7e39e592015-09-23 17:03:47 -0700524 } else {
Lucas Dupin8d595d22018-03-08 10:34:58 -0800525 // Same as above
526 try {
527 return mContext.getResources().getString(chargingId, percentage);
528 } catch (IllegalFormatConversionException e) {
529 return mContext.getResources().getString(chargingId);
530 }
Adrian Roos7e39e592015-09-23 17:03:47 -0700531 }
Adrian Roos12c1ef52014-06-04 13:54:08 +0200532 }
533
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800534 public void setStatusBarKeyguardViewManager(
535 StatusBarKeyguardViewManager statusBarKeyguardViewManager) {
536 mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
537 }
538
Lucas Dupin7e171e22018-12-20 11:29:35 -0800539 private final KeyguardUpdateMonitorCallback mTickReceiver =
540 new KeyguardUpdateMonitorCallback() {
541 @Override
542 public void onTimeChanged() {
543 if (mVisible) {
544 updateIndication(false /* animate */);
545 }
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800546 }
Lucas Dupin7e171e22018-12-20 11:29:35 -0800547 };
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800548
549 private final Handler mHandler = new Handler() {
550 @Override
551 public void handleMessage(Message msg) {
Adrian Roosc1b50322017-02-27 21:07:58 +0100552 if (msg.what == MSG_HIDE_TRANSIENT) {
553 hideTransientIndication();
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200554 } else if (msg.what == MSG_CLEAR_BIOMETRIC_MSG) {
Lucas Dupinc9e5d762019-01-28 09:34:30 -0800555 mLockIcon.setTransientBiometricsError(false);
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800556 }
557 }
558 };
559
Adrian Roos91ba3072017-02-14 16:50:46 +0100560 public void setDozing(boolean dozing) {
Jorim Jaggifabc7432017-05-15 02:40:05 +0200561 if (mDozing == dozing) {
562 return;
563 }
Adrian Roos91ba3072017-02-14 16:50:46 +0100564 mDozing = dozing;
Beverly8c785892018-01-31 17:25:52 -0500565 updateIndication(false);
Adrian Roos91ba3072017-02-14 16:50:46 +0100566 updateDisclosure();
567 }
568
Lucas Dupin3fcdd472018-01-19 19:06:45 -0800569 public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
570 pw.println("KeyguardIndicationController:");
Jason Chang2386a372018-04-24 16:05:30 +0800571 pw.println(" mTransientTextColorState: " + mTransientTextColorState);
572 pw.println(" mInitialTextColorState: " + mInitialTextColorState);
Beverly2034c832018-03-19 11:18:51 -0400573 pw.println(" mPowerPluggedInWired: " + mPowerPluggedInWired);
Lucas Dupin3fcdd472018-01-19 19:06:45 -0800574 pw.println(" mPowerPluggedIn: " + mPowerPluggedIn);
575 pw.println(" mPowerCharged: " + mPowerCharged);
576 pw.println(" mChargingSpeed: " + mChargingSpeed);
577 pw.println(" mChargingWattage: " + mChargingWattage);
578 pw.println(" mMessageToShowOnScreenOn: " + mMessageToShowOnScreenOn);
579 pw.println(" mDozing: " + mDozing);
580 pw.println(" mBatteryLevel: " + mBatteryLevel);
581 pw.println(" mTextView.getText(): " + (mTextView == null ? null : mTextView.getText()));
582 pw.println(" computePowerIndication(): " + computePowerIndication());
583 }
584
Evan Laird878c8532018-10-15 15:54:29 -0400585 @Override
586 public void onStateChanged(int newState) {
587 // don't care
588 }
589
590 @Override
591 public void onDozingChanged(boolean isDozing) {
592 setDozing(isDozing);
593 }
594
Lucas Dupin8e2fd012019-04-25 16:40:54 -0700595 @Override
596 public void onUnlockMethodStateChanged() {
597 updateIndication(!mDozing);
598 }
599
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800600 protected class BaseKeyguardCallback extends KeyguardUpdateMonitorCallback {
Adrian Roos56021892017-02-27 20:25:09 +0100601 public static final int HIDE_DELAY_MS = 5000;
Selim Cinek3e451942016-07-14 18:07:53 -0700602
Adrian Roos12c1ef52014-06-04 13:54:08 +0200603 @Override
604 public void onRefreshBatteryInfo(KeyguardUpdateMonitor.BatteryStatus status) {
Adrian Roosad3bc7f2014-10-30 18:29:38 +0100605 boolean isChargingOrFull = status.status == BatteryManager.BATTERY_STATUS_CHARGING
Adrian Roos12c1ef52014-06-04 13:54:08 +0200606 || status.status == BatteryManager.BATTERY_STATUS_FULL;
Adrian Roos56021892017-02-27 20:25:09 +0100607 boolean wasPluggedIn = mPowerPluggedIn;
Beverly2034c832018-03-19 11:18:51 -0400608 mPowerPluggedInWired = status.isPluggedInWired() && isChargingOrFull;
Adrian Roosad3bc7f2014-10-30 18:29:38 +0100609 mPowerPluggedIn = status.isPluggedIn() && isChargingOrFull;
Adrian Roos12c1ef52014-06-04 13:54:08 +0200610 mPowerCharged = status.isCharged();
Adrian Roos0c859ae2015-11-23 16:47:50 -0800611 mChargingWattage = status.maxChargingWattage;
Adrian Roos7b043112015-07-10 13:00:33 -0700612 mChargingSpeed = status.getChargingSpeed(mSlowThreshold, mFastThreshold);
Lucas Dupin4272f442018-01-13 22:00:35 -0800613 mBatteryLevel = status.level;
Beverly2034c832018-03-19 11:18:51 -0400614 updateIndication(!wasPluggedIn && mPowerPluggedInWired);
Adrian Roosc1b50322017-02-27 21:07:58 +0100615 if (mDozing) {
616 if (!wasPluggedIn && mPowerPluggedIn) {
617 showTransientIndication(computePowerIndication());
618 hideTransientIndicationDelayed(HIDE_DELAY_MS);
619 } else if (wasPluggedIn && !mPowerPluggedIn) {
620 hideTransientIndication();
621 }
Adrian Roos56021892017-02-27 20:25:09 +0100622 }
Adrian Roos12c1ef52014-06-04 13:54:08 +0200623 }
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700624
625 @Override
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100626 public void onKeyguardVisibilityChanged(boolean showing) {
627 if (showing) {
628 updateDisclosure();
629 }
630 }
631
632 @Override
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200633 public void onBiometricHelp(int msgId, String helpString,
634 BiometricSourceType biometricSourceType) {
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700635 KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200636 if (!updateMonitor.isUnlockingWithBiometricAllowed()) {
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700637 return;
638 }
Lucas Dupine54ad1d2019-04-09 17:08:46 -0700639 animatePadlockError();
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700640 if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
Jason Chang2386a372018-04-24 16:05:30 +0800641 mStatusBarKeyguardViewManager.showBouncerMessage(helpString,
Lucas Dupinc2d11b32019-03-06 16:02:18 -0800642 mInitialTextColorState);
Kevin Chyn4c4001c2017-08-25 14:23:36 -0700643 } else if (updateMonitor.isScreenOn()) {
Lucas Dupinc2d11b32019-03-06 16:02:18 -0800644 showTransientIndication(helpString);
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200645 hideTransientIndicationDelayed(TRANSIENT_BIOMETRIC_ERROR_TIMEOUT);
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700646 }
647 }
648
649 @Override
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200650 public void onBiometricError(int msgId, String errString,
651 BiometricSourceType biometricSourceType) {
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700652 KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200653 if (shouldSuppressBiometricError(msgId, biometricSourceType, updateMonitor)) {
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700654 return;
655 }
Lucas Dupine54ad1d2019-04-09 17:08:46 -0700656 animatePadlockError();
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700657 if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
Lucas Dupine54ad1d2019-04-09 17:08:46 -0700658 mStatusBarKeyguardViewManager.showBouncerMessage(errString, mInitialTextColorState);
Kevin Chyn4c4001c2017-08-25 14:23:36 -0700659 } else if (updateMonitor.isScreenOn()) {
Lucas Dupinc2d11b32019-03-06 16:02:18 -0800660 showTransientIndication(errString);
Selim Cinek3e451942016-07-14 18:07:53 -0700661 // We want to keep this message around in case the screen was off
Adrian Roos56021892017-02-27 20:25:09 +0100662 hideTransientIndicationDelayed(HIDE_DELAY_MS);
Selim Cinek3e451942016-07-14 18:07:53 -0700663 } else {
664 mMessageToShowOnScreenOn = errString;
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700665 }
Lucas Dupine54ad1d2019-04-09 17:08:46 -0700666 }
667
668 private void animatePadlockError() {
669 mLockIcon.setTransientBiometricsError(true);
670 mHandler.removeMessages(MSG_CLEAR_BIOMETRIC_MSG);
671 mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_CLEAR_BIOMETRIC_MSG),
672 TRANSIENT_BIOMETRIC_ERROR_TIMEOUT);
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700673 }
674
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200675 private boolean shouldSuppressBiometricError(int msgId,
676 BiometricSourceType biometricSourceType, KeyguardUpdateMonitor updateMonitor) {
677 if (biometricSourceType == BiometricSourceType.FINGERPRINT)
678 return shouldSuppressFingerprintError(msgId, updateMonitor);
679 if (biometricSourceType == BiometricSourceType.FACE)
680 return shouldSuppressFaceError(msgId, updateMonitor);
681 return false;
682 }
683
684 private boolean shouldSuppressFingerprintError(int msgId,
685 KeyguardUpdateMonitor updateMonitor) {
686 return ((!updateMonitor.isUnlockingWithBiometricAllowed()
687 && msgId != FingerprintManager.FINGERPRINT_ERROR_LOCKOUT_PERMANENT)
688 || msgId == FingerprintManager.FINGERPRINT_ERROR_CANCELED);
689 }
690
691 private boolean shouldSuppressFaceError(int msgId, KeyguardUpdateMonitor updateMonitor) {
692 return ((!updateMonitor.isUnlockingWithBiometricAllowed()
693 && msgId != FaceManager.FACE_ERROR_LOCKOUT_PERMANENT)
694 || msgId == FaceManager.FACE_ERROR_CANCELED);
695 }
696
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700697 @Override
Lucas Dupinef886542018-01-03 16:03:07 -0800698 public void onTrustAgentErrorMessage(CharSequence message) {
Jason Chang2386a372018-04-24 16:05:30 +0800699 showTransientIndication(message, Utils.getColorError(mContext));
Lucas Dupinef886542018-01-03 16:03:07 -0800700 }
701
702 @Override
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700703 public void onScreenTurnedOn() {
704 if (mMessageToShowOnScreenOn != null) {
Jason Chang2386a372018-04-24 16:05:30 +0800705 showTransientIndication(mMessageToShowOnScreenOn, Utils.getColorError(mContext));
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700706 // We want to keep this message around in case the screen was off
Adrian Roos56021892017-02-27 20:25:09 +0100707 hideTransientIndicationDelayed(HIDE_DELAY_MS);
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700708 mMessageToShowOnScreenOn = null;
709 }
710 }
711
712 @Override
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200713 public void onBiometricRunningStateChanged(boolean running,
714 BiometricSourceType biometricSourceType) {
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700715 if (running) {
Lucas Dupin8f3faac2019-03-12 15:28:49 -0700716 // Let's hide any previous messages when authentication starts, otherwise
717 // multiple auth attempts would overlap.
718 hideTransientIndication();
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700719 mMessageToShowOnScreenOn = null;
720 }
721 }
Selim Cinek3e451942016-07-14 18:07:53 -0700722
723 @Override
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200724 public void onBiometricAuthenticated(int userId, BiometricSourceType biometricSourceType) {
725 super.onBiometricAuthenticated(userId, biometricSourceType);
Kevin Chyn6d793bd2019-03-27 15:36:13 -0700726 mHandler.sendEmptyMessage(MSG_HIDE_TRANSIENT);
Selim Cinek3e451942016-07-14 18:07:53 -0700727 }
728
729 @Override
Jorim Jaggidadafd42016-09-30 07:20:25 -0700730 public void onUserUnlocked() {
731 if (mVisible) {
Beverly8c785892018-01-31 17:25:52 -0500732 updateIndication(false);
Jorim Jaggidadafd42016-09-30 07:20:25 -0700733 }
734 }
Lucas Dupin05904652019-04-09 16:16:15 -0700735
736 @Override
737 public void onKeyguardBouncerChanged(boolean bouncer) {
Brad Stenning8fcd8b42019-04-22 09:30:20 -0700738 if (mLockIcon == null) {
739 return;
740 }
Lucas Dupin05904652019-04-09 16:16:15 -0700741 mLockIcon.setBouncerVisible(bouncer);
742 }
Adrian Roos12c1ef52014-06-04 13:54:08 +0200743 };
Adrian Roos12c1ef52014-06-04 13:54:08 +0200744}