Merge pull request #9130 from osmandapp/fix_turn_screen_on

Fix power button for keep screen on
This commit is contained in:
vshcherb 2020-06-03 15:44:23 +02:00 committed by GitHub
commit 436b7e685e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -118,10 +118,15 @@ public class LockHelper implements SensorEventListener {
private void lock() {
releaseWakeLocks();
if (lockUIAdapter != null && !(useSystemScreenTimeout.get() && turnScreenOnPowerButton.get())) {
if (lockUIAdapter != null) {
boolean useSystemTimeout = useSystemScreenTimeout.get();
boolean usePowerButton = useSystemTimeout && turnScreenOnPowerButton.get()
|| !useSystemTimeout && turnScreenOnTime.get() == 0 && turnScreenOnPowerButton.get();
if (!usePowerButton) {
lockUIAdapter.lock();
}
}
}
private void timedUnlock(final long millis) {
uiHandler.removeCallbacks(lockRunnable);