Turning off immersive mode confirmation in an AOSP Android 9 (Pie) build


I’ve been building Android 9 from source for the Odroid N2.  One of the things I wanted to do is turn off the confirmation dialog for immersive mode because my App, Video Kiosk, is the only launcher on the device and it uses immersive mode.

It turns out, the source code comments for how to turn off immersive mode are wrong. The source code says this:

<!-- Initial value for the Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS setting, which is a comma separated list of packages that no longer need confirmation for immersive mode. Override to disable immersive mode confirmation for certain packages. -->

But what you actually need to do is add the following lines:

<!— No need to confirm immersive mode —>
<string> name="def_immersive_mode_confirmations" translatable="false">confirmed</string>

To the overlay file:

/device/hardkernel/odroidn2/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml

It turns out that rather than being a list of package identifiers, you simply need to set the string to the value confirmed which is the only value that is checked by the firmware.

Once you set it to confirmed, the immersive mode confirmation dialog will not be displayed for all packages that use immersive mode.  In other words its not done on a per package basis as the comment in the code states.



Leave a comment