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.PendingIntent; 19 import android.app.admin.DevicePolicyManager; 20 import android.graphics.Bitmap; 21 import android.media.AudioManager; 22 import android.view.WindowManagerPolicy; 23 24 import com.android.internal.telephony.IccCardConstants; 25 26 /** 27 * Callback for general information relevant to lock screen. 28 */ 29 class KeyguardUpdateMonitorCallback { 30 /** 31 * Called when the battery status changes, e.g. when plugged in or unplugged, charge 32 * level, etc. changes. 33 * 34 * @param status current battery status 35 */ 36 void onRefreshBatteryInfo(KeyguardUpdateMonitor.BatteryStatus status) { } 37 38 /** 39 * Called once per minute or when the time changes. 40 */ 41 void onTimeChanged() { } 42 43 /** 44 * Called when the carrier PLMN or SPN changes. 45 * 46 * @param plmn The operator name of the registered network. May be null if it shouldn't 47 * be displayed. 48 * @param spn The service provider name. May be null if it shouldn't be displayed. 49 */ 50 void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) { } 51 52 /** 53 * Called when the ringer mode changes. 54 * @param state the current ringer state, as defined in 55 * {@link AudioManager#RINGER_MODE_CHANGED_ACTION} 56 */ 57 void onRingerModeChanged(int state) { } 58 59 /** 60 * Called when the phone state changes. String will be one of: 61 * {@link TelephonyManager#EXTRA_STATE_IDLE} 62 * {@link TelephonyManager@EXTRA_STATE_RINGING} 63 * {@link TelephonyManager#EXTRA_STATE_OFFHOOK 64 */ 65 void onPhoneStateChanged(int phoneState) { } 66 67 /** 68 * Called when the visibility of the keyguard changes. 69 * @param showing Indicates if the keyguard is now visible. 70 */ 71 void onKeyguardVisibilityChanged(boolean showing) { } 72 73 /** 74 * Called when visibility of lockscreen clock changes, such as when 75 * obscured by a widget. 76 */ 77 void onClockVisibilityChanged() { } 78 79 /** 80 * Called when the device becomes provisioned 81 */ 82 void onDeviceProvisioned() { } 83 84 /** 85 * Called when the device policy changes. 86 * See {@link DevicePolicyManager#ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED} 87 */ 88 void onDevicePolicyManagerStateChanged() { } 89 90 /** 91 * Called when the user change begins. 92 */ 93 void onUserSwitching(int userId) { } 94 95 /** 96 * Called when the user change is complete. 97 */ 98 void onUserSwitchComplete(int userId) { } 99 100 /** 101 * Called when the SIM state changes. 102 * @param simState 103 */ 104 void onSimStateChanged(IccCardConstants.State simState) { } 105 106 /** 107 * Called when a user is removed. 108 */ 109 void onUserRemoved(int userId) { } 110 111 /** 112 * Called when the user's info changed. 113 */ 114 void onUserInfoChanged(int userId) { } 115 116 /** 117 * Called when boot completed. 118 * 119 * Note, this callback will only be received if boot complete occurs after registering with 120 * KeyguardUpdateMonitor. 121 */ 122 void onBootCompleted() { } 123 124 /** 125 * Called when audio client attaches or detaches from AudioManager. 126 */ 127 void onMusicClientIdChanged(int clientGeneration, boolean clearing, PendingIntent intent) { } 128 129 /** 130 * Called when the audio playback state changes. 131 * @param playbackState 132 * @param eventTime 133 */ 134 public void onMusicPlaybackStateChanged(int playbackState, long eventTime) { } 135 136 /** 137 * Called when the emergency call button is pressed. 138 */ 139 void onEmergencyCallAction() { } 140 141 /** 142 * Called when the transport background changes. 143 * @param bitmap 144 */ 145 public void onSetBackground(Bitmap bitmap) { 146 } 147 148 /** 149 * Called when the screen turns on 150 */ 151 public void onScreenTurnedOn() { } 152 153 /** 154 * Called when the screen turns off 155 * @param why {@link WindowManagerPolicy#OFF_BECAUSE_OF_USER}, 156 * {@link WindowManagerPolicy#OFF_BECAUSE_OF_TIMEOUT} or 157 * {@link WindowManagerPolicy#OFF_BECAUSE_OF_PROX_SENSOR}. 158 */ 159 public void onScreenTurnedOff(int why) { } 160 } 161