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.hardware.biometrics.BiometricSourceType; 19 import android.telephony.TelephonyManager; 20 import android.view.WindowManagerPolicyConstants; 21 22 import androidx.annotation.NonNull; 23 import androidx.annotation.Nullable; 24 25 import com.android.settingslib.fuelgauge.BatteryStatus; 26 import com.android.systemui.plugins.WeatherData; 27 import com.android.systemui.statusbar.KeyguardIndicationController; 28 29 import java.util.TimeZone; 30 31 /** 32 * Callback for general information relevant to lock screen. 33 */ 34 public class KeyguardUpdateMonitorCallback { 35 36 /** 37 * Called when the battery status changes, e.g. when plugged in or unplugged, charge 38 * level, etc. changes. 39 * 40 * @param status current battery status 41 */ onRefreshBatteryInfo(BatteryStatus status)42 public void onRefreshBatteryInfo(BatteryStatus status) { } 43 44 /** 45 * Called once per minute or when the time changes. 46 */ onTimeChanged()47 public void onTimeChanged() { } 48 49 /** 50 * Called when time zone changes. 51 * 52 * @note When time zone changes, onTimeChanged will be called too. 53 */ onTimeZoneChanged(TimeZone timeZone)54 public void onTimeZoneChanged(TimeZone timeZone) { } 55 56 /** 57 * Called when time format changes. 58 */ onTimeFormatChanged(String timeFormat)59 public void onTimeFormatChanged(String timeFormat) { } 60 61 /** 62 * Called when receive new weather data. 63 */ onWeatherDataChanged(WeatherData data)64 public void onWeatherDataChanged(WeatherData data) { } 65 66 /** 67 * Called when the carrier PLMN or SPN changes. 68 */ onRefreshCarrierInfo()69 public void onRefreshCarrierInfo() { } 70 71 /** 72 * Called when the phone state changes. String will be one of: 73 * {@link TelephonyManager#EXTRA_STATE_IDLE} 74 * {@link TelephonyManager@EXTRA_STATE_RINGING} 75 * {@link TelephonyManager#EXTRA_STATE_OFFHOOK 76 */ onPhoneStateChanged(int phoneState)77 public void onPhoneStateChanged(int phoneState) { } 78 79 /** 80 * Called when the keyguard enters or leaves bouncer mode. 81 * @param bouncerIsOrWillBeShowing if true, keyguard is showing the bouncer or transitioning 82 * from/to bouncer mode. 83 */ onKeyguardBouncerStateChanged(boolean bouncerIsOrWillBeShowing)84 public void onKeyguardBouncerStateChanged(boolean bouncerIsOrWillBeShowing) { } 85 86 /** 87 * Called when the keyguard visibility changes. 88 * @param visible whether the keyguard is showing and is NOT occluded 89 */ onKeyguardVisibilityChanged(boolean visible)90 public void onKeyguardVisibilityChanged(boolean visible) { } 91 92 /** 93 * Called when the keyguard fully transitions to the bouncer or is no longer the bouncer 94 * @param bouncerIsFullyShowing if true, keyguard is fully showing the bouncer 95 */ onKeyguardBouncerFullyShowingChanged(boolean bouncerIsFullyShowing)96 public void onKeyguardBouncerFullyShowingChanged(boolean bouncerIsFullyShowing) { } 97 98 /** 99 * Called when the dismissing animation of keyguard and surfaces behind is finished. 100 * If the surface behind is the Launcher, we may still be playing in-window animations 101 * when this is called (since it's only called once we dismiss the keyguard and end the 102 * remote animation). 103 */ onKeyguardDismissAnimationFinished()104 public void onKeyguardDismissAnimationFinished() { } 105 106 /** 107 * Called when the device becomes provisioned 108 */ onDeviceProvisioned()109 public void onDeviceProvisioned() { } 110 111 /** 112 * Called when the user change begins. 113 */ onUserSwitching(int userId)114 public void onUserSwitching(int userId) { } 115 116 /** 117 * Called when the user change is complete. 118 */ onUserSwitchComplete(int userId)119 public void onUserSwitchComplete(int userId) { } 120 121 /** 122 * Called when the Telephony capable 123 * @param capable 124 */ onTelephonyCapable(boolean capable)125 public void onTelephonyCapable(boolean capable) { } 126 127 /** 128 * Called when the SIM state changes. 129 * @param slotId 130 * @param simState 131 */ onSimStateChanged(int subId, int slotId, int simState)132 public void onSimStateChanged(int subId, int slotId, int simState) { } 133 134 /** 135 * Called when a user got unlocked. 136 */ onUserUnlocked()137 public void onUserUnlocked() { } 138 139 /** 140 * Called when the emergency call button is pressed. 141 */ onEmergencyCallAction()142 public void onEmergencyCallAction() { } 143 144 /** 145 * Called when the device has started waking up and after biometric states are updated. 146 * 147 * @deprecated use {@link com.android.systemui.keyguard.WakefulnessLifecycle}. 148 */ 149 @Deprecated onStartedWakingUp()150 public void onStartedWakingUp() { } 151 152 /** 153 * Called when the device has started going to sleep and after biometric recognized 154 * states are reset. 155 * @param why see {@link #onFinishedGoingToSleep(int)} 156 * 157 * @deprecated use {@link com.android.systemui.keyguard.WakefulnessLifecycle}. 158 */ 159 @Deprecated onStartedGoingToSleep(int why)160 public void onStartedGoingToSleep(int why) { } 161 162 /** 163 * Called when the device has finished going to sleep. 164 * @param why either {@link WindowManagerPolicyConstants#OFF_BECAUSE_OF_ADMIN}, 165 * {@link WindowManagerPolicyConstants#OFF_BECAUSE_OF_USER}, or 166 * {@link WindowManagerPolicyConstants#OFF_BECAUSE_OF_TIMEOUT}. 167 * 168 * @deprecated use {@link com.android.systemui.keyguard.WakefulnessLifecycle}. 169 */ 170 @Deprecated onFinishedGoingToSleep(int why)171 public void onFinishedGoingToSleep(int why) { } 172 173 /** 174 * Called when trust changes for a user. 175 */ onTrustChanged(int userId)176 public void onTrustChanged(int userId) { } 177 178 /** 179 * Called when trust being managed changes for a user. 180 */ onTrustManagedChanged(int userId)181 public void onTrustManagedChanged(int userId) { } 182 183 /** 184 * Called after trust was granted. 185 * @param dismissKeyguard whether the keyguard should be dismissed as a result of the 186 * trustGranted 187 * @param newlyUnlocked whether the grantedTrust is believed to be the cause of a newly 188 * unlocked device (after being locked). 189 * @param message optional message the trust agent has provided to show that should indicate 190 * why trust was granted. 191 */ onTrustGrantedForCurrentUser( boolean dismissKeyguard, boolean newlyUnlocked, @NonNull TrustGrantFlags flags, @Nullable String message )192 public void onTrustGrantedForCurrentUser( 193 boolean dismissKeyguard, 194 boolean newlyUnlocked, 195 @NonNull TrustGrantFlags flags, 196 @Nullable String message 197 ) { } 198 199 /** 200 * Called when a biometric has been acquired. 201 * <p> 202 * It is guaranteed that either {@link #onBiometricAuthenticated} or 203 * {@link #onBiometricAuthFailed(BiometricSourceType)} is called after this method eventually. 204 * @param biometricSourceType 205 * @param acquireInfo see {@link android.hardware.biometrics.BiometricFaceConstants} and 206 * {@link android.hardware.biometrics.BiometricFingerprintConstants} 207 */ onBiometricAcquired(BiometricSourceType biometricSourceType, int acquireInfo)208 public void onBiometricAcquired(BiometricSourceType biometricSourceType, int acquireInfo) { } 209 210 /** 211 * Called when a biometric couldn't be authenticated. 212 * @param biometricSourceType 213 */ onBiometricAuthFailed(BiometricSourceType biometricSourceType)214 public void onBiometricAuthFailed(BiometricSourceType biometricSourceType) { } 215 216 /** 217 * Called when a biometric is authenticated. 218 * @param userId the user id for which the biometric sample was authenticated 219 * @param biometricSourceType 220 */ onBiometricAuthenticated(int userId, BiometricSourceType biometricSourceType, boolean isStrongBiometric)221 public void onBiometricAuthenticated(int userId, BiometricSourceType biometricSourceType, 222 boolean isStrongBiometric) { } 223 224 /** 225 * Called when a biometric is detected but not successfully authenticated. 226 * @param userId the user id for which the biometric sample was detected 227 * @param biometricSourceType 228 */ onBiometricDetected(int userId, BiometricSourceType biometricSourceType, boolean isStrongBiometric)229 public void onBiometricDetected(int userId, BiometricSourceType biometricSourceType, 230 boolean isStrongBiometric) { } 231 232 /** 233 * Called when biometric authentication provides help string (e.g. "Try again") 234 * @param msgId 235 * @param helpString 236 * @param biometricSourceType 237 */ onBiometricHelp(int msgId, String helpString, BiometricSourceType biometricSourceType)238 public void onBiometricHelp(int msgId, String helpString, 239 BiometricSourceType biometricSourceType) { } 240 241 /** 242 * Called when biometric authentication method provides a semi-permanent 243 * error message (e.g. "Hardware not available"). 244 * @param msgId one of the error messages listed in 245 * {@link android.hardware.biometrics.BiometricConstants} 246 * @param errString 247 * @param biometricSourceType 248 */ onBiometricError(int msgId, String errString, BiometricSourceType biometricSourceType)249 public void onBiometricError(int msgId, String errString, 250 BiometricSourceType biometricSourceType) { } 251 252 /** 253 * Called when biometric running state changed. 254 */ onBiometricRunningStateChanged(boolean running, BiometricSourceType biometricSourceType)255 public void onBiometricRunningStateChanged(boolean running, 256 BiometricSourceType biometricSourceType) { } 257 258 /** 259 * Called when the state that the user hasn't used strong authentication since quite some time 260 * has changed. 261 */ onStrongAuthStateChanged(int userId)262 public void onStrongAuthStateChanged(int userId) { } 263 264 /** 265 * When the current user's locked out state changed. 266 */ onLockedOutStateChanged(BiometricSourceType biometricSourceType)267 public void onLockedOutStateChanged(BiometricSourceType biometricSourceType) { } 268 269 /** 270 * Called when the dream's window state is changed. 271 * @param dreaming true if the dream's window has been created and is visible 272 */ onDreamingStateChanged(boolean dreaming)273 public void onDreamingStateChanged(boolean dreaming) { } 274 275 /** 276 * Called when an error message needs to be presented on the keyguard. 277 * Message will be visible briefly, and might be overridden by other keyguard events, 278 * like fingerprint authentication errors. 279 * 280 * @param message Message that indicates an error. 281 * @see KeyguardIndicationController#DEFAULT_HIDE_DELAY_MS 282 * @see KeyguardIndicationController#showTransientIndication(CharSequence) 283 */ onTrustAgentErrorMessage(CharSequence message)284 public void onTrustAgentErrorMessage(CharSequence message) { } 285 286 /** 287 * Called when a value of logout enabled is change. 288 */ onLogoutEnabledChanged()289 public void onLogoutEnabledChanged() { } 290 291 /** 292 * Called when authenticated biometrics are cleared. 293 */ onBiometricsCleared()294 public void onBiometricsCleared() { } 295 296 /** 297 * Called when the secondary lock screen requirement changes. 298 */ onSecondaryLockscreenRequirementChanged(int userId)299 public void onSecondaryLockscreenRequirementChanged(int userId) { } 300 301 /** 302 * Called when device policy manager state changes. 303 */ onDevicePolicyManagerStateChanged()304 public void onDevicePolicyManagerStateChanged() { } 305 306 /** 307 * Called when notifying user to unlock in order to use NFC. 308 */ onRequireUnlockForNfc()309 public void onRequireUnlockForNfc() { } 310 311 /** 312 * Called when the notification shade is expanded or collapsed. 313 */ onShadeExpandedChanged(boolean expanded)314 public void onShadeExpandedChanged(boolean expanded) { } 315 316 /** 317 * Called when the non-strong biometric state changed. 318 */ onNonStrongBiometricAllowedChanged(int userId)319 public void onNonStrongBiometricAllowedChanged(int userId) { } 320 321 /** 322 * Called when keyguard is going away or not going away. 323 */ onKeyguardGoingAway()324 public void onKeyguardGoingAway() { } 325 } 326