Code example for KeyguardManager

Methods: inKeyguardRestrictedInputMode, newKeyguardLock

0
        KeyguardManager km = (KeyguardManager) context
                             .getSystemService(Context.KEYGUARD_SERVICE);
 
        if (mKeyguardLock == null) {
            // get KeyguardLock 
            mKeyguardLock = km.newKeyguardLock("dm_KL");
            if (km.inKeyguardRestrictedInputMode()) {
                Log.d(TAG, "need to disableKeyguard");
                // release key guard lock 
                mKeyguardLock.disableKeyguard();
            } else { 
                mKeyguardLock = null;
                Log.d(TAG, "not need to disableKeyguard");
            } 
        } 
    } 
 
    public static void releaseFullWakeLock(Context context) {
        if (mFullWakelock != null) {
            if (mFullWakelock.isHeld()) {
                mFullWakelock.release();