Open Bug 1793178 Opened 3 years ago Updated 2 years ago

Re-evaluate systemUiVisibility for Activity.exitImmersiveModeIfNeeded

Categories

(Firefox for Android :: General, task)

All
Android
task

Tracking

()

People

(Reporter: csadilek, Unassigned)

Details

From github: https://github.com/mozilla-mobile/android-components/issues/7092.

Focus uses different systemUiVisibility flags to exit immersive mode. We should check why they differ and if we can use the same ones to avoid the code duplication.

AC:

/**
 * Attempts to come out from immersive mode using the View.
 */
fun Activity.exitImmersiveModeIfNeeded() {
    if (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON and window.attributes.flags == 0) {
        // We left immersive mode already.
        return
    }

    window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
    window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE
}

Focus:

/**
 * Show the system bars again.
 */
private fun exitImmersiveModeIfNeeded() {
    val activity = activity ?: return

    if (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON and activity.window.attributes.flags == 0) {
        // We left immersive mode already.
        return
    }

    val window = activity.window
    window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
    window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
}

┆Issue is synchronized with this Jira Task

Change performed by the Move to Bugzilla add-on.

The severity field is not set for this bug.
:cpeterson, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(cpeterson)
Severity: -- → N/A
Type: defect → task
Flags: needinfo?(cpeterson)
You need to log in before you can comment on or make changes to this bug.