blob: fd76a79eab2ef8083861b622a2c9167f3b5c51dd [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;
Selim Cinekcfafe4e2015-08-11 14:58:44 -070046import com.android.keyguard.KeyguardUpdateMonitor;
47import com.android.keyguard.KeyguardUpdateMonitorCallback;
Jason Monk58be7a62017-02-01 20:17:51 -050048import com.android.settingslib.Utils;
Jason Monk9c7844c2017-01-18 15:21:53 -050049import com.android.systemui.Dependency;
Beverly8c785892018-01-31 17:25:52 -050050import com.android.systemui.Interpolators;
Selim Cinekcfafe4e2015-08-11 14:58:44 -070051import com.android.systemui.R;
Beverly8fdb5332019-02-04 14:29:49 -050052import com.android.systemui.plugins.statusbar.StatusBarStateController;
53import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
Selim Cinekcfafe4e2015-08-11 14:58:44 -070054import com.android.systemui.statusbar.phone.KeyguardIndicationTextView;
55import com.android.systemui.statusbar.phone.LockIcon;
Lucas Dupin2e838ac2019-04-17 16:50:58 -070056import com.android.systemui.statusbar.phone.LockscreenGestureLogger;
Lucas Dupin0df60fe2019-04-23 10:19:27 -070057import com.android.systemui.statusbar.phone.ShadeController;
Selim Cinekcfafe4e2015-08-11 14:58:44 -070058import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
Lucas Dupin8e2fd012019-04-25 16:40:54 -070059import com.android.systemui.statusbar.phone.UnlockMethodCache;
Lucas Dupin0df60fe2019-04-23 10:19:27 -070060import com.android.systemui.statusbar.policy.AccessibilityController;
Zachary Iqbalf50284c2017-01-22 18:54:46 -080061import com.android.systemui.statusbar.policy.UserInfoController;
Adrian Roosc1b50322017-02-27 21:07:58 +010062import com.android.systemui.util.wakelock.SettableWakeLock;
63import com.android.systemui.util.wakelock.WakeLock;
Selim Cinekcfafe4e2015-08-11 14:58:44 -070064
Lucas Dupin3fcdd472018-01-19 19:06:45 -080065import java.io.FileDescriptor;
66import java.io.PrintWriter;
Lucas Dupin4272f442018-01-13 22:00:35 -080067import java.text.NumberFormat;
Lucas Dupin8d595d22018-03-08 10:34:58 -080068import java.util.IllegalFormatConversionException;
Lucas Dupin4272f442018-01-13 22:00:35 -080069
Adrian Roos12c1ef52014-06-04 13:54:08 +020070/**
Selim Cinekcfafe4e2015-08-11 14:58:44 -070071 * Controls the indications and error messages shown on the Keyguard
Adrian Roos12c1ef52014-06-04 13:54:08 +020072 */
Lucas Dupin8e2fd012019-04-25 16:40:54 -070073public class KeyguardIndicationController implements StateListener,
74 UnlockMethodCache.OnUnlockMethodChangedListener {
Adrian Roos12c1ef52014-06-04 13:54:08 +020075
Adrian Roos0c859ae2015-11-23 16:47:50 -080076 private static final String TAG = "KeyguardIndication";
77 private static final boolean DEBUG_CHARGING_SPEED = false;
Adrian Roos12c1ef52014-06-04 13:54:08 +020078
79 private static final int MSG_HIDE_TRANSIENT = 1;
Gilad Brettercb51b8b2018-03-22 17:04:51 +020080 private static final int MSG_CLEAR_BIOMETRIC_MSG = 2;
81 private static final long TRANSIENT_BIOMETRIC_ERROR_TIMEOUT = 1300;
Adrian Roos12c1ef52014-06-04 13:54:08 +020082
83 private final Context mContext;
Lucas Dupin0df60fe2019-04-23 10:19:27 -070084 private final ShadeController mShadeController;
85 private final AccessibilityController mAccessibilityController;
Lucas Dupin8e2fd012019-04-25 16:40:54 -070086 private final UnlockMethodCache mUnlockMethodCache;
87 private final StatusBarStateController mStatusBarStateController;
88 private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
Lucas Dupin987f1932017-05-13 21:02:52 -070089 private ViewGroup mIndicationArea;
90 private KeyguardIndicationTextView mTextView;
91 private KeyguardIndicationTextView mDisclosure;
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -060092 private final UserManager mUserManager;
Adrian Roos12c1ef52014-06-04 13:54:08 +020093 private final IBatteryStats mBatteryInfo;
Adrian Roosc1b50322017-02-27 21:07:58 +010094 private final SettableWakeLock mWakeLock;
Lucas Dupin2e838ac2019-04-17 16:50:58 -070095 private final LockPatternUtils mLockPatternUtils;
Adrian Roos12c1ef52014-06-04 13:54:08 +020096
Adrian Roos7b043112015-07-10 13:00:33 -070097 private final int mSlowThreshold;
98 private final int mFastThreshold;
Lucas Dupin05904652019-04-09 16:16:15 -070099 private final LockIcon mLockIcon;
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700100 private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700101 private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger();
Adrian Roos7b043112015-07-10 13:00:33 -0700102
Adrian Roos12c1ef52014-06-04 13:54:08 +0200103 private String mRestingIndication;
Lucas Dupinef886542018-01-03 16:03:07 -0800104 private CharSequence mTransientIndication;
Jason Chang2386a372018-04-24 16:05:30 +0800105 private ColorStateList mTransientTextColorState;
106 private ColorStateList mInitialTextColorState;
Adrian Roos12c1ef52014-06-04 13:54:08 +0200107 private boolean mVisible;
108
109 private boolean mPowerPluggedIn;
Beverly2034c832018-03-19 11:18:51 -0400110 private boolean mPowerPluggedInWired;
Adrian Roos12c1ef52014-06-04 13:54:08 +0200111 private boolean mPowerCharged;
Adrian Roos7b043112015-07-10 13:00:33 -0700112 private int mChargingSpeed;
Adrian Roos0c859ae2015-11-23 16:47:50 -0800113 private int mChargingWattage;
Lucas Dupin4272f442018-01-13 22:00:35 -0800114 private int mBatteryLevel;
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700115 private String mMessageToShowOnScreenOn;
Adrian Roos12c1ef52014-06-04 13:54:08 +0200116
Zachary Iqbal8f4c2422017-04-20 17:56:42 -0700117 private KeyguardUpdateMonitorCallback mUpdateMonitorCallback;
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800118
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100119 private final DevicePolicyManager mDevicePolicyManager;
Adrian Roos91ba3072017-02-14 16:50:46 +0100120 private boolean mDozing;
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100121
Adrian Roosaf45b602017-03-14 13:10:25 -0700122 /**
123 * Creates a new KeyguardIndicationController and registers callbacks.
124 */
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100125 public KeyguardIndicationController(Context context, ViewGroup indicationArea,
126 LockIcon lockIcon) {
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700127 this(context, indicationArea, lockIcon, new LockPatternUtils(context),
Lucas Dupin0df60fe2019-04-23 10:19:27 -0700128 WakeLock.createPartial(context, "Doze:KeyguardIndication"),
129 Dependency.get(ShadeController.class),
Lucas Dupin8e2fd012019-04-25 16:40:54 -0700130 Dependency.get(AccessibilityController.class),
131 UnlockMethodCache.getInstance(context),
132 Dependency.get(StatusBarStateController.class),
133 KeyguardUpdateMonitor.getInstance(context));
Adrian Roosc1b50322017-02-27 21:07:58 +0100134 }
135
Adrian Roosaf45b602017-03-14 13:10:25 -0700136 /**
Lucas Dupin8e2fd012019-04-25 16:40:54 -0700137 * Creates a new KeyguardIndicationController for testing.
Adrian Roosaf45b602017-03-14 13:10:25 -0700138 */
Adrian Roosc1b50322017-02-27 21:07:58 +0100139 @VisibleForTesting
140 KeyguardIndicationController(Context context, ViewGroup indicationArea, LockIcon lockIcon,
Lucas Dupin0df60fe2019-04-23 10:19:27 -0700141 LockPatternUtils lockPatternUtils, WakeLock wakeLock, ShadeController shadeController,
Lucas Dupin8e2fd012019-04-25 16:40:54 -0700142 AccessibilityController accessibilityController, UnlockMethodCache unlockMethodCache,
143 StatusBarStateController statusBarStateController,
144 KeyguardUpdateMonitor keyguardUpdateMonitor) {
Adrian Roos12c1ef52014-06-04 13:54:08 +0200145 mContext = context;
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700146 mLockIcon = lockIcon;
Lucas Dupin0df60fe2019-04-23 10:19:27 -0700147 mShadeController = shadeController;
148 mAccessibilityController = accessibilityController;
Lucas Dupin8e2fd012019-04-25 16:40:54 -0700149 mUnlockMethodCache = unlockMethodCache;
150 mStatusBarStateController = statusBarStateController;
151 mKeyguardUpdateMonitor = keyguardUpdateMonitor;
Brad Stenning691c2742019-04-19 11:48:00 -0700152 // lock icon is not used on all form factors.
153 if (mLockIcon != null) {
Lucas Dupin0df60fe2019-04-23 10:19:27 -0700154 mLockIcon.setOnLongClickListener(this::handleLockLongClick);
155 mLockIcon.setOnClickListener(this::handleLockClick);
Brad Stenning691c2742019-04-19 11:48:00 -0700156 }
Lucas Dupinee4c9b72019-02-18 17:04:58 -0800157 mWakeLock = new SettableWakeLock(wakeLock, TAG);
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700158 mLockPatternUtils = lockPatternUtils;
Adrian Roos12c1ef52014-06-04 13:54:08 +0200159
Adrian Roos7b043112015-07-10 13:00:33 -0700160 Resources res = context.getResources();
161 mSlowThreshold = res.getInteger(R.integer.config_chargingSlowlyThreshold);
162 mFastThreshold = res.getInteger(R.integer.config_chargingFastThreshold);
163
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -0600164 mUserManager = context.getSystemService(UserManager.class);
Adrian Roos12c1ef52014-06-04 13:54:08 +0200165 mBatteryInfo = IBatteryStats.Stub.asInterface(
166 ServiceManager.getService(BatteryStats.SERVICE_NAME));
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -0600167
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100168 mDevicePolicyManager = (DevicePolicyManager) context.getSystemService(
169 Context.DEVICE_POLICY_SERVICE);
Lucas Dupin00ebe132019-04-26 16:17:56 -0700170 setIndicationArea(indicationArea);
Adrian Roosaf45b602017-03-14 13:10:25 -0700171 updateDisclosure();
Adrian Roosaf45b602017-03-14 13:10:25 -0700172
Lucas Dupin8e2fd012019-04-25 16:40:54 -0700173 mKeyguardUpdateMonitor.registerCallback(getKeyguardCallback());
174 mKeyguardUpdateMonitor.registerCallback(mTickReceiver);
175 mStatusBarStateController.addCallback(this);
176 mUnlockMethodCache.addListener(this);
Evan Laird878c8532018-10-15 15:54:29 -0400177 }
178
Lucas Dupin00ebe132019-04-26 16:17:56 -0700179 public void setIndicationArea(ViewGroup indicationArea) {
180 mIndicationArea = indicationArea;
181 mTextView = indicationArea.findViewById(R.id.keyguard_indication_text);
182 mInitialTextColorState = mTextView != null ?
183 mTextView.getTextColors() : ColorStateList.valueOf(Color.WHITE);
184 mDisclosure = indicationArea.findViewById(R.id.keyguard_indication_enterprise_disclosure);
185 updateIndication(false /* animate */);
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100186 }
187
Lucas Dupin0df60fe2019-04-23 10:19:27 -0700188 private boolean handleLockLongClick(View view) {
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700189 mLockscreenGestureLogger.write(MetricsProto.MetricsEvent.ACTION_LS_LOCK,
190 0 /* lengthDp - N/A */, 0 /* velocityDp - N/A */);
191 showTransientIndication(R.string.keyguard_indication_trust_disabled);
Lucas Dupinca88e5f2019-05-14 16:11:08 -0700192 mKeyguardUpdateMonitor.onLockIconPressed();
Lucas Dupin2e838ac2019-04-17 16:50:58 -0700193 mLockPatternUtils.requireCredentialEntry(KeyguardUpdateMonitor.getCurrentUser());
194
195 return true;
196 }
197
Lucas Dupin0df60fe2019-04-23 10:19:27 -0700198 private void handleLockClick(View view) {
199 if (!mAccessibilityController.isAccessibilityEnabled()) {
200 return;
201 }
Lucas Dupind54f00e2019-05-06 17:44:03 -0700202 mShadeController.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE, true /* force */);
Lucas Dupin0df60fe2019-04-23 10:19:27 -0700203 }
204
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800205 /**
206 * Gets the {@link KeyguardUpdateMonitorCallback} instance associated with this
207 * {@link KeyguardIndicationController}.
208 *
209 * <p>Subclasses may override this method to extend or change the callback behavior by extending
210 * the {@link BaseKeyguardCallback}.
211 *
212 * @return A KeyguardUpdateMonitorCallback. Multiple calls to this method <b>must</b> return the
213 * same instance.
214 */
215 protected KeyguardUpdateMonitorCallback getKeyguardCallback() {
Zachary Iqbal8f4c2422017-04-20 17:56:42 -0700216 if (mUpdateMonitorCallback == null) {
217 mUpdateMonitorCallback = new BaseKeyguardCallback();
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800218 }
Zachary Iqbal8f4c2422017-04-20 17:56:42 -0700219 return mUpdateMonitorCallback;
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800220 }
221
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100222 private void updateDisclosure() {
223 if (mDevicePolicyManager == null) {
224 return;
225 }
226
Adrian Roos91ba3072017-02-14 16:50:46 +0100227 if (!mDozing && mDevicePolicyManager.isDeviceManaged()) {
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100228 final CharSequence organizationName =
229 mDevicePolicyManager.getDeviceOwnerOrganizationName();
230 if (organizationName != null) {
231 mDisclosure.switchIndication(mContext.getResources().getString(
232 R.string.do_disclosure_with_name, organizationName));
233 } else {
234 mDisclosure.switchIndication(R.string.do_disclosure_generic);
235 }
236 mDisclosure.setVisibility(View.VISIBLE);
237 } else {
238 mDisclosure.setVisibility(View.GONE);
239 }
Adrian Roos12c1ef52014-06-04 13:54:08 +0200240 }
241
242 public void setVisible(boolean visible) {
243 mVisible = visible;
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100244 mIndicationArea.setVisibility(visible ? View.VISIBLE : View.GONE);
Adrian Roos12c1ef52014-06-04 13:54:08 +0200245 if (visible) {
Kevin Chyn4c4001c2017-08-25 14:23:36 -0700246 // If this is called after an error message was already shown, we should not clear it.
247 // Otherwise the error message won't be shown
248 if (!mHandler.hasMessages(MSG_HIDE_TRANSIENT)) {
249 hideTransientIndication();
250 }
Beverly8c785892018-01-31 17:25:52 -0500251 updateIndication(false);
Kevin Chyn4c4001c2017-08-25 14:23:36 -0700252 } else if (!visible) {
253 // If we unlock and return to keyguard quickly, previous error should not be shown
254 hideTransientIndication();
Adrian Roos12c1ef52014-06-04 13:54:08 +0200255 }
256 }
257
258 /**
259 * Sets the indication that is shown if nothing else is showing.
260 */
261 public void setRestingIndication(String restingIndication) {
262 mRestingIndication = restingIndication;
Beverly8c785892018-01-31 17:25:52 -0500263 updateIndication(false);
Adrian Roos12c1ef52014-06-04 13:54:08 +0200264 }
265
266 /**
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800267 * Sets the active controller managing changes and callbacks to user information.
268 */
269 public void setUserInfoController(UserInfoController userInfoController) {
270 }
271
272 /**
Zachary Iqbal8f4c2422017-04-20 17:56:42 -0700273 * Returns the indication text indicating that trust has been granted.
274 *
275 * @return {@code null} or an empty string if a trust indication text should not be shown.
276 */
Lucas Dupin8e2fd012019-04-25 16:40:54 -0700277 @VisibleForTesting
278 String getTrustGrantedIndication() {
Lucas Dupin859f2c82019-04-17 18:30:00 -0700279 return mContext.getString(R.string.keyguard_indication_trust_unlocked);
Zachary Iqbaldc05aa02017-05-17 18:52:49 -0700280 }
281
282 /**
283 * Returns the indication text indicating that trust is currently being managed.
284 *
285 * @return {@code null} or an empty string if a trust managed text should not be shown.
286 */
Lucas Dupin859f2c82019-04-17 18:30:00 -0700287 private String getTrustManagedIndication() {
Zachary Iqbal8f4c2422017-04-20 17:56:42 -0700288 return null;
289 }
290
291 /**
Adrian Roos12c1ef52014-06-04 13:54:08 +0200292 * Hides transient indication in {@param delayMs}.
293 */
294 public void hideTransientIndicationDelayed(long delayMs) {
295 mHandler.sendMessageDelayed(
296 mHandler.obtainMessage(MSG_HIDE_TRANSIENT), delayMs);
297 }
298
299 /**
300 * Shows {@param transientIndication} until it is hidden by {@link #hideTransientIndication}.
301 */
302 public void showTransientIndication(int transientIndication) {
303 showTransientIndication(mContext.getResources().getString(transientIndication));
304 }
305
306 /**
307 * Shows {@param transientIndication} until it is hidden by {@link #hideTransientIndication}.
308 */
Lucas Dupinef886542018-01-03 16:03:07 -0800309 public void showTransientIndication(CharSequence transientIndication) {
Jason Chang2386a372018-04-24 16:05:30 +0800310 showTransientIndication(transientIndication, mInitialTextColorState);
Jorim Jaggi27c9b742015-04-09 10:34:49 -0700311 }
312
313 /**
314 * Shows {@param transientIndication} until it is hidden by {@link #hideTransientIndication}.
315 */
Jason Chang2386a372018-04-24 16:05:30 +0800316 public void showTransientIndication(CharSequence transientIndication,
317 ColorStateList textColorState) {
Adrian Roos12c1ef52014-06-04 13:54:08 +0200318 mTransientIndication = transientIndication;
Jason Chang2386a372018-04-24 16:05:30 +0800319 mTransientTextColorState = textColorState;
Adrian Roos12c1ef52014-06-04 13:54:08 +0200320 mHandler.removeMessages(MSG_HIDE_TRANSIENT);
Adrian Roosc1b50322017-02-27 21:07:58 +0100321 if (mDozing && !TextUtils.isEmpty(mTransientIndication)) {
322 // Make sure this doesn't get stuck and burns in. Acquire wakelock until its cleared.
323 mWakeLock.setAcquired(true);
324 hideTransientIndicationDelayed(BaseKeyguardCallback.HIDE_DELAY_MS);
325 }
Beverly8c785892018-01-31 17:25:52 -0500326
327 updateIndication(false);
Adrian Roos12c1ef52014-06-04 13:54:08 +0200328 }
329
330 /**
331 * Hides transient indication.
332 */
333 public void hideTransientIndication() {
334 if (mTransientIndication != null) {
335 mTransientIndication = null;
336 mHandler.removeMessages(MSG_HIDE_TRANSIENT);
Beverly8c785892018-01-31 17:25:52 -0500337 updateIndication(false);
Adrian Roos12c1ef52014-06-04 13:54:08 +0200338 }
339 }
340
Beverly8c785892018-01-31 17:25:52 -0500341 protected final void updateIndication(boolean animate) {
Adrian Roosc1b50322017-02-27 21:07:58 +0100342 if (TextUtils.isEmpty(mTransientIndication)) {
343 mWakeLock.setAcquired(false);
344 }
345
Adrian Roos12c1ef52014-06-04 13:54:08 +0200346 if (mVisible) {
Lucas Dupin53d50622017-05-13 15:54:14 -0700347 // Walk down a precedence-ordered list of what indication
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -0600348 // should be shown based on user or device state
Lucas Dupinff6628d2018-10-15 10:12:37 -0700349 if (mDozing) {
Lucas Dupin07ed3df2019-03-26 21:23:59 -0700350 // When dozing we ignore any text color and use white instead, because
351 // colors can be hard to read in low brightness.
352 mTextView.setTextColor(Color.WHITE);
Lucas Dupinff6628d2018-10-15 10:12:37 -0700353 if (!TextUtils.isEmpty(mTransientIndication)) {
Lucas Dupinff6628d2018-10-15 10:12:37 -0700354 mTextView.switchIndication(mTransientIndication);
Lucas Dupin07ed3df2019-03-26 21:23:59 -0700355 } else if (mPowerPluggedIn) {
356 String indication = computePowerIndication();
357 if (animate) {
358 animateText(mTextView, indication);
359 } else {
360 mTextView.switchIndication(indication);
361 }
362 } else {
363 String percentage = NumberFormat.getPercentInstance()
364 .format(mBatteryLevel / 100f);
365 mTextView.switchIndication(percentage);
Lucas Dupinff6628d2018-10-15 10:12:37 -0700366 }
Lucas Dupinff6628d2018-10-15 10:12:37 -0700367 return;
368 }
369
Jorim Jaggifabc7432017-05-15 02:40:05 +0200370 int userId = KeyguardUpdateMonitor.getCurrentUser();
Zachary Iqbaldc05aa02017-05-17 18:52:49 -0700371 String trustGrantedIndication = getTrustGrantedIndication();
372 String trustManagedIndication = getTrustManagedIndication();
Zachary Iqbal8f4c2422017-04-20 17:56:42 -0700373 if (!mUserManager.isUserUnlocked(userId)) {
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -0600374 mTextView.switchIndication(com.android.internal.R.string.lockscreen_storage_locked);
Jason Chang2386a372018-04-24 16:05:30 +0800375 mTextView.setTextColor(mInitialTextColorState);
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -0600376 } else if (!TextUtils.isEmpty(mTransientIndication)) {
377 mTextView.switchIndication(mTransientIndication);
Jason Chang2386a372018-04-24 16:05:30 +0800378 mTextView.setTextColor(mTransientTextColorState);
Zachary Iqbaldc05aa02017-05-17 18:52:49 -0700379 } else if (!TextUtils.isEmpty(trustGrantedIndication)
Lucas Dupin8e2fd012019-04-25 16:40:54 -0700380 && mKeyguardUpdateMonitor.getUserHasTrust(userId)) {
Zachary Iqbaldc05aa02017-05-17 18:52:49 -0700381 mTextView.switchIndication(trustGrantedIndication);
Jason Chang2386a372018-04-24 16:05:30 +0800382 mTextView.setTextColor(mInitialTextColorState);
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -0600383 } else if (mPowerPluggedIn) {
384 String indication = computePowerIndication();
385 if (DEBUG_CHARGING_SPEED) {
386 indication += ", " + (mChargingWattage / 1000) + " mW";
387 }
Jason Chang2386a372018-04-24 16:05:30 +0800388 mTextView.setTextColor(mInitialTextColorState);
Beverly85499d92018-02-14 15:55:16 -0500389 if (animate) {
390 animateText(mTextView, indication);
391 } else {
392 mTextView.switchIndication(indication);
393 }
Zachary Iqbaldc05aa02017-05-17 18:52:49 -0700394 } else if (!TextUtils.isEmpty(trustManagedIndication)
Lucas Dupin8e2fd012019-04-25 16:40:54 -0700395 && mKeyguardUpdateMonitor.getUserTrustIsManaged(userId)
396 && !mKeyguardUpdateMonitor.getUserHasTrust(userId)) {
Zachary Iqbaldc05aa02017-05-17 18:52:49 -0700397 mTextView.switchIndication(trustManagedIndication);
Jason Chang2386a372018-04-24 16:05:30 +0800398 mTextView.setTextColor(mInitialTextColorState);
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -0600399 } else {
400 mTextView.switchIndication(mRestingIndication);
Jason Chang2386a372018-04-24 16:05:30 +0800401 mTextView.setTextColor(mInitialTextColorState);
Adrian Roos7b043112015-07-10 13:00:33 -0700402 }
Adrian Roos12c1ef52014-06-04 13:54:08 +0200403 }
Adrian Roos12c1ef52014-06-04 13:54:08 +0200404 }
405
Beverly85499d92018-02-14 15:55:16 -0500406 // animates textView - textView moves up and bounces down
407 private void animateText(KeyguardIndicationTextView textView, String indication) {
408 int yTranslation = mContext.getResources().getInteger(
409 R.integer.wired_charging_keyguard_text_animation_distance);
410 int animateUpDuration = mContext.getResources().getInteger(
411 R.integer.wired_charging_keyguard_text_animation_duration_up);
412 int animateDownDuration = mContext.getResources().getInteger(
413 R.integer.wired_charging_keyguard_text_animation_duration_down);
Lucas Dupindef43692018-07-02 15:22:58 -0700414 textView.animate().cancel();
415 float translation = textView.getTranslationY();
Beverly85499d92018-02-14 15:55:16 -0500416 textView.animate()
417 .translationYBy(yTranslation)
418 .setInterpolator(Interpolators.LINEAR)
419 .setDuration(animateUpDuration)
420 .setListener(new AnimatorListenerAdapter() {
Lucas Dupindef43692018-07-02 15:22:58 -0700421 private boolean mCancelled;
422
Beverly85499d92018-02-14 15:55:16 -0500423 @Override
424 public void onAnimationStart(Animator animation) {
425 textView.switchIndication(indication);
426 }
Lucas Dupindef43692018-07-02 15:22:58 -0700427
428 @Override
429 public void onAnimationCancel(Animator animation) {
430 textView.setTranslationY(translation);
431 mCancelled = true;
432 }
433
Beverly85499d92018-02-14 15:55:16 -0500434 @Override
435 public void onAnimationEnd(Animator animation) {
Lucas Dupindef43692018-07-02 15:22:58 -0700436 if (mCancelled) {
437 return;
438 }
Beverly85499d92018-02-14 15:55:16 -0500439 textView.animate()
440 .setDuration(animateDownDuration)
441 .setInterpolator(Interpolators.BOUNCE)
Lucas Dupindef43692018-07-02 15:22:58 -0700442 .translationY(translation)
443 .setListener(new AnimatorListenerAdapter() {
444 @Override
445 public void onAnimationCancel(Animator animation) {
446 textView.setTranslationY(translation);
447 }
448 });
Beverly85499d92018-02-14 15:55:16 -0500449 }
450 });
451 }
452
Adrian Roos12c1ef52014-06-04 13:54:08 +0200453 private String computePowerIndication() {
454 if (mPowerCharged) {
455 return mContext.getResources().getString(R.string.keyguard_charged);
456 }
457
458 // Try fetching charging time from battery stats.
Adrian Roos7e39e592015-09-23 17:03:47 -0700459 long chargingTimeRemaining = 0;
Adrian Roos12c1ef52014-06-04 13:54:08 +0200460 try {
Adrian Roos7e39e592015-09-23 17:03:47 -0700461 chargingTimeRemaining = mBatteryInfo.computeChargeTimeRemaining();
462
Adrian Roos12c1ef52014-06-04 13:54:08 +0200463 } catch (RemoteException e) {
464 Log.e(TAG, "Error calling IBatteryStats: ", e);
465 }
Adrian Roos7e39e592015-09-23 17:03:47 -0700466 final boolean hasChargingTime = chargingTimeRemaining > 0;
Adrian Roos12c1ef52014-06-04 13:54:08 +0200467
Adrian Roos7b043112015-07-10 13:00:33 -0700468 int chargingId;
Beverly7d7f6992019-02-11 13:58:27 -0500469 if (mPowerPluggedInWired) {
470 switch (mChargingSpeed) {
471 case KeyguardUpdateMonitor.BatteryStatus.CHARGING_FAST:
472 chargingId = hasChargingTime
473 ? R.string.keyguard_indication_charging_time_fast
474 : R.string.keyguard_plugged_in_charging_fast;
475 break;
476 case KeyguardUpdateMonitor.BatteryStatus.CHARGING_SLOWLY:
477 chargingId = hasChargingTime
478 ? R.string.keyguard_indication_charging_time_slowly
479 : R.string.keyguard_plugged_in_charging_slowly;
480 break;
481 default:
482 chargingId = hasChargingTime
483 ? R.string.keyguard_indication_charging_time
484 : R.string.keyguard_plugged_in;
485 break;
486 }
487 } else {
488 chargingId = hasChargingTime
489 ? R.string.keyguard_indication_charging_time_wireless
490 : R.string.keyguard_plugged_in_wireless;
Adrian Roos7b043112015-07-10 13:00:33 -0700491 }
Adrian Roos7e39e592015-09-23 17:03:47 -0700492
Lucas Dupin8d595d22018-03-08 10:34:58 -0800493 String percentage = NumberFormat.getPercentInstance()
494 .format(mBatteryLevel / 100f);
Adrian Roos7e39e592015-09-23 17:03:47 -0700495 if (hasChargingTime) {
Lucas Dupin8d595d22018-03-08 10:34:58 -0800496 // We now have battery percentage in these strings and it's expected that all
497 // locales will also have it in the future. For now, we still have to support the old
498 // format until all languages get the new translations.
Adrian Roos7e39e592015-09-23 17:03:47 -0700499 String chargingTimeFormatted = Formatter.formatShortElapsedTimeRoundingUpToMinutes(
500 mContext, chargingTimeRemaining);
Lucas Dupin8d595d22018-03-08 10:34:58 -0800501 try {
502 return mContext.getResources().getString(chargingId, chargingTimeFormatted,
503 percentage);
504 } catch (IllegalFormatConversionException e) {
505 return mContext.getResources().getString(chargingId, chargingTimeFormatted);
506 }
Adrian Roos7e39e592015-09-23 17:03:47 -0700507 } else {
Lucas Dupin8d595d22018-03-08 10:34:58 -0800508 // Same as above
509 try {
510 return mContext.getResources().getString(chargingId, percentage);
511 } catch (IllegalFormatConversionException e) {
512 return mContext.getResources().getString(chargingId);
513 }
Adrian Roos7e39e592015-09-23 17:03:47 -0700514 }
Adrian Roos12c1ef52014-06-04 13:54:08 +0200515 }
516
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800517 public void setStatusBarKeyguardViewManager(
518 StatusBarKeyguardViewManager statusBarKeyguardViewManager) {
519 mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
520 }
521
Lucas Dupin7e171e22018-12-20 11:29:35 -0800522 private final KeyguardUpdateMonitorCallback mTickReceiver =
523 new KeyguardUpdateMonitorCallback() {
524 @Override
525 public void onTimeChanged() {
526 if (mVisible) {
527 updateIndication(false /* animate */);
528 }
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800529 }
Lucas Dupin7e171e22018-12-20 11:29:35 -0800530 };
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800531
532 private final Handler mHandler = new Handler() {
533 @Override
534 public void handleMessage(Message msg) {
Adrian Roosc1b50322017-02-27 21:07:58 +0100535 if (msg.what == MSG_HIDE_TRANSIENT) {
536 hideTransientIndication();
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200537 } else if (msg.what == MSG_CLEAR_BIOMETRIC_MSG) {
Lucas Dupinc9e5d762019-01-28 09:34:30 -0800538 mLockIcon.setTransientBiometricsError(false);
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800539 }
540 }
541 };
542
Adrian Roos91ba3072017-02-14 16:50:46 +0100543 public void setDozing(boolean dozing) {
Jorim Jaggifabc7432017-05-15 02:40:05 +0200544 if (mDozing == dozing) {
545 return;
546 }
Adrian Roos91ba3072017-02-14 16:50:46 +0100547 mDozing = dozing;
Beverly8c785892018-01-31 17:25:52 -0500548 updateIndication(false);
Adrian Roos91ba3072017-02-14 16:50:46 +0100549 updateDisclosure();
550 }
551
Lucas Dupin3fcdd472018-01-19 19:06:45 -0800552 public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
553 pw.println("KeyguardIndicationController:");
Jason Chang2386a372018-04-24 16:05:30 +0800554 pw.println(" mTransientTextColorState: " + mTransientTextColorState);
555 pw.println(" mInitialTextColorState: " + mInitialTextColorState);
Beverly2034c832018-03-19 11:18:51 -0400556 pw.println(" mPowerPluggedInWired: " + mPowerPluggedInWired);
Lucas Dupin3fcdd472018-01-19 19:06:45 -0800557 pw.println(" mPowerPluggedIn: " + mPowerPluggedIn);
558 pw.println(" mPowerCharged: " + mPowerCharged);
559 pw.println(" mChargingSpeed: " + mChargingSpeed);
560 pw.println(" mChargingWattage: " + mChargingWattage);
561 pw.println(" mMessageToShowOnScreenOn: " + mMessageToShowOnScreenOn);
562 pw.println(" mDozing: " + mDozing);
563 pw.println(" mBatteryLevel: " + mBatteryLevel);
564 pw.println(" mTextView.getText(): " + (mTextView == null ? null : mTextView.getText()));
565 pw.println(" computePowerIndication(): " + computePowerIndication());
566 }
567
Evan Laird878c8532018-10-15 15:54:29 -0400568 @Override
569 public void onStateChanged(int newState) {
570 // don't care
571 }
572
573 @Override
574 public void onDozingChanged(boolean isDozing) {
575 setDozing(isDozing);
576 }
577
Lucas Dupin8e2fd012019-04-25 16:40:54 -0700578 @Override
579 public void onUnlockMethodStateChanged() {
580 updateIndication(!mDozing);
581 }
582
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800583 protected class BaseKeyguardCallback extends KeyguardUpdateMonitorCallback {
Adrian Roos56021892017-02-27 20:25:09 +0100584 public static final int HIDE_DELAY_MS = 5000;
Selim Cinek3e451942016-07-14 18:07:53 -0700585
Adrian Roos12c1ef52014-06-04 13:54:08 +0200586 @Override
587 public void onRefreshBatteryInfo(KeyguardUpdateMonitor.BatteryStatus status) {
Adrian Roosad3bc7f2014-10-30 18:29:38 +0100588 boolean isChargingOrFull = status.status == BatteryManager.BATTERY_STATUS_CHARGING
Adrian Roos12c1ef52014-06-04 13:54:08 +0200589 || status.status == BatteryManager.BATTERY_STATUS_FULL;
Adrian Roos56021892017-02-27 20:25:09 +0100590 boolean wasPluggedIn = mPowerPluggedIn;
Beverly2034c832018-03-19 11:18:51 -0400591 mPowerPluggedInWired = status.isPluggedInWired() && isChargingOrFull;
Adrian Roosad3bc7f2014-10-30 18:29:38 +0100592 mPowerPluggedIn = status.isPluggedIn() && isChargingOrFull;
Adrian Roos12c1ef52014-06-04 13:54:08 +0200593 mPowerCharged = status.isCharged();
Adrian Roos0c859ae2015-11-23 16:47:50 -0800594 mChargingWattage = status.maxChargingWattage;
Adrian Roos7b043112015-07-10 13:00:33 -0700595 mChargingSpeed = status.getChargingSpeed(mSlowThreshold, mFastThreshold);
Lucas Dupin4272f442018-01-13 22:00:35 -0800596 mBatteryLevel = status.level;
Beverly2034c832018-03-19 11:18:51 -0400597 updateIndication(!wasPluggedIn && mPowerPluggedInWired);
Adrian Roosc1b50322017-02-27 21:07:58 +0100598 if (mDozing) {
599 if (!wasPluggedIn && mPowerPluggedIn) {
600 showTransientIndication(computePowerIndication());
601 hideTransientIndicationDelayed(HIDE_DELAY_MS);
602 } else if (wasPluggedIn && !mPowerPluggedIn) {
603 hideTransientIndication();
604 }
Adrian Roos56021892017-02-27 20:25:09 +0100605 }
Adrian Roos12c1ef52014-06-04 13:54:08 +0200606 }
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700607
608 @Override
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100609 public void onKeyguardVisibilityChanged(boolean showing) {
610 if (showing) {
611 updateDisclosure();
612 }
613 }
614
615 @Override
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200616 public void onBiometricHelp(int msgId, String helpString,
617 BiometricSourceType biometricSourceType) {
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700618 KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200619 if (!updateMonitor.isUnlockingWithBiometricAllowed()) {
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700620 return;
621 }
Lucas Dupine54ad1d2019-04-09 17:08:46 -0700622 animatePadlockError();
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700623 if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
Jason Chang2386a372018-04-24 16:05:30 +0800624 mStatusBarKeyguardViewManager.showBouncerMessage(helpString,
Lucas Dupinc2d11b32019-03-06 16:02:18 -0800625 mInitialTextColorState);
Kevin Chyn4c4001c2017-08-25 14:23:36 -0700626 } else if (updateMonitor.isScreenOn()) {
Lucas Dupinc2d11b32019-03-06 16:02:18 -0800627 showTransientIndication(helpString);
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200628 hideTransientIndicationDelayed(TRANSIENT_BIOMETRIC_ERROR_TIMEOUT);
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700629 }
630 }
631
632 @Override
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200633 public void onBiometricError(int msgId, String errString,
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 (shouldSuppressBiometricError(msgId, biometricSourceType, updateMonitor)) {
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()) {
Lucas Dupine54ad1d2019-04-09 17:08:46 -0700641 mStatusBarKeyguardViewManager.showBouncerMessage(errString, mInitialTextColorState);
Kevin Chyn4c4001c2017-08-25 14:23:36 -0700642 } else if (updateMonitor.isScreenOn()) {
Lucas Dupinc2d11b32019-03-06 16:02:18 -0800643 showTransientIndication(errString);
Selim Cinek3e451942016-07-14 18:07:53 -0700644 // We want to keep this message around in case the screen was off
Adrian Roos56021892017-02-27 20:25:09 +0100645 hideTransientIndicationDelayed(HIDE_DELAY_MS);
Selim Cinek3e451942016-07-14 18:07:53 -0700646 } else {
647 mMessageToShowOnScreenOn = errString;
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700648 }
Lucas Dupine54ad1d2019-04-09 17:08:46 -0700649 }
650
651 private void animatePadlockError() {
652 mLockIcon.setTransientBiometricsError(true);
653 mHandler.removeMessages(MSG_CLEAR_BIOMETRIC_MSG);
654 mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_CLEAR_BIOMETRIC_MSG),
655 TRANSIENT_BIOMETRIC_ERROR_TIMEOUT);
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700656 }
657
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200658 private boolean shouldSuppressBiometricError(int msgId,
659 BiometricSourceType biometricSourceType, KeyguardUpdateMonitor updateMonitor) {
660 if (biometricSourceType == BiometricSourceType.FINGERPRINT)
661 return shouldSuppressFingerprintError(msgId, updateMonitor);
662 if (biometricSourceType == BiometricSourceType.FACE)
663 return shouldSuppressFaceError(msgId, updateMonitor);
664 return false;
665 }
666
667 private boolean shouldSuppressFingerprintError(int msgId,
668 KeyguardUpdateMonitor updateMonitor) {
669 return ((!updateMonitor.isUnlockingWithBiometricAllowed()
670 && msgId != FingerprintManager.FINGERPRINT_ERROR_LOCKOUT_PERMANENT)
671 || msgId == FingerprintManager.FINGERPRINT_ERROR_CANCELED);
672 }
673
674 private boolean shouldSuppressFaceError(int msgId, KeyguardUpdateMonitor updateMonitor) {
675 return ((!updateMonitor.isUnlockingWithBiometricAllowed()
676 && msgId != FaceManager.FACE_ERROR_LOCKOUT_PERMANENT)
677 || msgId == FaceManager.FACE_ERROR_CANCELED);
678 }
679
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700680 @Override
Lucas Dupinef886542018-01-03 16:03:07 -0800681 public void onTrustAgentErrorMessage(CharSequence message) {
Jason Chang2386a372018-04-24 16:05:30 +0800682 showTransientIndication(message, Utils.getColorError(mContext));
Lucas Dupinef886542018-01-03 16:03:07 -0800683 }
684
685 @Override
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700686 public void onScreenTurnedOn() {
687 if (mMessageToShowOnScreenOn != null) {
Jason Chang2386a372018-04-24 16:05:30 +0800688 showTransientIndication(mMessageToShowOnScreenOn, Utils.getColorError(mContext));
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700689 // We want to keep this message around in case the screen was off
Adrian Roos56021892017-02-27 20:25:09 +0100690 hideTransientIndicationDelayed(HIDE_DELAY_MS);
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700691 mMessageToShowOnScreenOn = null;
692 }
693 }
694
695 @Override
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200696 public void onBiometricRunningStateChanged(boolean running,
697 BiometricSourceType biometricSourceType) {
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700698 if (running) {
Lucas Dupin8f3faac2019-03-12 15:28:49 -0700699 // Let's hide any previous messages when authentication starts, otherwise
700 // multiple auth attempts would overlap.
701 hideTransientIndication();
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700702 mMessageToShowOnScreenOn = null;
703 }
704 }
Selim Cinek3e451942016-07-14 18:07:53 -0700705
706 @Override
Gilad Brettercb51b8b2018-03-22 17:04:51 +0200707 public void onBiometricAuthenticated(int userId, BiometricSourceType biometricSourceType) {
708 super.onBiometricAuthenticated(userId, biometricSourceType);
Kevin Chyn6d793bd2019-03-27 15:36:13 -0700709 mHandler.sendEmptyMessage(MSG_HIDE_TRANSIENT);
Selim Cinek3e451942016-07-14 18:07:53 -0700710 }
711
712 @Override
Jorim Jaggidadafd42016-09-30 07:20:25 -0700713 public void onUserUnlocked() {
714 if (mVisible) {
Beverly8c785892018-01-31 17:25:52 -0500715 updateIndication(false);
Jorim Jaggidadafd42016-09-30 07:20:25 -0700716 }
717 }
Lucas Dupin05904652019-04-09 16:16:15 -0700718
719 @Override
720 public void onKeyguardBouncerChanged(boolean bouncer) {
Brad Stenning8fcd8b42019-04-22 09:30:20 -0700721 if (mLockIcon == null) {
722 return;
723 }
Lucas Dupin05904652019-04-09 16:16:15 -0700724 mLockIcon.setBouncerVisible(bouncer);
725 }
Adrian Roos12c1ef52014-06-04 13:54:08 +0200726 };
Adrian Roos12c1ef52014-06-04 13:54:08 +0200727}