Created
February 10, 2016 21:40
-
-
Save oguzbabaoglu/ff01f98d8527a07ae029 to your computer and use it in GitHub Desktop.
Wake lock solution in u2020
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String name = U2020TestRunner.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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment