farmerbb / SecondScreen

Better screen mirroring for Android devices
Apache License 2.0
304 stars 55 forks source link

first launch, back to Autorotate fail, but OK after reboot #65

Open DanielDS-lm opened 4 years ago

DanielDS-lm commented 4 years ago

Hi, First, thank you for this useful app. At the first launch, I create a desktop profile, connect the screen, everything is ok, but when I disconnect the screen, the device stay locked in landscape. But this issue disappear after one reboot. (rebooting the device after SecondScreen installation doesn't fix, it need a first use, get the issue then reboot the device)

pepijndevos commented 2 years ago

Same problem here. It appears the app doesn't reset rotation leaving the phone locked in landscape.

pepijndevos commented 2 years ago

It seems rotation is set here https://github.com/farmerbb/SecondScreen/blob/3dd38b95c429d131e7008ed9b736cc2e2383188e/app/src/main/java/com/farmerbb/secondscreen/service/ProfileLoadService.java#L413 and unset here https://github.com/farmerbb/SecondScreen/blob/3dd38b95c429d131e7008ed9b736cc2e2383188e/app/src/main/java/com/farmerbb/secondscreen/service/TurnOffService.java#L238

So it looks like some effort is made to restore the rotation, but it's not completely correct.

pepijndevos commented 2 years ago

Actually that seems not to be the problem. If you do not grant the app permission to force other apps to be in landscape, it actually reverts nicely, this suggests it's a problem with RotationLockService rather than with settings.

As far as I can tell, this service is used via the notificaiton service, which is turned off here: https://github.com/farmerbb/SecondScreen/blob/74c05c9fe4cb82425d67ba5cabe3d238b4795c28/app/src/main/java/com/farmerbb/secondscreen/service/TurnOffService.java#L461-L463

Uh... I'm not sure how much further I'm going to get without launching the app in a debugger.

pepijndevos commented 2 years ago

Maybe the problem is that the overlay is removed after setting all the settings back to the default? So it'd set the orientation back, but the overlay is still there forcing it in landscape, and then the overlay is removed, leaving it in landscape.

No, actually I just tested, and after disabling the profile, a notification is still active that says the apps is drawing an overlay. Tapping the notification to remove the overlay reverts screen orientation to normal.

So yea, basically the overlay is not removed correctly.

Neitaido commented 2 years ago

I also have this issue. But the rotation lock gets actually stuck you can change it but the system settings are overwritten. Also for me it's fixed after reboot. I'm using a Fairphone 4 with up to date software. If you remove the overlay or stop the program the problem stays, that the system settings are not accepted. I even tried to remove the rights of the app. However, no success only reboot fixed it for me.