Fix turn screen on

This commit is contained in:
Vitaliy 2020-06-03 15:43:53 +03:00
parent 6dde05d297
commit 1a4970fbbc
2 changed files with 4 additions and 6 deletions

View file

@ -1977,10 +1977,11 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
if (enable) { if (enable) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED, getWindow().setFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED,
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
setKeepScreenOn(true);
} else { } else {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
setKeepScreenOn(forceKeepScreenOn);
} }
setKeepScreenOn(forceKeepScreenOn);
} }
@Override @Override

View file

@ -118,11 +118,8 @@ public class LockHelper implements SensorEventListener {
private void lock() { private void lock() {
releaseWakeLocks(); releaseWakeLocks();
int unlockTime = turnScreenOnTime.get(); if (lockUIAdapter != null && !(useSystemScreenTimeout.get() && turnScreenOnPowerButton.get())) {
if (lockUIAdapter != null) { lockUIAdapter.lock();
if (!(useSystemScreenTimeout.get() && turnScreenOnPowerButton.get()) && unlockTime != 0) {
lockUIAdapter.lock();
}
} }
} }