blob: 67571bb2ab388d382ff4ddaae43991b99b09e888 [file] [log] [blame]
Jim Millerbbf1a742012-07-17 18:30:30 -07001/*
2 * Copyright (C) 2012 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 */
Jim Miller5ecd8112013-01-09 18:50:26 -080016package com.android.keyguard;
Jim Millerbbf1a742012-07-17 18:30:30 -070017
18import android.app.admin.DevicePolicyManager;
Adam Powell43a372f2013-09-27 17:43:53 -070019import android.graphics.Bitmap;
Lucas Dupinef886542018-01-03 16:03:07 -080020import android.hardware.fingerprint.FingerprintManager;
Jim Millerbbf1a742012-07-17 18:30:30 -070021import android.media.AudioManager;
John Spurlock385a63d2013-10-30 19:40:48 -040022import android.os.SystemClock;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010023import android.telephony.TelephonyManager;
Adrian Roose99bc052017-11-20 17:55:31 +010024import android.view.WindowManagerPolicyConstants;
Jim Millerbbf1a742012-07-17 18:30:30 -070025
Jim Millerbbf1a742012-07-17 18:30:30 -070026import com.android.internal.telephony.IccCardConstants;
Lucas Dupinef886542018-01-03 16:03:07 -080027import com.android.systemui.statusbar.KeyguardIndicationController;
Jim Millerbbf1a742012-07-17 18:30:30 -070028
29/**
30 * Callback for general information relevant to lock screen.
31 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +010032public class KeyguardUpdateMonitorCallback {
John Spurlock385a63d2013-10-30 19:40:48 -040033
34 private static final long VISIBILITY_CHANGED_COLLAPSE_MS = 1000;
35 private long mVisibilityChangedCalled;
36 private boolean mShowing;
37
Jim Millerbbf1a742012-07-17 18:30:30 -070038 /**
39 * Called when the battery status changes, e.g. when plugged in or unplugged, charge
40 * level, etc. changes.
41 *
42 * @param status current battery status
43 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +010044 public void onRefreshBatteryInfo(KeyguardUpdateMonitor.BatteryStatus status) { }
Jim Millerbbf1a742012-07-17 18:30:30 -070045
46 /**
47 * Called once per minute or when the time changes.
48 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +010049 public void onTimeChanged() { }
Jim Millerbbf1a742012-07-17 18:30:30 -070050
51 /**
52 * Called when the carrier PLMN or SPN changes.
Jim Millerbbf1a742012-07-17 18:30:30 -070053 */
Jason Monk9ff69bd2014-12-02 16:43:17 -050054 public void onRefreshCarrierInfo() { }
Jim Millerbbf1a742012-07-17 18:30:30 -070055
56 /**
57 * Called when the ringer mode changes.
58 * @param state the current ringer state, as defined in
59 * {@link AudioManager#RINGER_MODE_CHANGED_ACTION}
60 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +010061 public void onRingerModeChanged(int state) { }
Jim Millerbbf1a742012-07-17 18:30:30 -070062
63 /**
64 * Called when the phone state changes. String will be one of:
65 * {@link TelephonyManager#EXTRA_STATE_IDLE}
66 * {@link TelephonyManager@EXTRA_STATE_RINGING}
67 * {@link TelephonyManager#EXTRA_STATE_OFFHOOK
68 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +010069 public void onPhoneStateChanged(int phoneState) { }
Jim Millerbbf1a742012-07-17 18:30:30 -070070
71 /**
Danielle Millettf6d0fc12012-10-23 16:16:52 -040072 * Called when the visibility of the keyguard changes.
73 * @param showing Indicates if the keyguard is now visible.
74 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +010075 public void onKeyguardVisibilityChanged(boolean showing) { }
Danielle Millettf6d0fc12012-10-23 16:16:52 -040076
Jorim Jaggi5cf17872014-03-26 18:31:48 +010077 public void onKeyguardVisibilityChangedRaw(boolean showing) {
John Spurlock385a63d2013-10-30 19:40:48 -040078 final long now = SystemClock.elapsedRealtime();
79 if (showing == mShowing
80 && (now - mVisibilityChangedCalled) < VISIBILITY_CHANGED_COLLAPSE_MS) return;
81 onKeyguardVisibilityChanged(showing);
82 mVisibilityChangedCalled = now;
83 mShowing = showing;
84 }
85
Danielle Millettf6d0fc12012-10-23 16:16:52 -040086 /**
Adrian Roosb6011622014-05-14 15:52:53 +020087 * Called when the keyguard enters or leaves bouncer mode.
88 * @param bouncer if true, keyguard is now in bouncer mode.
89 */
90 public void onKeyguardBouncerChanged(boolean bouncer) { }
91
92 /**
Jim Millerbbf1a742012-07-17 18:30:30 -070093 * Called when visibility of lockscreen clock changes, such as when
94 * obscured by a widget.
95 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +010096 public void onClockVisibilityChanged() { }
Jim Millerbbf1a742012-07-17 18:30:30 -070097
98 /**
99 * Called when the device becomes provisioned
100 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100101 public void onDeviceProvisioned() { }
Jim Millerbbf1a742012-07-17 18:30:30 -0700102
103 /**
104 * Called when the device policy changes.
105 * See {@link DevicePolicyManager#ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED}
106 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100107 public void onDevicePolicyManagerStateChanged() { }
Jim Millerbbf1a742012-07-17 18:30:30 -0700108
109 /**
Chris Wrenf41c61b2012-11-29 15:19:54 -0500110 * Called when the user change begins.
Jim Millerbbf1a742012-07-17 18:30:30 -0700111 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100112 public void onUserSwitching(int userId) { }
Chris Wrenf41c61b2012-11-29 15:19:54 -0500113
114 /**
115 * Called when the user change is complete.
116 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100117 public void onUserSwitchComplete(int userId) { }
Jim Millerbbf1a742012-07-17 18:30:30 -0700118
119 /**
120 * Called when the SIM state changes.
Jim Miller52a61332014-11-12 19:29:51 -0800121 * @param slotId
Jim Millerbbf1a742012-07-17 18:30:30 -0700122 * @param simState
123 */
Jim Miller52a61332014-11-12 19:29:51 -0800124 public void onSimStateChanged(int subId, int slotId, IccCardConstants.State simState) { }
Jim Millerbbf1a742012-07-17 18:30:30 -0700125
126 /**
Amith Yamasani6fc1d4e2013-05-08 16:43:58 -0700127 * Called when the user's info changed.
128 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100129 public void onUserInfoChanged(int userId) { }
Amith Yamasani6fc1d4e2013-05-08 16:43:58 -0700130
131 /**
Jorim Jaggidadafd42016-09-30 07:20:25 -0700132 * Called when a user got unlocked.
133 */
134 public void onUserUnlocked() { }
135
136 /**
Adam Cohenefb3ffb2012-11-06 16:55:32 -0800137 * Called when boot completed.
138 *
139 * Note, this callback will only be received if boot complete occurs after registering with
140 * KeyguardUpdateMonitor.
141 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100142 public void onBootCompleted() { }
Jim Miller8f09fd22013-03-14 19:04:28 -0700143
144 /**
Brian Colonna7fce3802013-09-17 15:51:32 -0400145 * Called when the emergency call button is pressed.
146 */
John Spurlock813552c2014-09-19 08:30:21 -0400147 public void onEmergencyCallAction() { }
Adam Powell43a372f2013-09-27 17:43:53 -0700148
Jim Miller20daffd2013-10-07 14:59:53 -0700149 /**
150 * Called when the transport background changes.
151 * @param bitmap
152 */
Adam Powell43a372f2013-09-27 17:43:53 -0700153 public void onSetBackground(Bitmap bitmap) {
Adam Powell43a372f2013-09-27 17:43:53 -0700154 }
Jim Miller20daffd2013-10-07 14:59:53 -0700155
156 /**
Jorim Jaggi0d210f62015-07-10 14:24:44 -0700157 * Called when the device has started waking up.
Adrian Roos369907f2017-07-14 14:53:39 +0200158 *
159 * @deprecated use {@link com.android.systemui.keyguard.WakefulnessLifecycle}.
Jim Miller20daffd2013-10-07 14:59:53 -0700160 */
Adrian Roos369907f2017-07-14 14:53:39 +0200161 @Deprecated
Jorim Jaggi0d210f62015-07-10 14:24:44 -0700162 public void onStartedWakingUp() { }
Jim Miller20daffd2013-10-07 14:59:53 -0700163
164 /**
Jorim Jaggi95e40382015-09-16 15:53:42 -0700165 * Called when the device has started going to sleep.
166 * @param why see {@link #onFinishedGoingToSleep(int)}
Adrian Roos369907f2017-07-14 14:53:39 +0200167 *
168 * @deprecated use {@link com.android.systemui.keyguard.WakefulnessLifecycle}.
Jorim Jaggi95e40382015-09-16 15:53:42 -0700169 */
Adrian Roos369907f2017-07-14 14:53:39 +0200170 @Deprecated
Jorim Jaggi95e40382015-09-16 15:53:42 -0700171 public void onStartedGoingToSleep(int why) { }
172
173 /**
Jorim Jaggi0d210f62015-07-10 14:24:44 -0700174 * Called when the device has finished going to sleep.
Adrian Roose99bc052017-11-20 17:55:31 +0100175 * @param why either {@link WindowManagerPolicyConstants#OFF_BECAUSE_OF_ADMIN},
176 * {@link WindowManagerPolicyConstants#OFF_BECAUSE_OF_USER}, or
177 * {@link WindowManagerPolicyConstants#OFF_BECAUSE_OF_TIMEOUT}.
Adrian Roos369907f2017-07-14 14:53:39 +0200178 *
179 * @deprecated use {@link com.android.systemui.keyguard.WakefulnessLifecycle}.
Jim Miller20daffd2013-10-07 14:59:53 -0700180 */
Adrian Roos369907f2017-07-14 14:53:39 +0200181 @Deprecated
Jorim Jaggi0d210f62015-07-10 14:24:44 -0700182 public void onFinishedGoingToSleep(int why) { }
Adrian Roos2fe592d2014-05-17 03:11:59 +0200183
184 /**
Jorim Jaggif1518da2015-07-30 11:56:36 -0700185 * Called when the screen has been turned on.
Adrian Roos369907f2017-07-14 14:53:39 +0200186 *
187 * @deprecated use {@link com.android.systemui.keyguard.ScreenLifecycle}.
Jorim Jaggif1518da2015-07-30 11:56:36 -0700188 */
Adrian Roos369907f2017-07-14 14:53:39 +0200189 @Deprecated
Jorim Jaggif1518da2015-07-30 11:56:36 -0700190 public void onScreenTurnedOn() { }
191
192 /**
193 * Called when the screen has been turned off.
Adrian Roos369907f2017-07-14 14:53:39 +0200194 *
195 * @deprecated use {@link com.android.systemui.keyguard.ScreenLifecycle}.
Jorim Jaggif1518da2015-07-30 11:56:36 -0700196 */
Adrian Roos369907f2017-07-14 14:53:39 +0200197 @Deprecated
Jorim Jaggif1518da2015-07-30 11:56:36 -0700198 public void onScreenTurnedOff() { }
199
200 /**
Adrian Roos2fe592d2014-05-17 03:11:59 +0200201 * Called when trust changes for a user.
202 */
203 public void onTrustChanged(int userId) { }
Jim Millerf41fc962014-06-18 16:33:51 -0700204
205 /**
Adrian Roos7861c662014-07-25 15:37:28 +0200206 * Called when trust being managed changes for a user.
207 */
208 public void onTrustManagedChanged(int userId) { }
209
210 /**
Adrian Roos94e15a52015-04-16 12:23:18 -0700211 * Called after trust was granted with non-zero flags.
Adrian Roos3c9a3502014-08-06 19:09:45 +0200212 */
Adrian Roos94e15a52015-04-16 12:23:18 -0700213 public void onTrustGrantedWithFlags(int flags, int userId) { }
Adrian Roos3c9a3502014-08-06 19:09:45 +0200214
215 /**
Jorim Jaggi83eb6bb2015-08-17 17:38:58 -0700216 * Called when a finger has been acquired.
217 * <p>
218 * It is guaranteed that either {@link #onFingerprintAuthenticated} or
219 * {@link #onFingerprintAuthFailed()} is called after this method eventually.
220 */
221 public void onFingerprintAcquired() { }
222
223 /**
224 * Called when a fingerprint couldn't be authenticated.
225 */
226 public void onFingerprintAuthFailed() { }
227
228 /**
Jim Millerf41fc962014-06-18 16:33:51 -0700229 * Called when a fingerprint is recognized.
Jim Miller9f0753f2015-03-23 23:59:22 -0700230 * @param userId the user id for which the fingerprint was authenticated
Jim Millerf41fc962014-06-18 16:33:51 -0700231 */
Jorim Jaggi83eb6bb2015-08-17 17:38:58 -0700232 public void onFingerprintAuthenticated(int userId) { }
Jorim Jaggi007f0e82015-08-14 13:56:01 -0700233
234 /**
Jim Miller9f0753f2015-03-23 23:59:22 -0700235 * Called when fingerprint provides help string (e.g. "Try again")
236 * @param msgId
237 * @param helpString
Jim Millerf41fc962014-06-18 16:33:51 -0700238 */
Jim Miller9f0753f2015-03-23 23:59:22 -0700239 public void onFingerprintHelp(int msgId, String helpString) { }
240
241 /**
242 * Called when fingerprint provides an semi-permanent error message
243 * (e.g. "Hardware not available").
244 * @param msgId one of the error messages listed in {@link FingerprintManager}
245 * @param errString
246 */
247 public void onFingerprintError(int msgId, String errString) { }
Jorim Jaggie7b12522014-08-06 16:41:21 +0200248
249 /**
250 * Called when the state of face unlock changed.
251 */
Adrian Roos4a410172014-08-20 17:41:44 +0200252 public void onFaceUnlockStateChanged(boolean running, int userId) { }
Jorim Jaggi27c9b742015-04-09 10:34:49 -0700253
254 /**
255 * Called when the fingerprint running state changed.
256 */
257 public void onFingerprintRunningStateChanged(boolean running) { }
Jorim Jaggi25b4d4b2015-08-11 15:54:06 -0700258
259 /**
260 * Called when the state that the user hasn't used strong authentication since quite some time
261 * has changed.
262 */
Adrian Roos1de8bcb2015-08-19 16:52:52 -0700263 public void onStrongAuthStateChanged(int userId) { }
Jorim Jaggid11d1a92016-08-16 16:02:32 -0700264
265 /**
266 * Called when the state whether we have a lockscreen wallpaper has changed.
267 */
268 public void onHasLockscreenWallpaperChanged(boolean hasLockscreenWallpaper) { }
Selim Cinek99415392016-09-09 14:58:41 -0700269
270 /**
271 * Called when the dream's window state is changed.
272 * @param dreaming true if the dream's window has been created and is visible
273 */
274 public void onDreamingStateChanged(boolean dreaming) { }
Lucas Dupinef886542018-01-03 16:03:07 -0800275
276 /**
277 * Called when an error message needs to be presented on the keyguard.
278 * Message will be visible briefly, and might be overridden by other keyguard events,
279 * like fingerprint authentication errors.
280 *
281 * @param message Message that indicates an error.
282 * @see KeyguardIndicationController.BaseKeyguardCallback#HIDE_DELAY_MS
283 * @see KeyguardIndicationController#showTransientIndication(CharSequence)
284 */
285 public void onTrustAgentErrorMessage(CharSequence message) { }
Alex Chauff7653d2018-02-01 17:18:08 +0000286
287
288 /**
289 * Called when a value of logout enabled is change.
290 */
291 public void onLogoutEnabledChanged() { }
292
Jim Millerbbf1a742012-07-17 18:30:30 -0700293}