I have the following code:
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
This code worked fine for Android Lollipop, hiding the navigation bar in sticky immersive mode. But now, when I test it on my phone with Android 6.0, the navigation bar goes away while a black rectangle where the navigation bar used to be remains, blocking a portion of the screen.
Looking back on my question, I'd like to add the solution I'm using now which hasn't failed me since, I don't remember if I saw it somewhere else or came to it myself but I'm glad it works.
Hope this helps someone!
I've discovered a workaround that seems to resolve this issue. I support portrait and landscape, and noticed that the black rectangle went away if I rotated into landscape or started the app in landscape. Adding the following code to my main activity's onCreate() method (after setting the immersive flags) resolved the issue: