blob: fb92a67c6aac7570efc5cf3c740e445bf4b45d7f [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
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -060019import android.app.ActivityManager;
Bartosz Fabianowski5f045002016-12-01 10:36:18 +010020import android.app.admin.DevicePolicyManager;
Adrian Roos12c1ef52014-06-04 13:54:08 +020021import android.content.BroadcastReceiver;
22import android.content.Context;
23import android.content.Intent;
24import android.content.IntentFilter;
Adrian Roos7b043112015-07-10 13:00:33 -070025import android.content.res.Resources;
Jorim Jaggi27c9b742015-04-09 10:34:49 -070026import android.graphics.Color;
Selim Cinekcfafe4e2015-08-11 14:58:44 -070027import android.hardware.fingerprint.FingerprintManager;
Adrian Roos12c1ef52014-06-04 13:54:08 +020028import android.os.BatteryManager;
29import android.os.BatteryStats;
30import android.os.Handler;
31import android.os.Message;
32import android.os.RemoteException;
33import android.os.ServiceManager;
34import android.os.UserHandle;
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
Selim Cinekcfafe4e2015-08-11 14:58:44 -070042import com.android.internal.app.IBatteryStats;
43import com.android.keyguard.KeyguardUpdateMonitor;
44import com.android.keyguard.KeyguardUpdateMonitorCallback;
Jason Monk58be7a62017-02-01 20:17:51 -050045import com.android.settingslib.Utils;
Jason Monk9c7844c2017-01-18 15:21:53 -050046import com.android.systemui.Dependency;
Selim Cinekcfafe4e2015-08-11 14:58:44 -070047import com.android.systemui.R;
48import com.android.systemui.statusbar.phone.KeyguardIndicationTextView;
49import com.android.systemui.statusbar.phone.LockIcon;
50import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
Zachary Iqbalf50284c2017-01-22 18:54:46 -080051import com.android.systemui.statusbar.policy.UserInfoController;
Selim Cinekcfafe4e2015-08-11 14:58:44 -070052
Adrian Roos12c1ef52014-06-04 13:54:08 +020053/**
Selim Cinekcfafe4e2015-08-11 14:58:44 -070054 * Controls the indications and error messages shown on the Keyguard
Adrian Roos12c1ef52014-06-04 13:54:08 +020055 */
56public class KeyguardIndicationController {
57
Adrian Roos0c859ae2015-11-23 16:47:50 -080058 private static final String TAG = "KeyguardIndication";
59 private static final boolean DEBUG_CHARGING_SPEED = false;
Adrian Roos12c1ef52014-06-04 13:54:08 +020060
61 private static final int MSG_HIDE_TRANSIENT = 1;
Selim Cinekcfafe4e2015-08-11 14:58:44 -070062 private static final int MSG_CLEAR_FP_MSG = 2;
63 private static final long TRANSIENT_FP_ERROR_TIMEOUT = 1300;
Adrian Roos12c1ef52014-06-04 13:54:08 +020064
65 private final Context mContext;
Bartosz Fabianowski5f045002016-12-01 10:36:18 +010066 private final ViewGroup mIndicationArea;
Adrian Roos12c1ef52014-06-04 13:54:08 +020067 private final KeyguardIndicationTextView mTextView;
Bartosz Fabianowski5f045002016-12-01 10:36:18 +010068 private final KeyguardIndicationTextView mDisclosure;
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -060069 private final UserManager mUserManager;
Adrian Roos12c1ef52014-06-04 13:54:08 +020070 private final IBatteryStats mBatteryInfo;
71
Adrian Roos7b043112015-07-10 13:00:33 -070072 private final int mSlowThreshold;
73 private final int mFastThreshold;
Selim Cinekcfafe4e2015-08-11 14:58:44 -070074 private final LockIcon mLockIcon;
75 private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
Adrian Roos7b043112015-07-10 13:00:33 -070076
Adrian Roos12c1ef52014-06-04 13:54:08 +020077 private String mRestingIndication;
78 private String mTransientIndication;
Jorim Jaggi27c9b742015-04-09 10:34:49 -070079 private int mTransientTextColor;
Adrian Roos12c1ef52014-06-04 13:54:08 +020080 private boolean mVisible;
81
82 private boolean mPowerPluggedIn;
83 private boolean mPowerCharged;
Adrian Roos7b043112015-07-10 13:00:33 -070084 private int mChargingSpeed;
Adrian Roos0c859ae2015-11-23 16:47:50 -080085 private int mChargingWattage;
Selim Cinekcfafe4e2015-08-11 14:58:44 -070086 private String mMessageToShowOnScreenOn;
Adrian Roos12c1ef52014-06-04 13:54:08 +020087
Zachary Iqbalf50284c2017-01-22 18:54:46 -080088 private KeyguardUpdateMonitorCallback mUpdateMonitor;
89
Bartosz Fabianowski5f045002016-12-01 10:36:18 +010090 private final DevicePolicyManager mDevicePolicyManager;
Adrian Roos91ba3072017-02-14 16:50:46 +010091 private boolean mDozing;
Bartosz Fabianowski5f045002016-12-01 10:36:18 +010092
93 public KeyguardIndicationController(Context context, ViewGroup indicationArea,
94 LockIcon lockIcon) {
Adrian Roos12c1ef52014-06-04 13:54:08 +020095 mContext = context;
Bartosz Fabianowski5f045002016-12-01 10:36:18 +010096 mIndicationArea = indicationArea;
97 mTextView = (KeyguardIndicationTextView) indicationArea.findViewById(
98 R.id.keyguard_indication_text);
99 mDisclosure = (KeyguardIndicationTextView) indicationArea.findViewById(
100 R.id.keyguard_indication_enterprise_disclosure);
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700101 mLockIcon = lockIcon;
Adrian Roos12c1ef52014-06-04 13:54:08 +0200102
Adrian Roos7b043112015-07-10 13:00:33 -0700103 Resources res = context.getResources();
104 mSlowThreshold = res.getInteger(R.integer.config_chargingSlowlyThreshold);
105 mFastThreshold = res.getInteger(R.integer.config_chargingFastThreshold);
106
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -0600107 mUserManager = context.getSystemService(UserManager.class);
Adrian Roos12c1ef52014-06-04 13:54:08 +0200108 mBatteryInfo = IBatteryStats.Stub.asInterface(
109 ServiceManager.getService(BatteryStats.SERVICE_NAME));
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -0600110
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100111 mDevicePolicyManager = (DevicePolicyManager) context.getSystemService(
112 Context.DEVICE_POLICY_SERVICE);
113
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800114 KeyguardUpdateMonitor.getInstance(context).registerCallback(getKeyguardCallback());
Jeff Sharkey99e1bca2016-08-23 16:32:03 -0600115 context.registerReceiverAsUser(mTickReceiver, UserHandle.SYSTEM,
Jason Monkcd26af72017-01-11 14:32:58 -0500116 new IntentFilter(Intent.ACTION_TIME_TICK), null,
Jason Monk9c7844c2017-01-18 15:21:53 -0500117 Dependency.get(Dependency.TIME_TICK_HANDLER));
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100118
119 updateDisclosure();
120 }
121
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800122 /**
123 * Gets the {@link KeyguardUpdateMonitorCallback} instance associated with this
124 * {@link KeyguardIndicationController}.
125 *
126 * <p>Subclasses may override this method to extend or change the callback behavior by extending
127 * the {@link BaseKeyguardCallback}.
128 *
129 * @return A KeyguardUpdateMonitorCallback. Multiple calls to this method <b>must</b> return the
130 * same instance.
131 */
132 protected KeyguardUpdateMonitorCallback getKeyguardCallback() {
133 if (mUpdateMonitor == null) {
134 mUpdateMonitor = new BaseKeyguardCallback();
135 }
136 return mUpdateMonitor;
137 }
138
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100139 private void updateDisclosure() {
140 if (mDevicePolicyManager == null) {
141 return;
142 }
143
Adrian Roos91ba3072017-02-14 16:50:46 +0100144 if (!mDozing && mDevicePolicyManager.isDeviceManaged()) {
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100145 final CharSequence organizationName =
146 mDevicePolicyManager.getDeviceOwnerOrganizationName();
147 if (organizationName != null) {
148 mDisclosure.switchIndication(mContext.getResources().getString(
149 R.string.do_disclosure_with_name, organizationName));
150 } else {
151 mDisclosure.switchIndication(R.string.do_disclosure_generic);
152 }
153 mDisclosure.setVisibility(View.VISIBLE);
154 } else {
155 mDisclosure.setVisibility(View.GONE);
156 }
Adrian Roos12c1ef52014-06-04 13:54:08 +0200157 }
158
159 public void setVisible(boolean visible) {
160 mVisible = visible;
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100161 mIndicationArea.setVisibility(visible ? View.VISIBLE : View.GONE);
Adrian Roos12c1ef52014-06-04 13:54:08 +0200162 if (visible) {
163 hideTransientIndication();
164 updateIndication();
165 }
166 }
167
168 /**
169 * Sets the indication that is shown if nothing else is showing.
170 */
171 public void setRestingIndication(String restingIndication) {
172 mRestingIndication = restingIndication;
173 updateIndication();
174 }
175
176 /**
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800177 * Sets the active controller managing changes and callbacks to user information.
178 */
179 public void setUserInfoController(UserInfoController userInfoController) {
180 }
181
182 /**
Adrian Roos12c1ef52014-06-04 13:54:08 +0200183 * Hides transient indication in {@param delayMs}.
184 */
185 public void hideTransientIndicationDelayed(long delayMs) {
186 mHandler.sendMessageDelayed(
187 mHandler.obtainMessage(MSG_HIDE_TRANSIENT), delayMs);
188 }
189
190 /**
191 * Shows {@param transientIndication} until it is hidden by {@link #hideTransientIndication}.
192 */
193 public void showTransientIndication(int transientIndication) {
194 showTransientIndication(mContext.getResources().getString(transientIndication));
195 }
196
197 /**
198 * Shows {@param transientIndication} until it is hidden by {@link #hideTransientIndication}.
199 */
200 public void showTransientIndication(String transientIndication) {
Jorim Jaggi27c9b742015-04-09 10:34:49 -0700201 showTransientIndication(transientIndication, Color.WHITE);
202 }
203
204 /**
205 * Shows {@param transientIndication} until it is hidden by {@link #hideTransientIndication}.
206 */
207 public void showTransientIndication(String transientIndication, int textColor) {
Adrian Roos12c1ef52014-06-04 13:54:08 +0200208 mTransientIndication = transientIndication;
Jorim Jaggi27c9b742015-04-09 10:34:49 -0700209 mTransientTextColor = textColor;
Adrian Roos12c1ef52014-06-04 13:54:08 +0200210 mHandler.removeMessages(MSG_HIDE_TRANSIENT);
211 updateIndication();
212 }
213
214 /**
215 * Hides transient indication.
216 */
217 public void hideTransientIndication() {
218 if (mTransientIndication != null) {
219 mTransientIndication = null;
220 mHandler.removeMessages(MSG_HIDE_TRANSIENT);
221 updateIndication();
222 }
223 }
224
225 private void updateIndication() {
226 if (mVisible) {
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -0600227 // Walk down a precedence-ordered list of what should indication
228 // should be shown based on user or device state
Adrian Roos91ba3072017-02-14 16:50:46 +0100229 if (mDozing) {
230 // If we're dozing, never show a persistent indication.
231 if (!TextUtils.isEmpty(mTransientIndication)) {
232 mTextView.switchIndication(mTransientIndication);
233 mTextView.setTextColor(mTransientTextColor);
234
235 } else {
236 mTextView.switchIndication(null);
237 }
238 return;
239 }
240
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -0600241 if (!mUserManager.isUserUnlocked(ActivityManager.getCurrentUser())) {
242 mTextView.switchIndication(com.android.internal.R.string.lockscreen_storage_locked);
243 mTextView.setTextColor(Color.WHITE);
Adrian Roos12c1ef52014-06-04 13:54:08 +0200244
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -0600245 } else if (!TextUtils.isEmpty(mTransientIndication)) {
246 mTextView.switchIndication(mTransientIndication);
247 mTextView.setTextColor(mTransientTextColor);
Jorim Jaggi27c9b742015-04-09 10:34:49 -0700248
Jeff Sharkeyb6edaa92016-07-27 15:51:31 -0600249 } else if (mPowerPluggedIn) {
250 String indication = computePowerIndication();
251 if (DEBUG_CHARGING_SPEED) {
252 indication += ", " + (mChargingWattage / 1000) + " mW";
253 }
254 mTextView.switchIndication(indication);
255 mTextView.setTextColor(Color.WHITE);
256
257 } else {
258 mTextView.switchIndication(mRestingIndication);
259 mTextView.setTextColor(Color.WHITE);
Adrian Roos7b043112015-07-10 13:00:33 -0700260 }
Adrian Roos12c1ef52014-06-04 13:54:08 +0200261 }
Adrian Roos12c1ef52014-06-04 13:54:08 +0200262 }
263
264 private String computePowerIndication() {
265 if (mPowerCharged) {
266 return mContext.getResources().getString(R.string.keyguard_charged);
267 }
268
269 // Try fetching charging time from battery stats.
Adrian Roos7e39e592015-09-23 17:03:47 -0700270 long chargingTimeRemaining = 0;
Adrian Roos12c1ef52014-06-04 13:54:08 +0200271 try {
Adrian Roos7e39e592015-09-23 17:03:47 -0700272 chargingTimeRemaining = mBatteryInfo.computeChargeTimeRemaining();
273
Adrian Roos12c1ef52014-06-04 13:54:08 +0200274 } catch (RemoteException e) {
275 Log.e(TAG, "Error calling IBatteryStats: ", e);
276 }
Adrian Roos7e39e592015-09-23 17:03:47 -0700277 final boolean hasChargingTime = chargingTimeRemaining > 0;
Adrian Roos12c1ef52014-06-04 13:54:08 +0200278
Adrian Roos7b043112015-07-10 13:00:33 -0700279 int chargingId;
280 switch (mChargingSpeed) {
281 case KeyguardUpdateMonitor.BatteryStatus.CHARGING_FAST:
Adrian Roos7e39e592015-09-23 17:03:47 -0700282 chargingId = hasChargingTime
Adrian Roosf142cac2015-09-25 15:15:17 -0700283 ? R.string.keyguard_indication_charging_time_fast
Adrian Roos7e39e592015-09-23 17:03:47 -0700284 : R.string.keyguard_plugged_in_charging_fast;
Adrian Roos7b043112015-07-10 13:00:33 -0700285 break;
286 case KeyguardUpdateMonitor.BatteryStatus.CHARGING_SLOWLY:
Adrian Roos7e39e592015-09-23 17:03:47 -0700287 chargingId = hasChargingTime
Adrian Roosf142cac2015-09-25 15:15:17 -0700288 ? R.string.keyguard_indication_charging_time_slowly
Adrian Roos7e39e592015-09-23 17:03:47 -0700289 : R.string.keyguard_plugged_in_charging_slowly;
Adrian Roos7b043112015-07-10 13:00:33 -0700290 break;
291 default:
Adrian Roos7e39e592015-09-23 17:03:47 -0700292 chargingId = hasChargingTime
293 ? R.string.keyguard_indication_charging_time
294 : R.string.keyguard_plugged_in;
Adrian Roos7b043112015-07-10 13:00:33 -0700295 break;
296 }
Adrian Roos7e39e592015-09-23 17:03:47 -0700297
298 if (hasChargingTime) {
299 String chargingTimeFormatted = Formatter.formatShortElapsedTimeRoundingUpToMinutes(
300 mContext, chargingTimeRemaining);
301 return mContext.getResources().getString(chargingId, chargingTimeFormatted);
302 } else {
303 return mContext.getResources().getString(chargingId);
304 }
Adrian Roos12c1ef52014-06-04 13:54:08 +0200305 }
306
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800307 public void setStatusBarKeyguardViewManager(
308 StatusBarKeyguardViewManager statusBarKeyguardViewManager) {
309 mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
310 }
311
312 BroadcastReceiver mTickReceiver = new BroadcastReceiver() {
313 @Override
314 public void onReceive(Context context, Intent intent) {
315 mHandler.post(() -> {
316 if (mVisible) {
317 updateIndication();
318 }
319 });
320 }
321 };
322
323 private final Handler mHandler = new Handler() {
324 @Override
325 public void handleMessage(Message msg) {
326 if (msg.what == MSG_HIDE_TRANSIENT && mTransientIndication != null) {
327 mTransientIndication = null;
328 updateIndication();
329 } else if (msg.what == MSG_CLEAR_FP_MSG) {
330 mLockIcon.setTransientFpError(false);
331 hideTransientIndication();
332 }
333 }
334 };
335
Adrian Roos91ba3072017-02-14 16:50:46 +0100336 public void setDozing(boolean dozing) {
337 mDozing = dozing;
338 updateIndication();
339 updateDisclosure();
340 }
341
Zachary Iqbalf50284c2017-01-22 18:54:46 -0800342 protected class BaseKeyguardCallback extends KeyguardUpdateMonitorCallback {
343 private int mLastSuccessiveErrorMessage = -1;
Selim Cinek3e451942016-07-14 18:07:53 -0700344
Adrian Roos12c1ef52014-06-04 13:54:08 +0200345 @Override
346 public void onRefreshBatteryInfo(KeyguardUpdateMonitor.BatteryStatus status) {
Adrian Roosad3bc7f2014-10-30 18:29:38 +0100347 boolean isChargingOrFull = status.status == BatteryManager.BATTERY_STATUS_CHARGING
Adrian Roos12c1ef52014-06-04 13:54:08 +0200348 || status.status == BatteryManager.BATTERY_STATUS_FULL;
Adrian Roosad3bc7f2014-10-30 18:29:38 +0100349 mPowerPluggedIn = status.isPluggedIn() && isChargingOrFull;
Adrian Roos12c1ef52014-06-04 13:54:08 +0200350 mPowerCharged = status.isCharged();
Adrian Roos0c859ae2015-11-23 16:47:50 -0800351 mChargingWattage = status.maxChargingWattage;
Adrian Roos7b043112015-07-10 13:00:33 -0700352 mChargingSpeed = status.getChargingSpeed(mSlowThreshold, mFastThreshold);
Adrian Roos12c1ef52014-06-04 13:54:08 +0200353 updateIndication();
354 }
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700355
356 @Override
Bartosz Fabianowski5f045002016-12-01 10:36:18 +0100357 public void onKeyguardVisibilityChanged(boolean showing) {
358 if (showing) {
359 updateDisclosure();
360 }
361 }
362
363 @Override
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700364 public void onFingerprintHelp(int msgId, String helpString) {
365 KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
366 if (!updateMonitor.isUnlockingWithFingerprintAllowed()) {
367 return;
368 }
Jason Monk58be7a62017-02-01 20:17:51 -0500369 int errorColor = Utils.getColorError(mContext);
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700370 if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
371 mStatusBarKeyguardViewManager.showBouncerMessage(helpString, errorColor);
Adrian Roos91ba3072017-02-14 16:50:46 +0100372 } else if (updateMonitor.isDeviceInteractive()
373 || mDozing && updateMonitor.isScreenOn()) {
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700374 mLockIcon.setTransientFpError(true);
375 showTransientIndication(helpString, errorColor);
376 mHandler.removeMessages(MSG_CLEAR_FP_MSG);
377 mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_CLEAR_FP_MSG),
378 TRANSIENT_FP_ERROR_TIMEOUT);
379 }
Selim Cinek3e451942016-07-14 18:07:53 -0700380 // Help messages indicate that there was actually a try since the last error, so those
381 // are not two successive error messages anymore.
382 mLastSuccessiveErrorMessage = -1;
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700383 }
384
385 @Override
386 public void onFingerprintError(int msgId, String errString) {
387 KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
388 if (!updateMonitor.isUnlockingWithFingerprintAllowed()
389 || msgId == FingerprintManager.FINGERPRINT_ERROR_CANCELED) {
390 return;
391 }
Jason Monk58be7a62017-02-01 20:17:51 -0500392 int errorColor = Utils.getColorError(mContext);
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700393 if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
Selim Cinek3e451942016-07-14 18:07:53 -0700394 // When swiping up right after receiving a fingerprint error, the bouncer calls
395 // authenticate leading to the same message being shown again on the bouncer.
396 // We want to avoid this, as it may confuse the user when the message is too
397 // generic.
398 if (mLastSuccessiveErrorMessage != msgId) {
399 mStatusBarKeyguardViewManager.showBouncerMessage(errString, errorColor);
400 }
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700401 } else if (updateMonitor.isDeviceInteractive()) {
Selim Cinek3e451942016-07-14 18:07:53 -0700402 showTransientIndication(errString, errorColor);
403 // We want to keep this message around in case the screen was off
404 mHandler.removeMessages(MSG_HIDE_TRANSIENT);
405 hideTransientIndicationDelayed(5000);
406 } else {
407 mMessageToShowOnScreenOn = errString;
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700408 }
Selim Cinek3e451942016-07-14 18:07:53 -0700409 mLastSuccessiveErrorMessage = msgId;
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700410 }
411
412 @Override
413 public void onScreenTurnedOn() {
414 if (mMessageToShowOnScreenOn != null) {
Jason Monk58be7a62017-02-01 20:17:51 -0500415 int errorColor = Utils.getColorError(mContext);
Selim Cinekcfafe4e2015-08-11 14:58:44 -0700416 showTransientIndication(mMessageToShowOnScreenOn, errorColor);
417 // We want to keep this message around in case the screen was off
418 mHandler.removeMessages(MSG_HIDE_TRANSIENT);
419 hideTransientIndicationDelayed(5000);
420 mMessageToShowOnScreenOn = null;
421 }
422 }
423
424 @Override
425 public void onFingerprintRunningStateChanged(boolean running) {
426 if (running) {
427 mMessageToShowOnScreenOn = null;
428 }
429 }
Selim Cinek3e451942016-07-14 18:07:53 -0700430
431 @Override
432 public void onFingerprintAuthenticated(int userId) {
433 super.onFingerprintAuthenticated(userId);
434 mLastSuccessiveErrorMessage = -1;
435 }
436
437 @Override
438 public void onFingerprintAuthFailed() {
439 super.onFingerprintAuthFailed();
440 mLastSuccessiveErrorMessage = -1;
441 }
Jorim Jaggidadafd42016-09-30 07:20:25 -0700442
443 @Override
444 public void onUserUnlocked() {
445 if (mVisible) {
446 updateIndication();
447 }
448 }
Adrian Roos12c1ef52014-06-04 13:54:08 +0200449 };
Adrian Roos12c1ef52014-06-04 13:54:08 +0200450}