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