FileDocCategorySizeDatePackage
UnlockMethodCache.javaAPI DocAndroid 5.1 API5090Thu Mar 12 22:22:42 GMT 2015com.android.systemui.statusbar.phone

UnlockMethodCache

public class UnlockMethodCache extends Object
Caches whether the current unlock method is insecure, taking trust into account. This information might be a little bit out of date and should not be used for actual security decisions; it should be only used for visual indications.

Fields Summary
private static UnlockMethodCache
sInstance
private final com.android.internal.widget.LockPatternUtils
mLockPatternUtils
private final com.android.keyguard.KeyguardUpdateMonitor
mKeyguardUpdateMonitor
private final ArrayList
mListeners
private boolean
mSecure
Whether the user configured a secure unlock method (PIN, password, etc.)
private boolean
mCurrentlyInsecure
Whether the unlock method is currently insecure (insecure method or trusted environment)
private boolean
mTrustManaged
private boolean
mFaceUnlockRunning
private final com.android.keyguard.KeyguardUpdateMonitorCallback
mCallback
Constructors Summary
private UnlockMethodCache(android.content.Context ctx)


       
        mLockPatternUtils = new LockPatternUtils(ctx);
        mKeyguardUpdateMonitor = KeyguardUpdateMonitor.getInstance(ctx);
        KeyguardUpdateMonitor.getInstance(ctx).registerCallback(mCallback);
        update(true /* updateAlways */);
    
Methods Summary
public voidaddListener(com.android.systemui.statusbar.phone.UnlockMethodCache$OnUnlockMethodChangedListener listener)

        mListeners.add(listener);
    
public static com.android.systemui.statusbar.phone.UnlockMethodCachegetInstance(android.content.Context context)

        if (sInstance == null) {
            sInstance = new UnlockMethodCache(context);
        }
        return sInstance;
    
public booleanisCurrentlyInsecure()

return
whether the lockscreen is currently insecure, i. e. the bouncer won't be shown

        return mCurrentlyInsecure;
    
public booleanisFaceUnlockRunning()

        return mFaceUnlockRunning;
    
public booleanisMethodSecure()

return
whether the user configured a secure unlock method like PIN, password, etc.

        return mSecure;
    
public booleanisTrustManaged()


       
        return mTrustManaged;
    
private voidnotifyListeners()

        for (OnUnlockMethodChangedListener listener : mListeners) {
            listener.onUnlockMethodStateChanged();
        }
    
public voidremoveListener(com.android.systemui.statusbar.phone.UnlockMethodCache$OnUnlockMethodChangedListener listener)

        mListeners.remove(listener);
    
private voidupdate(boolean updateAlways)

        int user = mLockPatternUtils.getCurrentUser();
        boolean secure = mLockPatternUtils.isSecure();
        boolean currentlyInsecure = !secure ||  mKeyguardUpdateMonitor.getUserHasTrust(user);
        boolean trustManaged = mKeyguardUpdateMonitor.getUserTrustIsManaged(user);
        boolean faceUnlockRunning = mKeyguardUpdateMonitor.isFaceUnlockRunning(user)
                && trustManaged;
        boolean changed = secure != mSecure || currentlyInsecure != mCurrentlyInsecure ||
                trustManaged != mTrustManaged  || faceUnlockRunning != mFaceUnlockRunning;
        if (changed || updateAlways) {
            mSecure = secure;
            mCurrentlyInsecure = currentlyInsecure;
            mTrustManaged = trustManaged;
            mFaceUnlockRunning = faceUnlockRunning;
            notifyListeners();
        }