Code example for KeyguardManager

Methods: inKeyguardRestrictedInputMode

0
        PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
        if (!pm.isScreenOn()) {
            return false; 
        } 
        KeyguardManager km = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
        if (km.inKeyguardRestrictedInputMode()) {
            return false; 
        } 
        return true; 
    } 
 
    public static void assertViewVisible(View v) {
        if (v == null) {
            throw new NullPointerException();
        } 
        for (;;) { 
            assertTrue("visibility for " + v, View.VISIBLE == v.getVisibility());
            ViewParent parent = v.getParent();
            if (parent == null || !(parent instanceof View)) {
                break; 
            }