diff --git a/OsmAnd/src/net/osmand/plus/helpers/LockHelper.java b/OsmAnd/src/net/osmand/plus/helpers/LockHelper.java index 9502c17401..9bf628803a 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/LockHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/LockHelper.java @@ -118,8 +118,13 @@ public class LockHelper implements SensorEventListener { private void lock() { releaseWakeLocks(); - if (lockUIAdapter != null && !(useSystemScreenTimeout.get() && turnScreenOnPowerButton.get())) { - lockUIAdapter.lock(); + if (lockUIAdapter != null) { + boolean useSystemTimeout = useSystemScreenTimeout.get(); + boolean usePowerButton = useSystemTimeout && turnScreenOnPowerButton.get() + || !useSystemTimeout && turnScreenOnTime.get() == 0 && turnScreenOnPowerButton.get(); + if (!usePowerButton) { + lockUIAdapter.lock(); + } } }