Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df2ceac0 authored by Cosmin Băieș's avatar Cosmin Băieș
Browse files

Use stashedTaskbarHeight for IME insets override

Previously [1] we removed the explicit insetsSizeOverride from the
Taskbar for the IME window, as we now [2] enable hiding the IME nav bar.
This would now send the normal insets the taskbar reports. When running
on pre/postsubmit, with test harness setup, the non-transient taskbar
would show, which is bigger than the IME's navigation bar height.

Due to the current logic in InsetsSource#calculateInsets, this leads to
the IME window receiving top navigation bar insets instead of bottom.
As the IME nav bar is now treated as a (fixed on bottom) caption bar,
the two would no longer overlap, and thus lead to a double insets
dispatch, and also a (temporarily) bigger IME window, for IMEs that set
their decorView height to WRAP_CONTENT (e.g. MockIME used in testing).

This instead keeps the previous insetsSizeOverride for IME, and uses the
stashedTasbarHeight when in gesture nav, which should account for both
transient and normal taskbars.

 [1]: I86079cb6670a2ae3b6fa883694f8af81df212408
 [2]: I8793db69fb846046300d5a56b3b0060138ef4cd5

Bug: 297000797
Test: atest WindowInsetsControllerTests#testDispatchApplyWindowInsetsCount_ime
Change-Id: I102a8bc1f8869ebbce9f8f1fefa651d49a9538ec
parent 9bbb0c75
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -198,24 +198,24 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
        }


        val imeInsetsSize = getInsetsForGravity(taskbarHeightForIme, gravity)
        // When in gesture nav, report the stashed height to the IME, to allow hiding the
        // IME navigation bar.
        val imeInsetsSize = if (ENABLE_HIDE_IME_CAPTION_BAR && context.isGestureNav) {
            getInsetsForGravity(controllers.taskbarStashController.stashedHeight, gravity);
        } else {
            getInsetsForGravity(taskbarHeightForIme, gravity)
        }
        val imeInsetsSizeOverride =
                if (!ENABLE_HIDE_IME_CAPTION_BAR) {
                arrayOf(
                            InsetsFrameProvider.InsetsSizeOverride(
                                    TYPE_INPUT_METHOD,
                                    imeInsetsSize
                            ),
                        InsetsFrameProvider.InsetsSizeOverride(TYPE_INPUT_METHOD, imeInsetsSize),
                )
                } else {
                    arrayOf()
                }
        // Use 0 tappableElement insets for the VoiceInteractionWindow when gesture nav is enabled.
        val visInsetsSizeForTappableElement =
                if (context.isGestureNav) getInsetsForGravity(0, gravity)
                else getInsetsForGravity(tappableHeight, gravity)
        val insetsSizeOverrideForTappableElement =
                imeInsetsSizeOverride + arrayOf(
                arrayOf(
                        InsetsFrameProvider.InsetsSizeOverride(TYPE_INPUT_METHOD, imeInsetsSize),
                        InsetsFrameProvider.InsetsSizeOverride(
                                TYPE_VOICE_INTERACTION,
                                visInsetsSizeForTappableElement
@@ -224,7 +224,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
        if ((context.isGestureNav || TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW)
                && provider.type == tappableElement()) {
            provider.insetsSizeOverrides = insetsSizeOverrideForTappableElement
        } else if (provider.type != systemGestures() && imeInsetsSizeOverride.isNotEmpty()) {
        } else if (provider.type != systemGestures()) {
            // We only override insets at the bottom of the screen
            provider.insetsSizeOverrides = imeInsetsSizeOverride
        }