Reputation: 1557
I am trying to turn my device screen off while the device's CPU remains awake. I have tried a few different things but I am unable to turn the screen completely off programmatically.
I have done some research and saw that using WakeLock
can dim the screen / leave room for the screen to be turned off while the CPU is still running and that seems to work:
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "My Tag");
In order to turn the screen off completely, I have tried to change the screen time-out, but that only dims the screen:
android.provider.Settings.System.putInt(getContentResolver(),
Settings.System.SCREEN_OFF_TIMEOUT, 1);
Is there any other way that I can turn the screen off completely while the CPU is still running ?
Upvotes: 2
Views: 296