blob: 756a7a4ee6560c618dea75ea7ab305627baa7c7f [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 /**
151 * Called when the screen turns on
152 */
153 public void onScreenTurnedOn() { }
154
155 /**
156 * Called when the screen turns off
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 */
161 public void onScreenTurnedOff(int why) { }
Adrian Roos2fe592d2014-05-17 03:11:59 +0200162
163 /**
164 * Called when trust changes for a user.
165 */
166 public void onTrustChanged(int userId) { }
Jim Millerf41fc962014-06-18 16:33:51 -0700167
168 /**
Adrian Roos7861c662014-07-25 15:37:28 +0200169 * Called when trust being managed changes for a user.
170 */
171 public void onTrustManagedChanged(int userId) { }
172
173 /**
Adrian Roos3c9a3502014-08-06 19:09:45 +0200174 * Called when the user has proved to a trust agent that they want to use the device.
175 */
176 public void onTrustInitiatedByUser(int userId) { }
177
178 /**
Jim Millerf41fc962014-06-18 16:33:51 -0700179 * Called when a fingerprint is recognized.
Jim Miller9f0753f2015-03-23 23:59:22 -0700180 * @param userId the user id for which the fingerprint was authenticated
Jim Millerf41fc962014-06-18 16:33:51 -0700181 */
Jim Miller9f0753f2015-03-23 23:59:22 -0700182 public void onFingerprintAuthenticated(int userId) { }
Jim Millerf41fc962014-06-18 16:33:51 -0700183
184 /**
Jim Miller9f0753f2015-03-23 23:59:22 -0700185 * Called when fingerprint provides help string (e.g. "Try again")
186 * @param msgId
187 * @param helpString
Jim Millerf41fc962014-06-18 16:33:51 -0700188 */
Jim Miller9f0753f2015-03-23 23:59:22 -0700189 public void onFingerprintHelp(int msgId, String helpString) { }
190
191 /**
192 * Called when fingerprint provides an semi-permanent error message
193 * (e.g. "Hardware not available").
194 * @param msgId one of the error messages listed in {@link FingerprintManager}
195 * @param errString
196 */
197 public void onFingerprintError(int msgId, String errString) { }
Jorim Jaggie7b12522014-08-06 16:41:21 +0200198
199 /**
200 * Called when the state of face unlock changed.
201 */
Adrian Roos4a410172014-08-20 17:41:44 +0200202 public void onFaceUnlockStateChanged(boolean running, int userId) { }
Jorim Jaggi27c9b742015-04-09 10:34:49 -0700203
204 /**
205 * Called when the fingerprint running state changed.
206 */
207 public void onFingerprintRunningStateChanged(boolean running) { }
Jim Millerbbf1a742012-07-17 18:30:30 -0700208}