Fields Summary |
---|
private static final String | TAG |
private static final boolean | DEBUG |
private static final boolean | DEBUG_SIM_STATES |
private static final int | FAILED_BIOMETRIC_UNLOCK_ATTEMPTS_BEFORE_BACKUP |
private static final int | LOW_BATTERY_THRESHOLD |
private static final String | ACTION_FACE_UNLOCK_STARTED |
private static final String | ACTION_FACE_UNLOCK_STOPPED |
private static final int | MSG_TIME_UPDATE |
private static final int | MSG_BATTERY_UPDATE |
private static final int | MSG_SIM_STATE_CHANGE |
private static final int | MSG_RINGER_MODE_CHANGED |
private static final int | MSG_PHONE_STATE_CHANGED |
private static final int | MSG_CLOCK_VISIBILITY_CHANGED |
private static final int | MSG_DEVICE_PROVISIONED |
private static final int | MSG_DPM_STATE_CHANGED |
private static final int | MSG_USER_SWITCHING |
private static final int | MSG_USER_REMOVED |
private static final int | MSG_KEYGUARD_VISIBILITY_CHANGED |
private static final int | MSG_BOOT_COMPLETED |
private static final int | MSG_USER_SWITCH_COMPLETE |
private static final int | MSG_SET_CURRENT_CLIENT_ID |
private static final int | MSG_SET_PLAYBACK_STATE |
private static final int | MSG_USER_INFO_CHANGED |
private static final int | MSG_REPORT_EMERGENCY_CALL_ACTION |
private static final int | MSG_SCREEN_TURNED_ON |
private static final int | MSG_SCREEN_TURNED_OFF |
private static final int | MSG_KEYGUARD_BOUNCER_CHANGED |
private static final int | MSG_FINGERPRINT_PROCESSED |
private static final int | MSG_FINGERPRINT_ACQUIRED |
private static final int | MSG_FACE_UNLOCK_STATE_CHANGED |
private static final int | MSG_SIM_SUBSCRIPTION_INFO_CHANGED |
private static KeyguardUpdateMonitor | sInstance |
private final android.content.Context | mContext |
HashMap | mSimDatas |
private int | mRingMode |
private int | mPhoneState |
private boolean | mKeyguardIsVisible |
private boolean | mBouncer |
private boolean | mBootCompleted |
private boolean | mDeviceProvisioned |
private BatteryStatus | mBatteryStatus |
private int | mFailedAttempts |
private int | mFailedBiometricUnlockAttempts |
private boolean | mAlternateUnlockEnabled |
private boolean | mClockVisible |
private final ArrayList | mCallbacks |
private android.database.ContentObserver | mDeviceProvisionedObserver |
private boolean | mSwitchingUser |
private boolean | mScreenOn |
private android.telephony.SubscriptionManager | mSubscriptionManager |
private List | mSubscriptionInfo |
private final android.os.Handler | mHandler |
private android.telephony.SubscriptionManager.OnSubscriptionsChangedListener | mSubscriptionListener |
private android.util.SparseBooleanArray | mUserHasTrust |
private android.util.SparseBooleanArray | mUserTrustIsManaged |
private android.util.SparseBooleanArray | mUserFingerprintRecognized |
private android.util.SparseBooleanArray | mUserFaceUnlockRunning |
private DisplayClientState | mDisplayClientState |
private final android.content.BroadcastReceiver | mBroadcastReceiver |
private final android.content.BroadcastReceiver | mBroadcastAllReceiver |
private android.service.fingerprint.FingerprintManagerReceiver | mFingerprintManagerReceiver |
Methods Summary |
---|
public void | clearFailedUnlockAttempts()
mFailedAttempts = 0;
mFailedBiometricUnlockAttempts = 0;
|
public void | clearFingerprintRecognized()
mUserFingerprintRecognized.clear();
|
public void | dispatchBootCompleted()This is exposed since {@link Intent#ACTION_BOOT_COMPLETED} is not sticky. If
keyguard crashes sometime after boot, then it will never receive this
broadcast and hence not handle the event. This method is ultimately called by
PhoneWindowManager in this case.
mHandler.sendEmptyMessage(MSG_BOOT_COMPLETED);
|
public void | dispatchScreenTurndOff(int why)
synchronized(this) {
mScreenOn = false;
}
mHandler.sendMessage(mHandler.obtainMessage(MSG_SCREEN_TURNED_OFF, why, 0));
|
public void | dispatchScreenTurnedOn()
synchronized (this) {
mScreenOn = true;
}
mHandler.sendEmptyMessage(MSG_SCREEN_TURNED_ON);
|
public void | dispatchSetBackground(android.graphics.Bitmap bmp)IMPORTANT: Must be called from UI thread.
if (DEBUG) Log.d(TAG, "dispatchSetBackground");
final int count = mCallbacks.size();
for (int i = 0; i < count; i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onSetBackground(bmp);
}
}
|
public com.android.keyguard.KeyguardUpdateMonitor$DisplayClientState | getCachedDisplayClientState()
return mDisplayClientState;
|
private java.lang.CharSequence | getDefaultPlmn()
return mContext.getResources().getText(R.string.keyguard_carrier_default);
|
public int | getFailedUnlockAttempts()
return mFailedAttempts;
|
public static com.android.keyguard.KeyguardUpdateMonitor | getInstance(android.content.Context context)
if (sInstance == null) {
sInstance = new KeyguardUpdateMonitor(context);
}
return sInstance;
|
public boolean | getMaxBiometricUnlockAttemptsReached()
return mFailedBiometricUnlockAttempts >= FAILED_BIOMETRIC_UNLOCK_ATTEMPTS_BEFORE_BACKUP;
|
public int | getNextSubIdForState(com.android.internal.telephony.IccCardConstants.State state)Find the next SubscriptionId for a SIM in the given state, favoring lower slot numbers first.
List<SubscriptionInfo> list = getSubscriptionInfo(false /* forceReload */);
int resultId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
int bestSlotId = Integer.MAX_VALUE; // Favor lowest slot first
for (int i = 0; i < list.size(); i++) {
final SubscriptionInfo info = list.get(i);
final int id = info.getSubscriptionId();
int slotId = SubscriptionManager.getSlotId(id);
if (state == getSimState(id) && bestSlotId > slotId ) {
resultId = id;
bestSlotId = slotId;
}
}
return resultId;
|
public int | getPhoneState()
return mPhoneState;
|
public com.android.internal.telephony.IccCardConstants.State | getSimState(int subId)
if (mSimDatas.containsKey(subId)) {
return mSimDatas.get(subId).simState;
} else {
return State.UNKNOWN;
}
|
java.util.List | getSubscriptionInfo(boolean forceReload)
List<SubscriptionInfo> sil = mSubscriptionInfo;
if (sil == null || forceReload) {
sil = mSubscriptionManager.getActiveSubscriptionInfoList();
}
if (sil == null) {
// getActiveSubscriptionInfoList was null callers expect an empty list.
mSubscriptionInfo = new ArrayList<SubscriptionInfo>();
} else {
mSubscriptionInfo = sil;
}
return mSubscriptionInfo;
|
public android.telephony.SubscriptionInfo | getSubscriptionInfoForSubId(int subId)
List<SubscriptionInfo> list = getSubscriptionInfo(false /* forceReload */);
for (int i = 0; i < list.size(); i++) {
SubscriptionInfo info = list.get(i);
if (subId == info.getSubscriptionId()) return info;
}
return null; // not found
|
public boolean | getUserHasTrust(int userId)
return !isTrustDisabled(userId) && mUserHasTrust.get(userId)
|| mUserFingerprintRecognized.get(userId);
|
public boolean | getUserTrustIsManaged(int userId)
return mUserTrustIsManaged.get(userId) && !isTrustDisabled(userId);
|
private void | handleBatteryUpdate(com.android.keyguard.KeyguardUpdateMonitor$BatteryStatus status)Handle {@link #MSG_BATTERY_UPDATE}
if (DEBUG) Log.d(TAG, "handleBatteryUpdate");
final boolean batteryUpdateInteresting = isBatteryUpdateInteresting(mBatteryStatus, status);
mBatteryStatus = status;
if (batteryUpdateInteresting) {
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onRefreshBatteryInfo(status);
}
}
}
|
protected void | handleBootCompleted()Handle {@link #MSG_BOOT_COMPLETED}
if (mBootCompleted) return;
mBootCompleted = true;
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onBootCompleted();
}
}
|
private void | handleClockVisibilityChanged()Handle {@link #MSG_CLOCK_VISIBILITY_CHANGED}
if (DEBUG) Log.d(TAG, "handleClockVisibilityChanged()");
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onClockVisibilityChanged();
}
}
|
protected void | handleDevicePolicyManagerStateChanged()Handle {@link #MSG_DPM_STATE_CHANGED}
for (int i = mCallbacks.size() - 1; i >= 0; i--) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onDevicePolicyManagerStateChanged();
}
}
|
protected void | handleDeviceProvisioned()Handle {@link #MSG_DEVICE_PROVISIONED}
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onDeviceProvisioned();
}
}
if (mDeviceProvisionedObserver != null) {
// We don't need the observer anymore...
mContext.getContentResolver().unregisterContentObserver(mDeviceProvisionedObserver);
mDeviceProvisionedObserver = null;
}
|
private void | handleFaceUnlockStateChanged(boolean running, int userId)
mUserFaceUnlockRunning.put(userId, running);
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onFaceUnlockStateChanged(running, userId);
}
}
|
private void | handleFingerprintAcquired(int info)
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onFingerprintAcquired(info);
}
}
|
private void | handleFingerprintProcessed(int fingerprintId)
if (fingerprintId == 0) return; // not a valid fingerprint
final int userId;
try {
userId = ActivityManagerNative.getDefault().getCurrentUser().id;
} catch (RemoteException e) {
Log.e(TAG, "Failed to get current user id: ", e);
return;
}
if (isFingerprintDisabled(userId)) {
Log.d(TAG, "Fingerprint disabled by DPM for userId: " + userId);
return;
}
final ContentResolver res = mContext.getContentResolver();
final int ids[] = FingerprintUtils.getFingerprintIdsForUser(res, userId);
for (int i = 0; i < ids.length; i++) {
if (ids[i] == fingerprintId) {
onFingerprintRecognized(userId);
}
}
|
private void | handleKeyguardBouncerChanged(int bouncer)Handle {@link #MSG_KEYGUARD_BOUNCER_CHANGED}
if (DEBUG) Log.d(TAG, "handleKeyguardBouncerChanged(" + bouncer + ")");
boolean isBouncer = (bouncer == 1);
mBouncer = isBouncer;
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onKeyguardBouncerChanged(isBouncer);
}
}
|
private void | handleKeyguardVisibilityChanged(int showing)Handle {@link #MSG_KEYGUARD_VISIBILITY_CHANGED}
if (DEBUG) Log.d(TAG, "handleKeyguardVisibilityChanged(" + showing + ")");
boolean isShowing = (showing == 1);
mKeyguardIsVisible = isShowing;
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onKeyguardVisibilityChangedRaw(isShowing);
}
}
|
protected void | handlePhoneStateChanged(java.lang.String newState)Handle {@link #MSG_PHONE_STATE_CHANGED}
if (DEBUG) Log.d(TAG, "handlePhoneStateChanged(" + newState + ")");
if (TelephonyManager.EXTRA_STATE_IDLE.equals(newState)) {
mPhoneState = TelephonyManager.CALL_STATE_IDLE;
} else if (TelephonyManager.EXTRA_STATE_OFFHOOK.equals(newState)) {
mPhoneState = TelephonyManager.CALL_STATE_OFFHOOK;
} else if (TelephonyManager.EXTRA_STATE_RINGING.equals(newState)) {
mPhoneState = TelephonyManager.CALL_STATE_RINGING;
}
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onPhoneStateChanged(mPhoneState);
}
}
|
private void | handleReportEmergencyCallAction()Handle {@link #MSG_REPORT_EMERGENCY_CALL_ACTION}
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onEmergencyCallAction();
}
}
|
protected void | handleRingerModeChange(int mode)Handle {@link #MSG_RINGER_MODE_CHANGED}
if (DEBUG) Log.d(TAG, "handleRingerModeChange(" + mode + ")");
mRingMode = mode;
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onRingerModeChanged(mode);
}
}
|
protected void | handleScreenTurnedOff(int arg1)
clearFingerprintRecognized();
final int count = mCallbacks.size();
for (int i = 0; i < count; i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onScreenTurnedOff(arg1);
}
}
|
protected void | handleScreenTurnedOn()
final int count = mCallbacks.size();
for (int i = 0; i < count; i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onScreenTurnedOn();
}
}
|
private void | handleSimStateChange(int subId, int slotId, com.android.internal.telephony.IccCardConstants.State state)Handle {@link #MSG_SIM_STATE_CHANGE}
if (DEBUG_SIM_STATES) {
Log.d(TAG, "handleSimStateChange(subId=" + subId + ", slotId="
+ slotId + ", state=" + state +")");
}
if (!SubscriptionManager.isValidSubscriptionId(subId)) {
Log.w(TAG, "invalid subId in handleSimStateChange()");
return;
}
SimData data = mSimDatas.get(subId);
final boolean changed;
if (data == null) {
data = new SimData(state, slotId, subId);
mSimDatas.put(subId, data);
changed = true; // no data yet; force update
} else {
changed = (data.simState != state || data.subId != subId || data.slotId != slotId);
data.simState = state;
data.subId = subId;
data.slotId = slotId;
}
if (changed && state != State.UNKNOWN) {
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onSimStateChanged(subId, slotId, state);
}
}
}
|
protected void | handleSimSubscriptionInfoChanged()
if (DEBUG_SIM_STATES) {
Log.v(TAG, "onSubscriptionInfoChanged()");
List<SubscriptionInfo> sil = mSubscriptionManager.getActiveSubscriptionInfoList();
if (sil != null) {
for (SubscriptionInfo subInfo : sil) {
Log.v(TAG, "SubInfo:" + subInfo);
}
} else {
Log.v(TAG, "onSubscriptionInfoChanged: list is null");
}
}
List<SubscriptionInfo> subscriptionInfos = getSubscriptionInfo(true /* forceReload */);
// Hack level over 9000: Because the subscription id is not yet valid when we see the
// first update in handleSimStateChange, we need to force refresh all all SIM states
// so the subscription id for them is consistent.
ArrayList<SubscriptionInfo> changedSubscriptions = new ArrayList<>();
for (int i = 0; i < subscriptionInfos.size(); i++) {
SubscriptionInfo info = subscriptionInfos.get(i);
boolean changed = refreshSimState(info.getSubscriptionId(), info.getSimSlotIndex());
if (changed) {
changedSubscriptions.add(info);
}
}
for (int i = 0; i < changedSubscriptions.size(); i++) {
SimData data = mSimDatas.get(changedSubscriptions.get(i).getSubscriptionId());
for (int j = 0; j < mCallbacks.size(); j++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(j).get();
if (cb != null) {
cb.onSimStateChanged(data.subId, data.slotId, data.simState);
}
}
}
for (int j = 0; j < mCallbacks.size(); j++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(j).get();
if (cb != null) {
cb.onRefreshCarrierInfo();
}
}
|
private void | handleTimeUpdate()Handle {@link #MSG_TIME_UPDATE}
if (DEBUG) Log.d(TAG, "handleTimeUpdate");
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onTimeChanged();
}
}
|
private void | handleUserInfoChanged(int userId)
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onUserInfoChanged(userId);
}
}
|
protected void | handleUserRemoved(int userId)Handle {@link #MSG_USER_REMOVED}
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onUserRemoved(userId);
}
}
|
protected void | handleUserSwitchComplete(int userId)Handle {@link #MSG_USER_SWITCH_COMPLETE}
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onUserSwitchComplete(userId);
}
}
|
protected void | handleUserSwitching(int userId, android.os.IRemoteCallback reply)Handle {@link #MSG_USER_SWITCHING}
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onUserSwitching(userId);
}
}
try {
reply.sendResult(null);
} catch (RemoteException e) {
}
|
public boolean | hasBootCompleted()We need to store this state in the KeyguardUpdateMonitor since this class will not be
destroyed.
return mBootCompleted;
|
public boolean | isAlternateUnlockEnabled()
return mAlternateUnlockEnabled;
|
private static boolean | isBatteryUpdateInteresting(com.android.keyguard.KeyguardUpdateMonitor$BatteryStatus old, com.android.keyguard.KeyguardUpdateMonitor$BatteryStatus current)
final boolean nowPluggedIn = current.isPluggedIn();
final boolean wasPluggedIn = old.isPluggedIn();
final boolean stateChangedWhilePluggedIn =
wasPluggedIn == true && nowPluggedIn == true
&& (old.status != current.status);
// change in plug state is always interesting
if (wasPluggedIn != nowPluggedIn || stateChangedWhilePluggedIn) {
return true;
}
// change in battery level while plugged in
if (nowPluggedIn && old.level != current.level) {
return true;
}
// change where battery needs charging
if (!nowPluggedIn && current.isBatteryLow() && current.level != old.level) {
return true;
}
return false;
|
public boolean | isClockVisible()
return mClockVisible;
|
public boolean | isDeviceProvisioned()
return mDeviceProvisioned;
|
private boolean | isDeviceProvisionedInSettingsDb()
return Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.DEVICE_PROVISIONED, 0) != 0;
|
public boolean | isFaceUnlockRunning(int userId)
return mUserFaceUnlockRunning.get(userId);
|
private boolean | isFingerprintDisabled(int userId)
final DevicePolicyManager dpm =
(DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
return dpm != null && (dpm.getKeyguardDisabledFeatures(null, userId)
& DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT) != 0;
|
public boolean | isKeyguardBouncer()
return mBouncer;
|
public boolean | isKeyguardVisible()
return mKeyguardIsVisible;
|
public boolean | isScreenOn()
return mScreenOn;
|
public boolean | isSimPinSecure()
// True if any SIM is pin secure
for (SubscriptionInfo info : getSubscriptionInfo(false /* forceReload */)) {
if (isSimPinSecure(getSimState(info.getSubscriptionId()))) return true;
}
return false;
|
public static boolean | isSimPinSecure(com.android.internal.telephony.IccCardConstants.State state)
final IccCardConstants.State simState = state;
return (simState == IccCardConstants.State.PIN_REQUIRED
|| simState == IccCardConstants.State.PUK_REQUIRED
|| simState == IccCardConstants.State.PERM_DISABLED);
|
public boolean | isSimPinVoiceSecure()
// TODO: only count SIMs that handle voice
return isSimPinSecure();
|
public boolean | isSwitchingUser()
return mSwitchingUser;
|
private boolean | isTrustDisabled(int userId)
final DevicePolicyManager dpm =
(DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
if (dpm != null) {
// TODO once UI is finalized
final boolean disabledByGlobalActions = false;
final boolean disabledBySettings = false;
// Don't allow trust agent if device is secured with a SIM PIN. This is here
// mainly because there's no other way to prompt the user to enter their SIM PIN
// once they get past the keyguard screen.
final boolean disabledBySimPin = isSimPinSecure();
final boolean disabledByDpm = (dpm.getKeyguardDisabledFeatures(null, userId)
& DevicePolicyManager.KEYGUARD_DISABLE_TRUST_AGENTS) != 0;
return disabledByDpm || disabledByGlobalActions || disabledBySettings
|| disabledBySimPin;
}
return false;
|
private void | onFingerprintRecognized(int userId)
mUserFingerprintRecognized.put(userId, true);
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onFingerprintRecognized(userId);
}
}
|
public void | onTrustChanged(boolean enabled, int userId, boolean initiatedByUser)
mUserHasTrust.put(userId, enabled);
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onTrustChanged(userId);
if (enabled && initiatedByUser) {
cb.onTrustInitiatedByUser(userId);
}
}
}
|
public void | onTrustManagedChanged(boolean managed, int userId)
mUserTrustIsManaged.put(userId, managed);
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
cb.onTrustManagedChanged(userId);
}
}
|
private boolean | refreshSimState(int subId, int slotId)
// This is awful. It exists because there are two APIs for getting the SIM status
// that don't return the complete set of values and have different types. In Keyguard we
// need IccCardConstants, but TelephonyManager would only give us
// TelephonyManager.SIM_STATE*, so we retrieve it manually.
final TelephonyManager tele = TelephonyManager.from(mContext);
int simState = tele.getSimState(slotId);
State state;
try {
state = State.intToState(simState);
} catch(IllegalArgumentException ex) {
Log.w(TAG, "Unknown sim state: " + simState);
state = State.UNKNOWN;
}
SimData data = mSimDatas.get(subId);
final boolean changed;
if (data == null) {
data = new SimData(state, slotId, subId);
mSimDatas.put(subId, data);
changed = true; // no data yet; force update
} else {
changed = data.simState != state;
data.simState = state;
}
return changed;
|
public void | registerCallback(KeyguardUpdateMonitorCallback callback)Register to receive notifications about general keyguard information
(see {@link InfoCallback}.
if (DEBUG) Log.v(TAG, "*** register callback for " + callback);
// Prevent adding duplicate callbacks
for (int i = 0; i < mCallbacks.size(); i++) {
if (mCallbacks.get(i).get() == callback) {
if (DEBUG) Log.e(TAG, "Object tried to add another callback",
new Exception("Called by"));
return;
}
}
mCallbacks.add(new WeakReference<KeyguardUpdateMonitorCallback>(callback));
removeCallback(null); // remove unused references
sendUpdates(callback);
|
public void | removeCallback(KeyguardUpdateMonitorCallback callback)Remove the given observer's callback.
if (DEBUG) Log.v(TAG, "*** unregister callback for " + callback);
for (int i = mCallbacks.size() - 1; i >= 0; i--) {
if (mCallbacks.get(i).get() == callback) {
mCallbacks.remove(i);
}
}
|
public void | reportClockVisible(boolean visible)
mClockVisible = visible;
mHandler.obtainMessage(MSG_CLOCK_VISIBILITY_CHANGED).sendToTarget();
|
public void | reportEmergencyCallAction(boolean bypassHandler)Report that the emergency call button has been pressed and the emergency dialer is
about to be displayed.
if (!bypassHandler) {
mHandler.obtainMessage(MSG_REPORT_EMERGENCY_CALL_ACTION).sendToTarget();
} else {
handleReportEmergencyCallAction();
}
|
public void | reportFailedBiometricUnlockAttempt()
mFailedBiometricUnlockAttempts++;
|
public void | reportFailedUnlockAttempt()
mFailedAttempts++;
|
public void | reportSimUnlocked(int subId)Report that the user successfully entered the SIM PIN or PUK/SIM PIN so we
have the information earlier than waiting for the intent
broadcast from the telephony code.
NOTE: Because handleSimStateChange() invokes callbacks immediately without going
through mHandler, this *must* be called from the UI thread.
if (DEBUG_SIM_STATES) Log.v(TAG, "reportSimUnlocked(subId=" + subId + ")");
int slotId = SubscriptionManager.getSlotId(subId);
handleSimStateChange(subId, slotId, State.READY);
|
public void | sendKeyguardBouncerChanged(boolean showingBouncer)
if (DEBUG) Log.d(TAG, "sendKeyguardBouncerChanged(" + showingBouncer + ")");
Message message = mHandler.obtainMessage(MSG_KEYGUARD_BOUNCER_CHANGED);
message.arg1 = showingBouncer ? 1 : 0;
message.sendToTarget();
|
public void | sendKeyguardVisibilityChanged(boolean showing)
if (DEBUG) Log.d(TAG, "sendKeyguardVisibilityChanged(" + showing + ")");
Message message = mHandler.obtainMessage(MSG_KEYGUARD_VISIBILITY_CHANGED);
message.arg1 = showing ? 1 : 0;
message.sendToTarget();
|
private void | sendUpdates(KeyguardUpdateMonitorCallback callback)
// Notify listener of the current state
callback.onRefreshBatteryInfo(mBatteryStatus);
callback.onTimeChanged();
callback.onRingerModeChanged(mRingMode);
callback.onPhoneStateChanged(mPhoneState);
callback.onRefreshCarrierInfo();
callback.onClockVisibilityChanged();
for (Entry<Integer, SimData> data : mSimDatas.entrySet()) {
final SimData state = data.getValue();
callback.onSimStateChanged(state.subId, state.slotId, state.simState);
}
|
public void | setAlternateUnlockEnabled(boolean enabled)
mAlternateUnlockEnabled = enabled;
|
private void | watchForDeviceProvisioning()
mDeviceProvisionedObserver = new ContentObserver(mHandler) {
@Override
public void onChange(boolean selfChange) {
super.onChange(selfChange);
mDeviceProvisioned = isDeviceProvisionedInSettingsDb();
if (mDeviceProvisioned) {
mHandler.sendEmptyMessage(MSG_DEVICE_PROVISIONED);
}
if (DEBUG) Log.d(TAG, "DEVICE_PROVISIONED state = " + mDeviceProvisioned);
}
};
mContext.getContentResolver().registerContentObserver(
Settings.Global.getUriFor(Settings.Global.DEVICE_PROVISIONED),
false, mDeviceProvisionedObserver);
// prevent a race condition between where we check the flag and where we register the
// observer by grabbing the value once again...
boolean provisioned = isDeviceProvisionedInSettingsDb();
if (provisioned != mDeviceProvisioned) {
mDeviceProvisioned = provisioned;
if (mDeviceProvisioned) {
mHandler.sendEmptyMessage(MSG_DEVICE_PROVISIONED);
}
}
|