blob: bf9435e18b0e96cde8c64e5925e41c0eec6af290 [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;
Jim Millerbbf1a742012-07-17 18:30:30 -070020import android.media.AudioManager;
John Spurlock385a63d2013-10-30 19:40:48 -040021import android.os.SystemClock;
Jim Millerebbf2052015-03-31 17:24:34 -070022import android.hardware.fingerprint.FingerprintManager;
Jorim Jaggi5cf17872014-03-26 18:31:48 +010023import android.telephony.TelephonyManager;
Jim Miller20daffd2013-10-07 14:59:53 -070024import android.view.WindowManagerPolicy;
Jim Millerbbf1a742012-07-17 18:30:30 -070025
Jim Millerbbf1a742012-07-17 18:30:30 -070026import com.android.internal.telephony.IccCardConstants;
27
28/**
29 * Callback for general information relevant to lock screen.
30 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +010031public class KeyguardUpdateMonitorCallback {
John Spurlock385a63d2013-10-30 19:40:48 -040032
33 private static final long VISIBILITY_CHANGED_COLLAPSE_MS = 1000;
34 private long mVisibilityChangedCalled;
35 private boolean mShowing;
36
Jim Millerbbf1a742012-07-17 18:30:30 -070037 /**
38 * Called when the battery status changes, e.g. when plugged in or unplugged, charge
39 * level, etc. changes.
40 *
41 * @param status current battery status
42 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +010043 public void onRefreshBatteryInfo(KeyguardUpdateMonitor.BatteryStatus status) { }
Jim Millerbbf1a742012-07-17 18:30:30 -070044
45 /**
46 * Called once per minute or when the time changes.
47 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +010048 public void onTimeChanged() { }
Jim Millerbbf1a742012-07-17 18:30:30 -070049
50 /**
51 * Called when the carrier PLMN or SPN changes.
Jim Millerbbf1a742012-07-17 18:30:30 -070052 */
Jason Monk9ff69bd2014-12-02 16:43:17 -050053 public void onRefreshCarrierInfo() { }
Jim Millerbbf1a742012-07-17 18:30:30 -070054
55 /**
56 * Called when the ringer mode changes.
57 * @param state the current ringer state, as defined in
58 * {@link AudioManager#RINGER_MODE_CHANGED_ACTION}
59 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +010060 public void onRingerModeChanged(int state) { }
Jim Millerbbf1a742012-07-17 18:30:30 -070061
62 /**
63 * Called when the phone state changes. String will be one of:
64 * {@link TelephonyManager#EXTRA_STATE_IDLE}
65 * {@link TelephonyManager@EXTRA_STATE_RINGING}
66 * {@link TelephonyManager#EXTRA_STATE_OFFHOOK
67 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +010068 public void onPhoneStateChanged(int phoneState) { }
Jim Millerbbf1a742012-07-17 18:30:30 -070069
70 /**
Danielle Millettf6d0fc12012-10-23 16:16:52 -040071 * Called when the visibility of the keyguard changes.
72 * @param showing Indicates if the keyguard is now visible.
73 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +010074 public void onKeyguardVisibilityChanged(boolean showing) { }
Danielle Millettf6d0fc12012-10-23 16:16:52 -040075
Jorim Jaggi5cf17872014-03-26 18:31:48 +010076 public void onKeyguardVisibilityChangedRaw(boolean showing) {
John Spurlock385a63d2013-10-30 19:40:48 -040077 final long now = SystemClock.elapsedRealtime();
78 if (showing == mShowing
79 && (now - mVisibilityChangedCalled) < VISIBILITY_CHANGED_COLLAPSE_MS) return;
80 onKeyguardVisibilityChanged(showing);
81 mVisibilityChangedCalled = now;
82 mShowing = showing;
83 }
84
Danielle Millettf6d0fc12012-10-23 16:16:52 -040085 /**
Adrian Roosb6011622014-05-14 15:52:53 +020086 * Called when the keyguard enters or leaves bouncer mode.
87 * @param bouncer if true, keyguard is now in bouncer mode.
88 */
89 public void onKeyguardBouncerChanged(boolean bouncer) { }
90
91 /**
Jim Millerbbf1a742012-07-17 18:30:30 -070092 * Called when visibility of lockscreen clock changes, such as when
93 * obscured by a widget.
94 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +010095 public void onClockVisibilityChanged() { }
Jim Millerbbf1a742012-07-17 18:30:30 -070096
97 /**
98 * Called when the device becomes provisioned
99 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100100 public void onDeviceProvisioned() { }
Jim Millerbbf1a742012-07-17 18:30:30 -0700101
102 /**
103 * Called when the device policy changes.
104 * See {@link DevicePolicyManager#ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED}
105 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100106 public void onDevicePolicyManagerStateChanged() { }
Jim Millerbbf1a742012-07-17 18:30:30 -0700107
108 /**
Chris Wrenf41c61b2012-11-29 15:19:54 -0500109 * Called when the user change begins.
Jim Millerbbf1a742012-07-17 18:30:30 -0700110 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100111 public void onUserSwitching(int userId) { }
Chris Wrenf41c61b2012-11-29 15:19:54 -0500112
113 /**
114 * Called when the user change is complete.
115 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100116 public void onUserSwitchComplete(int userId) { }
Jim Millerbbf1a742012-07-17 18:30:30 -0700117
118 /**
119 * Called when the SIM state changes.
Jim Miller52a61332014-11-12 19:29:51 -0800120 * @param slotId
Jim Millerbbf1a742012-07-17 18:30:30 -0700121 * @param simState
122 */
Jim Miller52a61332014-11-12 19:29:51 -0800123 public void onSimStateChanged(int subId, int slotId, IccCardConstants.State simState) { }
Jim Millerbbf1a742012-07-17 18:30:30 -0700124
125 /**
Amith Yamasani6fc1d4e2013-05-08 16:43:58 -0700126 * Called when the user's info changed.
127 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100128 public void onUserInfoChanged(int userId) { }
Amith Yamasani6fc1d4e2013-05-08 16:43:58 -0700129
130 /**
Adam Cohenefb3ffb2012-11-06 16:55:32 -0800131 * Called when boot completed.
132 *
133 * Note, this callback will only be received if boot complete occurs after registering with
134 * KeyguardUpdateMonitor.
135 */
Jorim Jaggi5cf17872014-03-26 18:31:48 +0100136 public void onBootCompleted() { }
Jim Miller8f09fd22013-03-14 19:04:28 -0700137
138 /**
Brian Colonna7fce3802013-09-17 15:51:32 -0400139 * Called when the emergency call button is pressed.
140 */
John Spurlock813552c2014-09-19 08:30:21 -0400141 public void onEmergencyCallAction() { }
Adam Powell43a372f2013-09-27 17:43:53 -0700142
Jim Miller20daffd2013-10-07 14:59:53 -0700143 /**
144 * Called when the transport background changes.
145 * @param bitmap
146 */
Adam Powell43a372f2013-09-27 17:43:53 -0700147 public void onSetBackground(Bitmap bitmap) {
Adam Powell43a372f2013-09-27 17:43:53 -0700148 }
Jim Miller20daffd2013-10-07 14:59:53 -0700149
150 /**
Jorim Jaggi0d210f62015-07-10 14:24:44 -0700151 * Called when the device has started waking up.
Jim Miller20daffd2013-10-07 14:59:53 -0700152 */
Jorim Jaggi0d210f62015-07-10 14:24:44 -0700153 public void onStartedWakingUp() { }
Jim Miller20daffd2013-10-07 14:59:53 -0700154
155 /**
Jorim Jaggi0d210f62015-07-10 14:24:44 -0700156 * Called when the device has finished going to sleep.
Jeff Brown140ffc72014-05-01 15:18:00 -0700157 * @param why either {@link WindowManagerPolicy#OFF_BECAUSE_OF_ADMIN},
158 * {@link WindowManagerPolicy#OFF_BECAUSE_OF_USER}, or
159 * {@link WindowManagerPolicy#OFF_BECAUSE_OF_TIMEOUT}.
Jim Miller20daffd2013-10-07 14:59:53 -0700160 */
Jorim Jaggi0d210f62015-07-10 14:24:44 -0700161 public void onFinishedGoingToSleep(int why) { }
Adrian Roos2fe592d2014-05-17 03:11:59 +0200162
163 /**
Jorim Jaggif1518da2015-07-30 11:56:36 -0700164 * Called when the screen has been turned on.
165 */
166 public void onScreenTurnedOn() { }
167
168 /**
169 * Called when the screen has been turned off.
170 */
171 public void onScreenTurnedOff() { }
172
173 /**
Adrian Roos2fe592d2014-05-17 03:11:59 +0200174 * Called when trust changes for a user.
175 */
176 public void onTrustChanged(int userId) { }
Jim Millerf41fc962014-06-18 16:33:51 -0700177
178 /**
Adrian Roos7861c662014-07-25 15:37:28 +0200179 * Called when trust being managed changes for a user.
180 */
181 public void onTrustManagedChanged(int userId) { }
182
183 /**
Adrian Roos94e15a52015-04-16 12:23:18 -0700184 * Called after trust was granted with non-zero flags.
Adrian Roos3c9a3502014-08-06 19:09:45 +0200185 */
Adrian Roos94e15a52015-04-16 12:23:18 -0700186 public void onTrustGrantedWithFlags(int flags, int userId) { }
Adrian Roos3c9a3502014-08-06 19:09:45 +0200187
188 /**
Jim Millerf41fc962014-06-18 16:33:51 -0700189 * Called when a fingerprint is recognized.
Jim Miller9f0753f2015-03-23 23:59:22 -0700190 * @param userId the user id for which the fingerprint was authenticated
Jorim Jaggi740452e2015-07-09 12:13:59 -0700191 * @param wakeAndUnlocking whether the authentication woke the device up and thus we'd like to
192 * dismiss the lockscreen before turning on the screen
Jim Millerf41fc962014-06-18 16:33:51 -0700193 */
Jorim Jaggi740452e2015-07-09 12:13:59 -0700194 public void onFingerprintAuthenticated(int userId, boolean wakeAndUnlocking) { }
Jim Millerf41fc962014-06-18 16:33:51 -0700195
196 /**
Jorim Jaggi007f0e82015-08-14 13:56:01 -0700197 * Called when we might be starting a wake-and-unlock sequence.
198 */
199 public void onFingerprintWakeAndUnlockingStarted() { }
200
201 /**
202 * Called when we're done with the wake-and-unlock sequence. This can either happen when we
203 * figure out that the fingerprint didn't match, or when the phone is fully unlocked.
204 */
205 public void onFingerprintWakeAndUnlockingFinished() { }
206
207 /**
Jim Miller9f0753f2015-03-23 23:59:22 -0700208 * Called when fingerprint provides help string (e.g. "Try again")
209 * @param msgId
210 * @param helpString
Jim Millerf41fc962014-06-18 16:33:51 -0700211 */
Jim Miller9f0753f2015-03-23 23:59:22 -0700212 public void onFingerprintHelp(int msgId, String helpString) { }
213
214 /**
215 * Called when fingerprint provides an semi-permanent error message
216 * (e.g. "Hardware not available").
217 * @param msgId one of the error messages listed in {@link FingerprintManager}
218 * @param errString
219 */
220 public void onFingerprintError(int msgId, String errString) { }
Jorim Jaggie7b12522014-08-06 16:41:21 +0200221
222 /**
223 * Called when the state of face unlock changed.
224 */
Adrian Roos4a410172014-08-20 17:41:44 +0200225 public void onFaceUnlockStateChanged(boolean running, int userId) { }
Jorim Jaggi27c9b742015-04-09 10:34:49 -0700226
227 /**
228 * Called when the fingerprint running state changed.
229 */
230 public void onFingerprintRunningStateChanged(boolean running) { }
Jorim Jaggi25b4d4b2015-08-11 15:54:06 -0700231
232 /**
233 * Called when the state that the user hasn't used strong authentication since quite some time
234 * has changed.
235 */
236 public void onStrongAuthTimeoutExpiredChanged(int userId) { }
Jim Millerbbf1a742012-07-17 18:30:30 -0700237}