androidandroid-immersiveandroid-9.0-pie

Android P - Immersive mode when simulating a notch leaves empty space


I have an Android app which uses the immersive sticky mode and it works well on previous versions of Android as well as on Android P, but when turning on the option of simulating a display cutout (notch), the content starts right below the status bar, leaving a blank space.

My code is standard immersive 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);

Any ideas?

Thank you.


Solution

  • Nevermind, on a real device it's a totally normal behavior, because you don't want fullscreen content to be obscured by the notch (although the iPhone X does it).

    Leaving this question for future reference.