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();
}
}
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;
}
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);
}
}
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();
}
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);
}
}
Aggregations