Multiple bugs with Android immersive mode, especially after pause/resume
See original GitHub issuep4a 0.5.3, kivy 1.10.0) Reproducer code: https://gist.github.com/hackalog/c02703f78f09cf606cf5c1f32c074f23
How to reproduce:
- build the apk and install it to the device:
p4a apk --name=immersive --private . --version=1 --requirements=hostpython2,kivy,android \
--orientation=landscape --package=bug.immersive
- Start the app. Tap “refresh”
- BUG 1 Tap “fullscreen”. Screen will shift so the top is offscreen; i.e. pos (0,0) is not shifted down to where the android soft buttons used to be. updating the canvas (by tapping any button, or pressing the “update canvas” button, which explicity does an
ask_update()
will fix this. - Leave the app by swiping up from the bottom and hitting the circle button.
- relaunch the app
- Note, android soft menu bar has reappeared. App is positioned under the menu bar (BUG 2) *Press “fullscreen”. Soft menu will disappear, but note app window is not full-sized (black space at top, resolution wrong) BUG 3
- Worse, notice that your touch events on the buttons are offset by the size of the black bar (pos is out of sync with displayed graphics)
This was reproduced on a Google Pixel C tablet with android 6.0.1 (Build MXC89L)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:33 (13 by maintainers)
Top Results From Across the Web
Immersive mode with popup menu Android API's bug?
When I tap and show popup menu, the navigation bar (with transparent background) is raised like a zombie. This phenomena is same both...
Read more >Immersive mode without all the bugs? : r/oneplus - Reddit
Has anyone managed to turn on immersive mode without all of these bugs? ... My OnePlus 7 screen is like this after updating...
Read more >Open Camera / Blog - SourceForge
Fixed immersive mode on Android 11. Fixed video subtitles when restarting due to max filesize. Support longer exposure time on some Samsung ...
Read more >@Voice Aloud Reader for Android - Free! - Hyperionics
@Voice Aloud Reader reads aloud the text displayed in an Android app, ... Useful particularly in landscape mode, or e.g. on Galaxy Z...
Read more >What's new in 5.5.0 Beta 6 - Unity
Occlusion Culling: Unity now supports multi-scene occlusion culling. ... Android: Fixed immersive mode switching off on some KitKat devices ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This sounds like it could possibly be resolved by a simple update to latest SDL2 and SDLActivity. If I had to guess, that’s where I would assume the bug is (in SDLActivity/the java wrapper, specifically). I’m still busy with a few other pull requests but plan to tackle this soon (in case nobody else has picked it up yet once I get to it), since this will also solve a lot of other issues like missing key events for certain physical keys, CTRL not working on physical keyboards and other problems that appear to be resolved in later SDL2 versions for Android
@hackalog its seems you may have some interest in this, here is a simple example and some opinion.
After on_start() the black bar is at the bottom; after on_resume() the black bar is at the top. The existence of the black bar is the issue, it’s location is an artifact that will disappear when it gets the size is right.
Moving self.set_background_color() to the end of on_start() does not change the issue. So Window.size is unchanged after changing the app window size. I suggest this is the issue.
Looked at this way, Window.size is not static. And Kivy may not know Window.size till the end of on_start()/on_resume(). And I’d guess Kivy gets app Window.size from Android as in general Kivy could not know the size of the Navigation bar on some device.
Perhaps the issue can be addressed by re-making that Android call returning Window.size (explicitly or implicitly) at the end of on_start()/on_resume(). The BIG assumption here is that Kivy evaluation order does not assume Window.size is static - and I have no clue on that!
Note: on the latest p4a this requires the workaround to Issue #1504 else p4a crashes.
Edit: I also tried putting set_android_immersive_sticky() in build() and removing on_start() and on_resume(). The behavior was the same as with on_start() and on_resume(). To me this suggests p4a gets the device size before build().
.p4a