Adjust taskbar VIS and bottom mandatory gesture insets

- ITYPE_BOTTOM_MANDATORY_GESTURES should always be > 0  in gesture
  navigation mode, but before we were setting it equal to tappableHeight
  which is 0 if the taskbar is stashed. Fixed it to be contentHeight
  instead.
- Updated VIS insets to only override them to be 0 for tappableElement,
  not for others like navigationBars. We still only override this for
  gesture navigation; 3 button mode will continue reporting the same as
  we report to the underlying apps.

Test: manually with 3 button mode, gesture nav mode with taskbar
stashed/unstashed; checked that TaskbarInsetsController dump looks as
expected, and that behaviors like Assistant and IME look correct
Flag: none
Fixes: 262516176

Change-Id: I5a1cdf5a9956777d3189ef6042493e2f5aa9b162
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
index b388512..a48b88f 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
@@ -18,8 +18,8 @@
 import android.graphics.Insets
 import android.graphics.Region
 import android.view.InsetsFrameProvider
-import android.view.InsetsState.ITYPE_BOTTOM_MANDATORY_GESTURES
 import android.view.InsetsState
+import android.view.InsetsState.ITYPE_BOTTOM_MANDATORY_GESTURES
 import android.view.InsetsState.ITYPE_BOTTOM_TAPPABLE_ELEMENT
 import android.view.InsetsState.ITYPE_EXTRA_NAVIGATION_BAR
 import android.view.ViewTreeObserver
@@ -82,29 +82,39 @@
         val contentHeight = controllers.taskbarStashController.contentHeightToReportToApps
         val tappableHeight = controllers.taskbarStashController.tappableHeightToReportToApps
         for (provider in windowLayoutParams.providedInsets) {
-            if (provider.type == ITYPE_EXTRA_NAVIGATION_BAR) {
+            if (provider.type == ITYPE_EXTRA_NAVIGATION_BAR
+                    || provider.type == ITYPE_BOTTOM_MANDATORY_GESTURES) {
                 provider.insetsSize = getInsetsByNavMode(contentHeight)
-            } else if (provider.type == ITYPE_BOTTOM_TAPPABLE_ELEMENT
-                      || provider.type == ITYPE_BOTTOM_MANDATORY_GESTURES) {
+            } else if (provider.type == ITYPE_BOTTOM_TAPPABLE_ELEMENT) {
                 provider.insetsSize = getInsetsByNavMode(tappableHeight)
             }
         }
 
         val imeInsetsSize = getInsetsByNavMode(taskbarHeightForIme)
-        // Use 0 insets for the VoiceInteractionWindow (assistant) when gesture nav is enabled.
-        val visInsetsSize = getInsetsByNavMode(if (context.isGestureNav) 0 else tappableHeight)
         val insetsSizeOverride = arrayOf(
             InsetsFrameProvider.InsetsSizeOverride(
                 TYPE_INPUT_METHOD,
                 imeInsetsSize
             ),
+        )
+        // Use 0 tappableElement insets for the VoiceInteractionWindow when gesture nav is enabled.
+        val visInsetsSizeForGestureNavTappableElement = getInsetsByNavMode(0)
+        val insetsSizeOverrideForGestureNavTappableElement = arrayOf(
+            InsetsFrameProvider.InsetsSizeOverride(
+                TYPE_INPUT_METHOD,
+                imeInsetsSize
+            ),
             InsetsFrameProvider.InsetsSizeOverride(
                 TYPE_VOICE_INTERACTION,
-                visInsetsSize
-            )
+                visInsetsSizeForGestureNavTappableElement
+            ),
         )
         for (provider in windowLayoutParams.providedInsets) {
-            provider.insetsSizeOverrides = insetsSizeOverride
+            if (context.isGestureNav && provider.type == ITYPE_BOTTOM_TAPPABLE_ELEMENT) {
+                provider.insetsSizeOverrides = insetsSizeOverrideForGestureNavTappableElement
+            } else {
+                provider.insetsSizeOverrides = insetsSizeOverride
+            }
         }
     }