osmandapp / OsmAnd

OsmAnd
https://osmand.net
Other
4.6k stars 1.01k forks source link

Turn screen off doesn't work #7315

Closed lead-legs closed 4 years ago

lead-legs commented 5 years ago

Turn screen off no longer works - Since the update, I can set the screen to turn on automatically but no matter what seconds I set the screen doesn't tun off. #7315

vshcherb commented 5 years ago

The issue could be related on some specific Android settings like enabled FaceLock or system doesn't want to turn screen off.

thehill383 commented 5 years ago

I have seen that in the latest update the functionality for "turn screen on" is restored. I haven't been able to test this as yet. The real issue for me is for the main map screen to prevent the pin-lock from being activated. You should be able to use the power button to turn the screen on and off without encountering the pin/pattern lock. I have checked a few other apps and i am certain they have this functionality without needing to be in the device administrators group, which i understand was the issue. I asked the developer of ghostracer, how he does it (https://play.google.com/store/apps/details?id=com.bravetheskies.ghostracer&gl=GB) and this was his response"Anyway I have the option to remove the lock screen in settings. It's not been touched for years so might be out of date, but that adds two 'flags' to the 'window' FLAG_DISMISS_KEYGUARD and FLAG_SHOW_WHEN_LOCKED" i am sure a number of apps are able to do this without being in the device administrators group, i think Strava is another

lead-legs commented 5 years ago

My settings are exactly the same as they were previously when this worked in Osmand. My device is only used for Osmand navigating by bike. There is no face lock and other than Osmand not having the correct permissions, there's nothing stopping Osmand tithing the screen off.

AndyGHenderson commented 5 years ago

