Search in sources :

Example 26 with KeyguardManager

use of android.app.KeyguardManager in project android_frameworks_base by ParanoidAndroid.

the class ToggleLockscreenTile method updateTile.

private synchronized void updateTile() {
    mLabel = mContext.getString(R.string.quick_settings_lockscreen);
    if (mLock == null) {
        KeyguardManager keyguardManager = (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE);
        mLock = keyguardManager.newKeyguardLock("PowerWidget");
    }
    if (mDisabledLockscreen) {
        mDrawable = R.drawable.ic_qs_lock_screen_off;
        mLock.disableKeyguard();
    } else {
        mDrawable = R.drawable.ic_qs_lock_screen_on;
        mLock.reenableKeyguard();
    }
}
Also used : KeyguardManager(android.app.KeyguardManager)

Example 27 with KeyguardManager

use of android.app.KeyguardManager in project Xposed-Tinted-Status-Bar by MohammadAG.

the class Utils method isKeyguardLocked.

@SuppressLint("NewApi")
public static boolean isKeyguardLocked(Context context) {
    KeyguardManager kgm = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
    boolean keyguardLocked;
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
        keyguardLocked = kgm.isKeyguardLocked();
    } else {
        keyguardLocked = kgm.inKeyguardRestrictedInputMode();
    }
    return keyguardLocked;
}
Also used : KeyguardManager(android.app.KeyguardManager) SuppressLint(android.annotation.SuppressLint)

Example 28 with KeyguardManager

use of android.app.KeyguardManager in project platform_frameworks_base by android.

the class ConnectivityManagerTestBase method turnScreenOn.

// Turn screen on
protected void turnScreenOn() {
    logv("Turn screen on");
    PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
    pm.wakeUp(SystemClock.uptimeMillis());
    // disable lock screen
    KeyguardManager km = (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE);
    if (km.inKeyguardRestrictedInputMode()) {
        sendKeys(KeyEvent.KEYCODE_MENU);
    }
}
Also used : PowerManager(android.os.PowerManager) KeyguardManager(android.app.KeyguardManager)

Example 29 with KeyguardManager

use of android.app.KeyguardManager in project RxBinding by JakeWharton.

the class RxBindingTestRunner method onStart.

@Override
public void onStart() {
    Context app = getTargetContext().getApplicationContext();
    String name = RxBindingTestRunner.class.getSimpleName();
    // Unlock the device so that the tests can input keystrokes.
    KeyguardManager keyguard = (KeyguardManager) app.getSystemService(KEYGUARD_SERVICE);
    keyguard.newKeyguardLock(name).disableKeyguard();
    // Wake up the screen.
    PowerManager power = (PowerManager) app.getSystemService(POWER_SERVICE);
    wakeLock = power.newWakeLock(FULL_WAKE_LOCK | ACQUIRE_CAUSES_WAKEUP | ON_AFTER_RELEASE, name);
    wakeLock.acquire();
    super.onStart();
}
Also used : Context(android.content.Context) PowerManager(android.os.PowerManager) KeyguardManager(android.app.KeyguardManager)

Example 30 with KeyguardManager

use of android.app.KeyguardManager in project android_frameworks_base by AOSPA.

the class ConnectivityManagerTestBase method turnScreenOn.

// Turn screen on
protected void turnScreenOn() {
    logv("Turn screen on");
    PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
    pm.wakeUp(SystemClock.uptimeMillis());
    // disable lock screen
    KeyguardManager km = (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE);
    if (km.inKeyguardRestrictedInputMode()) {
        sendKeys(KeyEvent.KEYCODE_MENU);
    }
}
Also used : PowerManager(android.os.PowerManager) KeyguardManager(android.app.KeyguardManager)

Aggregations

KeyguardManager (android.app.KeyguardManager)45 Intent (android.content.Intent)25 PendingIntent (android.app.PendingIntent)14 IIntentSender (android.content.IIntentSender)10 IntentSender (android.content.IntentSender)10 PowerManager (android.os.PowerManager)8 Resources (android.content.res.Resources)5 RemoteException (android.os.RemoteException)4 Context (android.content.Context)3 SuppressLint (android.annotation.SuppressLint)2 WindowManager (android.view.WindowManager)2 Activity (android.app.Activity)1 ActivityManager (android.app.ActivityManager)1 AlarmManager (android.app.AlarmManager)1 IActivityManager (android.app.IActivityManager)1 NotificationManager (android.app.NotificationManager)1 ActivityNotFoundException (android.content.ActivityNotFoundException)1 DialogInterface (android.content.DialogInterface)1 SensorManager (android.hardware.SensorManager)1 CameraAccessException (android.hardware.camera2.CameraAccessException)1