FileDocCategorySizeDatePackage
KeyguardDisableHandler.javaAPI DocAndroid 5.1 API4731Thu Mar 12 22:22:42 GMT 2015com.android.server.wm

KeyguardDisableHandler

public class KeyguardDisableHandler extends android.os.Handler

Fields Summary
private static final String
TAG
private static final int
ALLOW_DISABLE_YES
private static final int
ALLOW_DISABLE_NO
private static final int
ALLOW_DISABLE_UNKNOWN
private int
mAllowDisableKeyguard
static final int
KEYGUARD_DISABLE
static final int
KEYGUARD_REENABLE
static final int
KEYGUARD_POLICY_CHANGED
final android.content.Context
mContext
final android.view.WindowManagerPolicy
mPolicy
KeyguardTokenWatcher
mKeyguardTokenWatcher
Constructors Summary
public KeyguardDisableHandler(android.content.Context context, android.view.WindowManagerPolicy policy)


           
        mContext = context;
        mPolicy = policy;
    
Methods Summary
public voidhandleMessage(android.os.Message msg)

        if (mKeyguardTokenWatcher == null) {
            mKeyguardTokenWatcher = new KeyguardTokenWatcher(this);
        }

        switch (msg.what) {
            case KEYGUARD_DISABLE:
                final Pair<IBinder, String> pair = (Pair<IBinder, String>)msg.obj;
                mKeyguardTokenWatcher.acquire(pair.first, pair.second);
                break;

            case KEYGUARD_REENABLE:
                mKeyguardTokenWatcher.release((IBinder)msg.obj);
                break;

            case KEYGUARD_POLICY_CHANGED:
                mAllowDisableKeyguard = ALLOW_DISABLE_UNKNOWN;
                if (mKeyguardTokenWatcher.isAcquired()) {
                    // If we are currently disabled we need to know if the keyguard
                    // should be re-enabled, so determine the allow state immediately.
                    mKeyguardTokenWatcher.updateAllowState();
                    if (mAllowDisableKeyguard != ALLOW_DISABLE_YES) {
                        mPolicy.enableKeyguard(true);
                    }
                } else {
                    // lazily evaluate this next time we're asked to disable keyguard
                    mPolicy.enableKeyguard(true);
                }
                break;
        }