2 * Copyright (C) 2012 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package com.android.keyguard;
18 import android.app.PendingIntent;
19 import android.app.admin.DevicePolicyManager;
20 import android.graphics.Bitmap;
21 import android.media.AudioManager;
22 import android.os.SystemClock;
23 import android.telephony.TelephonyManager;
24 import android.view.WindowManagerPolicy;
26 import com.android.internal.telephony.IccCardConstants;
29 * Callback for general information relevant to lock screen.
31 public class KeyguardUpdateMonitorCallback {
33 private static final long VISIBILITY_CHANGED_COLLAPSE_MS = 1000;
34 private long mVisibilityChangedCalled;
35 private boolean mShowing;
38 * Called when the battery status changes, e.g. when plugged in or unplugged, charge
39 * level, etc. changes.
41 * @param status current battery status
43 public void onRefreshBatteryInfo(KeyguardUpdateMonitor.BatteryStatus status) { }
46 * Called once per minute or when the time changes.
48 public void onTimeChanged() { }
51 * Called when the carrier PLMN or SPN changes.
53 * @param plmn The operator name of the registered network. May be null if it shouldn't
55 * @param spn The service provider name. May be null if it shouldn't be displayed.
57 public void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) { }
60 * Called when the ringer mode changes.
61 * @param state the current ringer state, as defined in
62 * {@link AudioManager#RINGER_MODE_CHANGED_ACTION}
64 public void onRingerModeChanged(int state) { }
67 * Called when the phone state changes. String will be one of:
68 * {@link TelephonyManager#EXTRA_STATE_IDLE}
69 * {@link TelephonyManager@EXTRA_STATE_RINGING}
70 * {@link TelephonyManager#EXTRA_STATE_OFFHOOK
72 public void onPhoneStateChanged(int phoneState) { }
75 * Called when the visibility of the keyguard changes.
76 * @param showing Indicates if the keyguard is now visible.
78 public void onKeyguardVisibilityChanged(boolean showing) { }
80 public void onKeyguardVisibilityChangedRaw(boolean showing) {
81 final long now = SystemClock.elapsedRealtime();
82 if (showing == mShowing
83 && (now - mVisibilityChangedCalled) < VISIBILITY_CHANGED_COLLAPSE_MS) return;
84 onKeyguardVisibilityChanged(showing);
85 mVisibilityChangedCalled = now;
90 * Called when the keyguard enters or leaves bouncer mode.
91 * @param bouncer if true, keyguard is now in bouncer mode.
93 public void onKeyguardBouncerChanged(boolean bouncer) { }
96 * Called when visibility of lockscreen clock changes, such as when
97 * obscured by a widget.
99 public void onClockVisibilityChanged() { }
102 * Called when the device becomes provisioned
104 public void onDeviceProvisioned() { }
107 * Called when the device policy changes.
108 * See {@link DevicePolicyManager#ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED}
110 public void onDevicePolicyManagerStateChanged() { }
113 * Called when the user change begins.
115 public void onUserSwitching(int userId) { }
118 * Called when the user change is complete.
120 public void onUserSwitchComplete(int userId) { }
123 * Called when the SIM state changes.
126 public void onSimStateChanged(IccCardConstants.State simState) { }
129 * Called when a user is removed.
131 public void onUserRemoved(int userId) { }
134 * Called when the user's info changed.
136 public void onUserInfoChanged(int userId) { }
139 * Called when boot completed.
141 * Note, this callback will only be received if boot complete occurs after registering with
142 * KeyguardUpdateMonitor.
144 public void onBootCompleted() { }
147 * Called when the emergency call button is pressed.
149 void onEmergencyCallAction() { }
152 * Called when the transport background changes.
155 public void onSetBackground(Bitmap bitmap) {
159 * Called when the screen turns on
161 public void onScreenTurnedOn() { }
164 * Called when the screen turns off
165 * @param why either {@link WindowManagerPolicy#OFF_BECAUSE_OF_ADMIN},
166 * {@link WindowManagerPolicy#OFF_BECAUSE_OF_USER}, or
167 * {@link WindowManagerPolicy#OFF_BECAUSE_OF_TIMEOUT}.
169 public void onScreenTurnedOff(int why) { }
172 * Called when trust changes for a user.
174 public void onTrustChanged(int userId) { }
177 * Called when a fingerprint is recognized.
180 public void onFingerprintRecognized(int userId) { }
183 * Called when fingerprint is acquired but not yet recognized
185 public void onFingerprintAcquired(int info) { }