I have this problem. I do not have a lock screen of any kind active. The phone always starts directly to the menu (so I don't have to unlock each time I want to see the map while on my bike).

Also, screen fades and turns off automatically in normal use. It's only in OsmAnd that the screen stays on permanently until I press the power button to send the phone to sleep.

As lead-legs says, my phone settings haven't changed since the automatic switch on/off worked before, and there hasn't been an OS update since either.

Using Motorola G3 with Android 6.0.1 and OsmAnd 3.4.4

Andy

jsarenik commented 5 years ago

Just a reference (the link currently at https://github.com/osmandapp/Osmand/issues/6675#issuecomment-516157223 is broken): https://github.com/osmandapp/Osmand/issues/6675

Policjant commented 5 years ago

I have the same problem on my navigation phone with android 5.0.1, on the old osmand version everything was working fine

florian29 commented 5 years ago

Perhaps the idea of the developers is only to turn the screen on. But turning the screen off again, like it was the behaviour on version 3.2.7 , that is not mentioned. Obviously if this is the idea, than this feature is useless.

jsarenik commented 5 years ago

There is an app Mapy.cz which on pressing power button turns off the display and on pressing it again shows the map without locking the screen (the screenlock appears only after pressing the home button). I remember it worked like this in other map/navigation apps like MapFactor or Sygic or Offline Maps & Navigation.

max-klaus commented 5 years ago

Could someone record a video with the issue? Thank you!

jsarenik commented 5 years ago

Could someone record a video with the issue? Thank you!

Sure. https://youtu.be/vn52IQvZKEk

jsarenik commented 5 years ago

Now an example without issue (using Mapy.cz) https://youtu.be/mqOmi5W8Cq4

AndyGHenderson commented 5 years ago

jsarenik's video demonstrates an issue with the lock screen but the OP's issue is that after the screen comes on automatically, it never goes off again. I don't have the means to show a recording, unfortunately (I tried installing AZ recorder but Android kept complaining about overlays and I didn't get anywhere) but there really isn't much to show. The screen comes on automatically with the voice announcement but it never goes off again.

Definitely using the right profile with a setting of 5 seconds.

Andy

max-klaus commented 5 years ago

While device isn't going off - what actually is displaying on the screen, OsmAnd or idle screen?

jsarenik commented 5 years ago

@AndyGHenderson oops, I think I have hijacked this issue for something that bothers me. Sorry for that.

max-klaus commented 5 years ago

@jsarenik Thank you for the video. We will try to implement such case as well.

jsarenik commented 5 years ago

@max-klaus you are welcome. For the sake of tracking, do you want me to make or reopen another issue? Thank you!

AndyGHenderson commented 5 years ago

While device isn't going off - what actually is displaying on the screen, OsmAnd or idle screen?

OsmAnd. The OsmAnd screen comes on automatically and never goes off.

Andy

max-klaus commented 5 years ago

@max-klaus you are welcome. For the sake of tracking, do you want me to make or reopen another issue? Thank you!

no, 7315 is enough.

apfelstrudel140 commented 5 years ago

I have the same problem. OsmAnd disables the screen to turn off. When pressing the powerbutton it is off for a second and after that it turns on again. I also tried to disable the auto screen lock and changes the settings for the power button, but it doesn't work.

Oneplus x, android 6.0.1, OsmAnd+ 3.4.4

ghost commented 5 years ago

Same problem here. It appears to be related to the "Proximity sensor" option. If I start a navigation, select a 'Time' in the 'turn screen on' section the power button turns off the screen. If I also check 'Proximity Sensor' in the navigation options, pressing the power button turns off the screen but it turns on again within 1 sec. This remains the case until I exit Osmand+.

This is seen sitting at my desk. I'll check behaviour on the bike later.

Steps: Start Osmand+ Start navigation - choose destination - press 'Start' Lock screen: OK Unlock screen - choose navigation - choose 'Options' - choose 'Navigation settings' - choose 'Time' - set '10 seconds' - return and press 'Continue' Lock screen: OK Unlock screen - choose navigation - choose 'Options' - choose 'Navigation settings' - check 'Proximity sensor' - return and press 'Continue' Lock screen: Screen turns on within 1 sec Stop navigation, exit Osmand+, restart Osmand+ and lock screen works correctly again.

Cubot J3, android 'Go' 8.1.0, Osmand+ 3.4.5

AndyGHenderson commented 5 years ago

FWIW, without a lock screen, the screen stays on after coming on automatically with - or without - the proximity sensor option.

Andy

Posteinwurf commented 5 years ago

same issue on my device screen turns on but never off. worked with older osmand version.

ghost commented 5 years ago

Same problem here. It appears to be related to the "Proximity sensor" option. If I start a navigation, select a 'Time' in the 'turn screen on' section the power button turns off the screen. If I also check 'Proximity Sensor' in the navigation options, pressing the power button turns off the screen but it turns on again within 1 sec. This remains the case until I exit Osmand+.

This is seen sitting at my desk. I'll check behaviour on the bike later.

Steps: Start Osmand+ Start navigation - choose destination - press 'Start' Lock screen: OK Unlock screen - choose navigation - choose 'Options' - choose 'Navigation settings' - choose 'Time' - set '10 seconds' - return and press 'Continue' Lock screen: OK Unlock screen - choose navigation - choose 'Options' - choose 'Navigation settings' - check 'Proximity sensor' - return and press 'Continue' Lock screen: Screen turns on within 1 sec Stop navigation, exit Osmand+, restart Osmand+ and lock screen works correctly again.

Cubot J3, android 'Go' 8.1.0, Osmand+ 3.4.5

Further testing on the bike this time: Test 1: Start Osmand+, start navigation, press 'Start' Lock screen: OK Unlock screen - choose navigation - choose 'Options' - choose 'Navigation settings' - choose 'Time' - set '10 seconds' - return and press 'Continue' Lock screen: OK - Osmand+ turns screen on and off appropriately during navigation. Unlock screen - choose navigation - choose 'Options' - choose 'Navigation settings' - check 'Proximity sensor' - return and press 'Continue' Lock screen: Screen turns on within 1 sec Stop navigation, exit Osmand+, restart Osmand+ - choose navigation - choose 'Options' - choose 'Navigation settings' - uncheck 'Proximity sensor' - return and lock screen works correctly again.

Test 2: Start Osmand+, start navigation, press 'Start' Lock screen: OK Unlock screen - choose navigation - choose 'Options' - choose 'Navigation settings' - check 'Proximity sensor' - choose 'Time' - set 'Never' - return and press 'Continue' Lock screen: OK - Osmand+ does not respond to proximity sensor Stop navigation, exit Osmand+, restart Osmand+

Test 3 - Not on bike, just at desk: In Settings - Security - Lock screen - choose 'None' Start Osmand+, start navigation, press 'Start' Lock screen: OK Unlock screen - choose navigation - choose 'Options' - choose 'Navigation settings' - choose 'Time' - set '10 seconds' - return and press 'Continue' Lock screen: OK Unlock screen - choose navigation - choose 'Options' - choose 'Navigation settings' - check 'Proximity sensor' - return and press 'Continue' Lock screen: Screen turns on within 1 sec Stop navigation, exit Osmand+, restart Osmand+ - choose navigation - choose 'Options' - choose 'Navigation settings' - uncheck 'Proximity sensor' - return In Settings - Security - Lock screen - choose 'Swipe' Lock screen works correctly again.

Test 4 - Back on bike, this time with a usb charger connected to dynamo:

Conclusion: Proximity sensor checked along with a screen on time set causes Osmand+ to light the screen constantly, even after using power button to blank screen. Presumably this is down to the sensor polling?

florian29 commented 5 years ago

The same issue with OsmAnd 3.4.6. The screen turns on but doesn't turn off anymore.

ghost commented 5 years ago

FWIW, without a lock screen, the screen stays on after coming on automatically with - or without - the proximity sensor option.

Andy

Confirming this also for me.

Sixtron commented 5 years ago

Osmand+ V3.4.6 Android 9, Emui 9.0.0 Cellphone: Honor play

Same problem. Screen turn on, but not off.

I am not using the proximity switch.

I am using no screenlock.

Osmand don't ask for administration when installing. I can not add Osmand as admin manually with my cellphone.

Uninstall and reinstall don't help.

ghost commented 5 years ago

Osmand+ V3.4.6 Android 9, Emui 9.0.0 Cellphone: Honor play

Same problem. Screen turn on, but not off.

I am not using the proximity switch.

I am using no screenlock.

Osmand don't ask for administration when installing. I can not add Osmand as admin manually with my cellphone.

Uninstall and reinstall don't help.

Try setting a 'swipe' screenlock.
Works correctly for me with proximity switch: Off, screenlock: Swipe.

florian29 commented 5 years ago

Try setting a 'swipe' screenlock. Works correctly for me with proximity switch: Off, screenlock: Swipe.

Having to swipe the screen or something like this is not useful and not allowed while driving.

max-klaus commented 5 years ago

We have introduced fix for the issue. However it not released yet. You may try it using Nightly Build of the OsmAnd here: http://osmand.net/downloads

AndyGHenderson commented 5 years ago

We have introduced fix for the issue. However it not released yet. You may try it using Nightly Build of the OsmAnd here: http://osmand.net/downloads

Just gave it a try. It's a step forward as the screen now goes off after coming on automatically but it seems to use the Android 'Sleep after inactivity' setting (in my case 1 minute) not the OsmAnd setting (in my case 5 seconds).

Even if I set the Android sleep timeout to its minimum value (15 seconds) it would still consume more battery than if it used the OsmAnd value.

Andy Android 6.0.1 on a Motorola G3.

AndyGHenderson commented 5 years ago

Osmand+ V3.4.6 Android 9, Emui 9.0.0 Cellphone: Honor play Same problem. Screen turn on, but not off. I am not using the proximity switch. I am using no screenlock. Osmand don't ask for administration when installing. I can not add Osmand as admin manually with my cellphone. Uninstall and reinstall don't help.

Try setting a 'swipe' screenlock. Works correctly for me with proximity switch: Off, screenlock: Swipe.

With a swipe unlock, the screen comes on automatically without needing the swipe but no change for me. It still doesn't go off automatically. Could be because I'm using an older version of Android.

Andy Android 6.0.1 on Motorola G3

Sixtron commented 5 years ago

This fixed version (7/2019) seems to be older then the latest release (8/2019) ?

max-klaus commented 5 years ago

The fix does not restore functionality as it was before (with turn screen off right away) since it require Admin permission. Such approach cannot be used anymore. So current solution is the only possible way to ask android to turn off the screen. Unfortunately it cannot be done immediately.

max-klaus commented 5 years ago

@Sixtron Build number should be #24715 http://download.osmand.net/latest-night-build/OsmAnd-default.apk

AndyGHenderson commented 5 years ago

@Sixtron Build number should be #24715 http://download.osmand.net/latest-night-build/OsmAnd-default.apk

I got 24714d released 2019-08-09

Andy

Sixtron commented 5 years ago

Why not use admin rights to turn off the screen like before ? Many apps still use it. You say, the screen will not shutdown because Osmand give the order ? The screen will turn of because the system screen timeout ?

AndyGHenderson commented 5 years ago

The fix does not restore functionality as it was before (with turn screen off right away) since it require Admin permission. Such approach cannot be used anymore. So current solution is the only possible way to ask android to turn off the screen. Unfortunately it cannot be done immediately.

I'm puzzled. By providing an option to tell OsmAnd how long before it should turn off the screen, you are creating an expectation that it will turn off after that period of time. The above suggests, however, that it will not work and that - regardless of the OsmAnd setting - the screen will obey only the Android screen timeout setting.

Did I get that right? If so, the new setting would be better as a simple 'Turn screen on automatically' yes/no.

max-klaus commented 5 years ago

We decided to not use the admin rights because it could cause kick app off the market which was happening already. As I can see - behaviour of devices differs when app try to lock the screen new way. Some waits for system lock time, some goes to idle screen after period of time defined in the OsmAnd for few seconds and then turn off the screen.

Sixtron commented 5 years ago

And can you fix it that the screen goes off after the period of time set in Osmand ? I don't want change every time i use Osmand my system settings with no password, screen timeout...

max-klaus commented 5 years ago

It is already done, but don't work on all devices.

Sixtron commented 5 years ago

Ok, can you make it work on all devices ? If not, can you maybe make an option to give admin rights for the cause that it's not working?

max-klaus commented 5 years ago

No, because it depends on the device and not - we are not planning to return device permission to the app.

florian29 commented 5 years ago

We decided to not use the admin rights because it could cause kick app off the market which was happening already.

How about making at least a version with admin rights for F-Droid? For the google players you could make an add on with this admin rights and the add on could be downloaded outside the market.

Themanwithoutaplan commented 5 years ago

Does it make sense to provide debug logs for this? I had all kinds of fun with this combined with facelock on a recent tour: disabling auto-unlock for facelock seems to be the best solution but OsmAnd still generally wouldn't unlock. I can imagine there might be a conflict there. Seeing as I normally have SmartLock set for my headset this isn't really an issue but it's important to know what should work.

In case it's any use I can test the same scenarios with an S5 (klte) and S10e.

apfelstrudel140 commented 5 years ago

@Sixtron Build number should be #24715 http://download.osmand.net/latest-night-build/OsmAnd-default.apk

I installed the night build. So far I have the same responses. The screen will go out for a second and then goes on again. I tried different kind of scenarios, normal navigation and by gpx file.

Sixtron commented 5 years ago

For me night build was working on my last bicycle trip.

apfelstrudel140 commented 5 years ago

On a samsung phone (android 7.0) the screen will go on, but don't go off. This is with OsmAnd version 3.4.6 and a screen time-out of 15 seconds.

benaxe commented 5 years ago

I have 3.4.6 installed. If you leave voice on and mute the volume on the phone the screen switches off properly.

swertz commented 5 years ago

Note that the two issues discussed are linked:

1) Screen doesn't turn off automatically -> can still turn it off manually using the screen lock button? 2) Turning the screen back on using the lock button -> before it would just show OSMand again, now we have to unlock manually (and swiping or giving the PIN code is much less practical when riding a bike than just pushing the screen lock button).

So, solving 2) would perhaps help people who complain about 1)? Not to mention it would be nice to be able to turn the screen back on at any time without having to unlock, which was the behaviour a few months ago...

Themanwithoutaplan commented 5 years ago

With the point releases on the beta channel it would be great to know which bugs were fixed. Got 3.4.8 and was going to test it yesterday but before I even got round to it was hitting problems with OsmAnd opening without request, Smart Lock (headset) seems a bit trigger happy at the moment!