List of usage examples for android.app KeyguardManager newKeyguardLock
@Deprecated
public KeyguardLock newKeyguardLock(String tag)
From source file:Main.java
public static void disLock(Context context) { KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE); KeyguardLock keyguardLock = keyguardManager.newKeyguardLock(""); keyguardLock.disableKeyguard();//from w ww .ja va 2 s . c o m }
From source file:Main.java
public static KeyguardLock disableKeyguard(Context context) { KeyguardManager mKeyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE); KeyguardLock mKeyguardLock = mKeyguardManager.newKeyguardLock(""); mKeyguardLock.disableKeyguard();// w w w.j a va2 s.c o m return mKeyguardLock; }
From source file:Main.java
/** * Release the devices screen lock./*from w ww . ja v a2 s .c om*/ * @param context */ public static void releaseScreenLock(Context context) { KeyguardManager keyguardManager = (KeyguardManager) context.getApplicationContext() .getSystemService(Context.KEYGUARD_SERVICE); KeyguardManager.KeyguardLock keyguardLock = keyguardManager.newKeyguardLock("TAG"); keyguardLock.disableKeyguard(); }
From source file:net.nordist.lloydproof.LloydProofTest.java
@Override @SuppressWarnings("PMD.SignatureDeclareThrowsException") // it's super's fault public void setUp() throws Exception { super.setUp(); activity = getActivity();//from w w w . ja va 2 s .c om store = new CorrectionStorage(activity); store.deleteAll(); KeyguardManager keyGuardManager = (KeyguardManager) activity.getApplicationContext() .getSystemService(Context.KEYGUARD_SERVICE); keyguardLock = keyGuardManager.newKeyguardLock("LloydProof"); keyguardLock.disableKeyguard(); }
From source file:com.linroid.pushapp.service.DownloadService.java
/** * ?//from ww w. ja v a 2 s.c o m * @param pack */ private void onDownloadComplete(Pack pack) { Timber.d("%s ?,?:%s", pack.getAppName(), pack.getPath()); int toastResId = R.string.toast_download_complete; if (autoInstall.getValue()) { startActivity(IntentUtil.installApk(pack.getPath())); if (AndroidUtil.isAccessibilitySettingsOn(this, ApkAutoInstallService.class.getCanonicalName())) { PowerManager powermanager = ((PowerManager) getSystemService(Context.POWER_SERVICE)); PowerManager.WakeLock wakeLock = powermanager.newWakeLock((PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP), "Install Worker, FULL WAKE LOCK"); wakeLock.acquire(); wakeLock.release(); KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); // if(keyguardManager.isDeviceLocked()) { final KeyguardManager.KeyguardLock keyguardLock = keyguardManager.newKeyguardLock("unLock"); keyguardLock.disableKeyguard(); // } ApkAutoInstallService.addInstallPackage(pack); toastResId = R.string.toast_start_install; } else { toastResId = R.string.toast_download_complete; } } Toast.makeText(this, getString(toastResId, pack.getAppName()), Toast.LENGTH_SHORT).show(); }
From source file:org.interactiverobotics.headset_launcher.LauncherService.java
/** * ?.// www . ja v a 2 s. c o m * */ @SuppressWarnings("deprecation") private void unlockScreen() { final KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); mKeyguardLock = keyguardManager.newKeyguardLock("HeadsetLauncherLock"); mKeyguardLock.disableKeyguard(); final PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = powerManager.newWakeLock( PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE, "HeadsetLauncherWakeLock"); mWakeLock.acquire(); // ? ? ? mTimeoutHandler.postDelayed(mTimeoutRunnable, Constants.NOTIFICATION_TIMEOUT * 1000); }
From source file:com.ucmap.dingdinghelper.services.DingDingHelperAccessibilityService.java
private void wakeAndUnlock() { //???//from w w w .ja v a 2s .c o m PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); //?PowerManager.WakeLock???|??Tag PowerManager.WakeLock wl = pm .newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "bright"); //? wl.acquire(1000); //?? KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); kl = km.newKeyguardLock("unLock"); //? kl.disableKeyguard(); }