Maintaining "lights-out" mode (View.setSystemUiVisibility) across restarts
<p>I'm setting up "lights-out" mode for my android app when its running on recent phones and tablets.  In my <code>onCreate</code> path, I added:</p>

<pre><code>View rootView = getWindow().getDecorView();
rootView.setSystemUiVisibility(View.STATUS_BAR_HIDDEN); // aka View.SYSTEM_UI_FLAG_LOW_PROFILE
</code></pre>

<p>this works better than I thought it would.  On my Android 3.2 tablet the status bar starts in low profile mode (all the buttons on the bar are replaced with dots).  If I interact with the buttons on the bar it will become normal, and then go back to low-profile mode afterwards (e.g., if I check the config/notifications window from the status bar).  So it seems like this is more a property of my app than a "command" to hide the UI directly.</p>

<p>There are two corner cases that are not handled, though.  First, If a user taps the status bar without hitting any of the dots, the bar becomes active.  It never goes back to low profile mode until the user actually interacts with something on the bar (e.g., looks at the notifications or takes a screenshot).  So, if they go back to interacting with my app, the status bar is no longer in low-profile mode.  (The Gallery app seems to have this problem, too, so maybe its not just me.) The second corner case is a resume from the lock screen.  If I tap the power button to lock the tablet, then unlock it and resume the app, the status bar is fully visible (and interacting with it does not change anything).  (The Gallery app does not have this problem.)</p>

<p>A couple blog posts suggest that I could set a handler to listen for system UI visibility changes and then re-hide the UI if it becomes visible. Like this:</p>

<pre><code>rootView.setOnSystemUiVisibilityChangeListener(
  new View.OnSystemUiVisibilityChangeListener() {
    @Override
    public void onSystemUiVisibilityChange(int visibility) {
      if (visibility == View.STATUS_BAR_VISIBLE) {
        game.flagUIIsVisible();
      }
    }
  });
</code></pre>

<p>In my case, the method on the <code>game</code> object just sets a flag saying the UI went invisible.  Later, if there are any touch events inside my app (they're handled by the same <code>game</code> object), and this flag is set, then I invoke the STATUS_BAR_HIDDEN call again.</p>

<p>However, with these callbacks there is no visibile impact on the UI.  I can see that the right handler is being called from some log messages, and I can see the listener is being invoked.  </p>

<p>I also tried invoking the STATUS_BAR_HIDDEN call in my <code>onResume</code> path, but that didn't make a difference, either.</p>

<p>I'm looking for information that this is some sort of known bug, or hints for what the Gallery app might be doing (assuming its doing something differently).  Or suggestions for other APIs to try (or other details that might be relevant).</p>

<p>I'm using libGDX, and my app only has one view, so its pretty simple.  The view is also setup to be fullscreen with no title by libGDX.  I've got my targetSdkVersion set to 15 in my manifest.</p>
