• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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  */
16 package com.android.keyguard;
17 
18 import android.app.admin.DevicePolicyManager;
19 import android.graphics.Bitmap;
20 import android.hardware.fingerprint.FingerprintManager;
21 import android.media.AudioManager;
22 import android.os.SystemClock;
23 import android.telephony.TelephonyManager;
24 import android.view.WindowManagerPolicyConstants;
25 
26 import com.android.internal.telephony.IccCardConstants;
27 import com.android.systemui.statusbar.KeyguardIndicationController;
28 
29 /**
30  * Callback for general information relevant to lock screen.
31  */
32 public class KeyguardUpdateMonitorCallback {
33 
34     private static final long VISIBILITY_CHANGED_COLLAPSE_MS = 1000;
35     private long mVisibilityChangedCalled;
36     private boolean mShowing;
37 
38     /**
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      */
onRefreshBatteryInfo(KeyguardUpdateMonitor.BatteryStatus status)44     public void onRefreshBatteryInfo(KeyguardUpdateMonitor.BatteryStatus status) { }
45 
46     /**
47      * Called once per minute or when the time changes.
48      */
onTimeChanged()49     public void onTimeChanged() { }
50 
51     /**
52      * Called when the carrier PLMN or SPN changes.
53      */
onRefreshCarrierInfo()54     public void onRefreshCarrierInfo() { }
55 
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      */
onRingerModeChanged(int state)61     public void onRingerModeChanged(int state) { }
62 
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      */
onPhoneStateChanged(int phoneState)69     public void onPhoneStateChanged(int phoneState) { }
70 
71     /**
72      * Called when the visibility of the keyguard changes.
73      * @param showing Indicates if the keyguard is now visible.
74      */
onKeyguardVisibilityChanged(boolean showing)75     public void onKeyguardVisibilityChanged(boolean showing) { }
76 
onKeyguardVisibilityChangedRaw(boolean showing)77     public void onKeyguardVisibilityChangedRaw(boolean showing) {
78         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 
86     /**
87      * Called when the keyguard enters or leaves bouncer mode.
88      * @param bouncer if true, keyguard is now in bouncer mode.
89      */
onKeyguardBouncerChanged(boolean bouncer)90     public void onKeyguardBouncerChanged(boolean bouncer) { }
91 
92     /**
93      * Called when visibility of lockscreen clock changes, such as when
94      * obscured by a widget.
95      */
onClockVisibilityChanged()96     public void onClockVisibilityChanged() { }
97 
98     /**
99      * Called when the device becomes provisioned
100      */
onDeviceProvisioned()101     public void onDeviceProvisioned() { }
102 
103     /**
104      * Called when the device policy changes.
105      * See {@link DevicePolicyManager#ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED}
106      */
onDevicePolicyManagerStateChanged()107     public void onDevicePolicyManagerStateChanged() { }
108 
109     /**
110      * Called when the user change begins.
111      */
onUserSwitching(int userId)112     public void onUserSwitching(int userId) { }
113 
114     /**
115      * Called when the user change is complete.
116      */
onUserSwitchComplete(int userId)117     public void onUserSwitchComplete(int userId) { }
118 
119     /**
120      * Called when the SIM state changes.
121      * @param slotId
122      * @param simState
123      */
onSimStateChanged(int subId, int slotId, IccCardConstants.State simState)124     public void onSimStateChanged(int subId, int slotId, IccCardConstants.State simState) { }
125 
126     /**
127      * Called when the user's info changed.
128      */
onUserInfoChanged(int userId)129     public void onUserInfoChanged(int userId) { }
130 
131     /**
132      * Called when a user got unlocked.
133      */
onUserUnlocked()134     public void onUserUnlocked() { }
135 
136     /**
137      * Called when boot completed.
138      *
139      * Note, this callback will only be received if boot complete occurs after registering with
140      * KeyguardUpdateMonitor.
141      */
onBootCompleted()142     public void onBootCompleted() { }
143 
144     /**
145      * Called when the emergency call button is pressed.
146      */
onEmergencyCallAction()147     public void onEmergencyCallAction() { }
148 
149     /**
150      * Called when the transport background changes.
151      * @param bitmap
152      */
onSetBackground(Bitmap bitmap)153     public void onSetBackground(Bitmap bitmap) {
154     }
155 
156     /**
157      * Called when the device has started waking up.
158      *
159      * @deprecated use {@link com.android.systemui.keyguard.WakefulnessLifecycle}.
160      */
161     @Deprecated
onStartedWakingUp()162     public void onStartedWakingUp() { }
163 
164     /**
165      * Called when the device has started going to sleep.
166      * @param why see {@link #onFinishedGoingToSleep(int)}
167      *
168      * @deprecated use {@link com.android.systemui.keyguard.WakefulnessLifecycle}.
169      */
170     @Deprecated
onStartedGoingToSleep(int why)171     public void onStartedGoingToSleep(int why) { }
172 
173     /**
174      * Called when the device has finished going to sleep.
175      * @param why either {@link WindowManagerPolicyConstants#OFF_BECAUSE_OF_ADMIN},
176      * {@link WindowManagerPolicyConstants#OFF_BECAUSE_OF_USER}, or
177      * {@link WindowManagerPolicyConstants#OFF_BECAUSE_OF_TIMEOUT}.
178      *
179      * @deprecated use {@link com.android.systemui.keyguard.WakefulnessLifecycle}.
180      */
181     @Deprecated
onFinishedGoingToSleep(int why)182     public void onFinishedGoingToSleep(int why) { }
183 
184     /**
185      * Called when the screen has been turned on.
186      *
187      * @deprecated use {@link com.android.systemui.keyguard.ScreenLifecycle}.
188      */
189     @Deprecated
onScreenTurnedOn()190     public void onScreenTurnedOn() { }
191 
192     /**
193      * Called when the screen has been turned off.
194      *
195      * @deprecated use {@link com.android.systemui.keyguard.ScreenLifecycle}.
196      */
197     @Deprecated
onScreenTurnedOff()198     public void onScreenTurnedOff() { }
199 
200     /**
201      * Called when trust changes for a user.
202      */
onTrustChanged(int userId)203     public void onTrustChanged(int userId) { }
204 
205     /**
206      * Called when trust being managed changes for a user.
207      */
onTrustManagedChanged(int userId)208     public void onTrustManagedChanged(int userId) { }
209 
210     /**
211      * Called after trust was granted with non-zero flags.
212      */
onTrustGrantedWithFlags(int flags, int userId)213     public void onTrustGrantedWithFlags(int flags, int userId) { }
214 
215     /**
216      * 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      */
onFingerprintAcquired()221     public void onFingerprintAcquired() { }
222 
223     /**
224      * Called when a fingerprint couldn't be authenticated.
225      */
onFingerprintAuthFailed()226     public void onFingerprintAuthFailed() { }
227 
228     /**
229      * Called when a fingerprint is recognized.
230      * @param userId the user id for which the fingerprint was authenticated
231      */
onFingerprintAuthenticated(int userId)232     public void onFingerprintAuthenticated(int userId) { }
233 
234     /**
235      * Called when fingerprint provides help string (e.g. "Try again")
236      * @param msgId
237      * @param helpString
238      */
onFingerprintHelp(int msgId, String helpString)239     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      */
onFingerprintError(int msgId, String errString)247     public void onFingerprintError(int msgId, String errString) { }
248 
249     /**
250      * Called when the state of face unlock changed.
251      */
onFaceUnlockStateChanged(boolean running, int userId)252     public void onFaceUnlockStateChanged(boolean running, int userId) { }
253 
254     /**
255      * Called when the fingerprint running state changed.
256      */
onFingerprintRunningStateChanged(boolean running)257     public void onFingerprintRunningStateChanged(boolean running) { }
258 
259     /**
260      * Called when the state that the user hasn't used strong authentication since quite some time
261      * has changed.
262      */
onStrongAuthStateChanged(int userId)263     public void onStrongAuthStateChanged(int userId) { }
264 
265     /**
266      * Called when the state whether we have a lockscreen wallpaper has changed.
267      */
onHasLockscreenWallpaperChanged(boolean hasLockscreenWallpaper)268     public void onHasLockscreenWallpaperChanged(boolean hasLockscreenWallpaper) { }
269 
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      */
onDreamingStateChanged(boolean dreaming)274     public void onDreamingStateChanged(boolean dreaming) { }
275 
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      */
onTrustAgentErrorMessage(CharSequence message)285     public void onTrustAgentErrorMessage(CharSequence message) { }
286 
287 
288     /**
289      * Called when a value of logout enabled is change.
290      */
onLogoutEnabledChanged()291     public void onLogoutEnabledChanged() { }
292 
293 }
294