'Hide black status bar at top of Android game

I recently tried to update a rather old game on Google Play Store.

It runs fine but there is a black status bar along the top where the status bar comes down. This is on my Pixel 6

It's supposed to be in immersive mode, and looks fine on other devices.
I've tried a load of ideas from the internet: but nothing will get rid of it! The view itself is underneath the bar, so it's "there". Just covered by a black bar.

Things I've tried (and many others):

getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;

getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE);

getWindow().getInsetsController().setSystemBarsBehavior(WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE); getWindow().getInsetsController().hide(WindowInsets.Type.statusBars());



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source