Just another “clue” for engineers, if/when they ever revisit this problem…
This “bad state” occurs following a resume from task list – whether or not you’ve ever set immersive previously. That is, the conditions for subsequent failure are produced during resume, though the failure itself is not manifested until next attempt to set immersive. I don’t see any reason to suspect the OS itself is in a “bad state”, rather that the app is in a “bad state”.
It’s a subtle cause/effect distinction, and I’ve tried to make the point before but not sure I succeeded, perhaps some code will help. (apologies again, but uploads are still disabled) Here’s a simple/minimal app with no “automatic” immersive code, just some manual buttons, there will be two tests to run with it (below):
main.lua
display.setStatusBar(display.HiddenStatusBar) local background = display.newRect(display.contentCenterX, display.contentCenterY, 5000, 5000) background:setFillColor(0,0,1) local widget = require("widget") widget.setTheme("widget\_theme\_android\_holo\_light") local uivisDefaultButton = widget.newButton({ left = 100, top = 100, label = "default", onPress = function() native.setProperty("androidSystemUiVisibility","default") end }) local uivisImmersiveStickyButton = widget.newButton({ left = 100, top = 200, label = "immersiveSticky", onPress = function() native.setProperty("androidSystemUiVisibility","immersiveSticky") end })
config.lua
application = { content = { -- don't need any of this, use unscaled device resolution }, }
build.settings
settings = { orientation = { default = "portrait", supported = {"portrait"} } }
Prep: find a device that reliably reproduces problem, build & install app.
The first “success” test: launch the app fresh (not previously running), press buttons to set/unset immersive, all works as expected. done, kill the task/force quit.
The second “failure” test: launch the app fresh (not previously running), press the circle home button on nav bar to suspend, press the square task list button and select this app to resume. App is right now in the “bad state” although it may not be obvious because it hasn’t yet been manifested by attempting immersive, _and even though we’ve not yet used immersive at all _, but any subsequent attempts to use immersive during this activation will fail with black bar - so now press the immersive button and witness. Now power off, power on, resuming app. The “bad state” is no longer present, and again immersive will work just fine for the duration of this activation.
So it’s this resume from task list itself that somehow appears to set things up for subsequent failure. Using immersive at any other time, via any other method of launching or resuming, works just fine. But some “condition” of the app must be different following a resume from task list.
The subtle distinction is: immersive seems to be the victim of this “bad state” rather than the cause of it.
The cause seems to be some difference in the app following a resume from task list. Resume from any other method (power cycle, icon) and the bad state is again cleared and immersive works properly.
The reason for trying to highlight this subtlety is,… maybe there’s nothing wrong at all with the way immersive itself is implemented. Maybe it’d be a total waste of engineering time to reconsider that specific code. Because maybe there’s something wrong “elsewhere”, say in the resume logic somehow, that perhaps leaves the window/view/layout/glsurface/other in this “bad state” - a state whose “bad-ness” lies dormant until manifested by subsequent immersive attempts. So maybe that’s where engineering time should be spent?