Merge "Make sure touch only goes to the nearest button when it makes sense" into main
diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
index 1a1c64d..9b8ab33 100644
--- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java
@@ -30,6 +30,7 @@
 import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_HOME;
 import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_IME_SWITCH;
 import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_RECENTS;
+import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_SPACE;
 import static com.android.launcher3.taskbar.TaskbarViewController.ALPHA_INDEX_KEYGUARD;
 import static com.android.launcher3.taskbar.TaskbarViewController.ALPHA_INDEX_SMALL_SCREEN;
 import static com.android.launcher3.util.FlagDebugUtils.appendFlag;
@@ -79,6 +80,7 @@
 import android.widget.FrameLayout;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
+import android.widget.Space;
 
 import androidx.annotation.Nullable;
 
@@ -207,6 +209,7 @@
             this::onComputeInsetsForSeparateWindow;
     private final RecentsHitboxExtender mHitboxExtender = new RecentsHitboxExtender();
     private ImageView mRecentsButton;
+    private Space mSpace;
 
     public NavbarButtonsViewController(TaskbarActivityContext context,
             @Nullable Context navigationBarPanelContext, NearestTouchFrame navButtonsView) {
@@ -432,6 +435,11 @@
         mPropertyHolders.add(new StatePropertyHolder(mA11yButton,
                 flags -> (flags & FLAG_A11Y_VISIBLE) != 0
                         && (flags & FLAG_ROTATION_BUTTON_VISIBLE) == 0));
+
+        mSpace = new Space(mNavButtonsView.getContext());
+        mSpace.setOnClickListener(view -> navButtonController.onButtonClick(BUTTON_SPACE, view));
+        mSpace.setOnLongClickListener(view ->
+                navButtonController.onButtonLongClick(BUTTON_SPACE, view));
     }
 
     private void parseSystemUiFlags(int sysUiStateFlags) {
@@ -760,7 +768,7 @@
                     NavButtonLayoutFactory.Companion.getUiLayoutter(
                             dp, mNavButtonsView, mImeSwitcherButton,
                             mControllers.rotationButtonController.getRotationButton(),
-                            mA11yButton, res, isInKidsMode, isInSetup, isThreeButtonNav,
+                            mA11yButton, mSpace, res, isInKidsMode, isInSetup, isThreeButtonNav,
                             mContext.isPhoneMode(), mWindowManagerProxy.getRotation(mContext));
             navButtonLayoutter.layoutButtons(mContext, isA11yButtonPersistent());
             updateButtonsBackground();
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java
index 3f72e5d..19293b5 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java
@@ -102,6 +102,7 @@
     static final int BUTTON_A11Y = BUTTON_IME_SWITCH << 1;
     static final int BUTTON_QUICK_SETTINGS = BUTTON_A11Y << 1;
     static final int BUTTON_NOTIFICATIONS = BUTTON_QUICK_SETTINGS << 1;
+    static final int BUTTON_SPACE = BUTTON_NOTIFICATIONS << 1;
 
     private static final int SCREEN_UNPIN_COMBO = BUTTON_BACK | BUTTON_RECENTS;
     private int mLongPressedButtons = 0;
@@ -123,6 +124,9 @@
     }
 
     public void onButtonClick(@TaskbarButton int buttonType, View view) {
+        if (buttonType == BUTTON_SPACE) {
+            return;
+        }
         // Provide the same haptic feedback that the system offers for virtual keys.
         view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
         switch (buttonType) {
@@ -156,6 +160,9 @@
     }
 
     public boolean onButtonLongClick(@TaskbarButton int buttonType, View view) {
+        if (buttonType == BUTTON_SPACE) {
+            return false;
+        }
         // Provide the same haptic feedback that the system offers for virtual keys.
         view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
         switch (buttonType) {
diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt
index 23e3310..ac47c60 100644
--- a/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/AbstractNavButtonLayoutter.kt
@@ -23,6 +23,7 @@
 import android.widget.FrameLayout
 import android.widget.ImageView
 import android.widget.LinearLayout
+import android.widget.Space
 import com.android.launcher3.R
 import com.android.launcher3.Utilities
 import com.android.launcher3.taskbar.navbutton.NavButtonLayoutFactory.NavButtonLayoutter
@@ -46,7 +47,8 @@
         protected val startContextualContainer: ViewGroup,
         protected val imeSwitcher: ImageView?,
         protected val rotationButton: RotationButton?,
-        protected val a11yButton: ImageView?
+        protected val a11yButton: ImageView?,
+        protected val space: Space
 ) : NavButtonLayoutter {
     protected val homeButton: ImageView? = navButtonContainer.findViewById(R.id.home)
     protected val recentsButton: ImageView? = navButtonContainer.findViewById(R.id.recent_apps)
diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt
index 38612ef..7578b4c 100644
--- a/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/KidsNavLayoutter.kt
@@ -25,6 +25,7 @@
 import android.widget.FrameLayout
 import android.widget.ImageView
 import android.widget.LinearLayout
+import android.widget.Space
 import com.android.launcher3.R
 import com.android.launcher3.taskbar.TaskbarActivityContext
 import com.android.launcher3.taskbar.navbutton.LayoutResourceHelper.*
@@ -37,7 +38,8 @@
         startContextualContainer: ViewGroup,
         imeSwitcher: ImageView?,
         rotationButton: RotationButton?,
-        a11yButton: ImageView?
+        a11yButton: ImageView?,
+        space: Space,
 ) :
     AbstractNavButtonLayoutter(
             resources,
@@ -46,7 +48,8 @@
             startContextualContainer,
             imeSwitcher,
             rotationButton,
-            a11yButton
+            a11yButton,
+            space
     ) {
 
     override fun layoutButtons(context: TaskbarActivityContext, isA11yButtonPersistent: Boolean) {
diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactory.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactory.kt
index 672bc0d..1d4ae7b 100644
--- a/quickstep/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactory.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactory.kt
@@ -23,6 +23,7 @@
 import android.widget.FrameLayout
 import android.widget.ImageView
 import android.widget.LinearLayout
+import android.widget.Space
 import com.android.launcher3.DeviceProfile
 import com.android.launcher3.taskbar.TaskbarActivityContext
 import com.android.launcher3.taskbar.navbutton.LayoutResourceHelper.*
@@ -60,6 +61,7 @@
                 imeSwitcher: ImageView?,
                 rotationButton: RotationButton?,
                 a11yButton: ImageView?,
+                space: Space,
                 resources: Resources,
                 isKidsMode: Boolean,
                 isInSetup: Boolean,
@@ -86,7 +88,8 @@
                                 startContextualContainer,
                                 imeSwitcher,
                                 rotationButton,
-                                a11yButton
+                                a11yButton,
+                                space
                         )
                     } else if (surfaceRotation == ROTATION_90) {
                         navButtonsView.setIsVertical(true)
@@ -97,7 +100,8 @@
                                 startContextualContainer,
                                 imeSwitcher,
                                 rotationButton,
-                                a11yButton
+                                a11yButton,
+                                space
                         )
                     } else {
                         navButtonsView.setIsVertical(true)
@@ -108,7 +112,8 @@
                                 startContextualContainer,
                                 imeSwitcher,
                                 rotationButton,
-                                a11yButton
+                                a11yButton,
+                                space
                         )
                     }
                 }
@@ -120,7 +125,8 @@
                             startContextualContainer,
                             imeSwitcher,
                             rotationButton,
-                            a11yButton
+                            a11yButton,
+                            space
                     )
                 }
                 deviceProfile.isTaskbarPresent -> {
@@ -133,7 +139,8 @@
                                     startContextualContainer,
                                     imeSwitcher,
                                     rotationButton,
-                                    a11yButton
+                                    a11yButton,
+                                    space
                             )
                         }
                         isKidsMode -> {
@@ -144,7 +151,8 @@
                                     startContextualContainer,
                                     imeSwitcher,
                                     rotationButton,
-                                    a11yButton
+                                    a11yButton,
+                                    space
                             )
                         }
                         else ->
@@ -155,7 +163,8 @@
                                     startContextualContainer,
                                     imeSwitcher,
                                     rotationButton,
-                                    a11yButton
+                                    a11yButton,
+                                    space
                             )
                     }
                 }
diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/NearestTouchFrame.java b/quickstep/src/com/android/launcher3/taskbar/navbutton/NearestTouchFrame.java
index a477303..bbf08bf 100644
--- a/quickstep/src/com/android/launcher3/taskbar/navbutton/NearestTouchFrame.java
+++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/NearestTouchFrame.java
@@ -27,6 +27,7 @@
 
 import java.io.PrintWriter;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
@@ -42,7 +43,10 @@
     private final List<View> mClickableChildren = new ArrayList<>();
     private final List<View> mAttachedChildren = new ArrayList<>();
     private final boolean mIsActive;
+    private final int[] mTmpInt = new int[2];
 
+    // Offset (as the base) to translate window cords to view cords.
+    private final int[] mWindowOffset = new int[2];
     private boolean mIsVertical;
     private View mTouchingChild;
     private final Map<View, Rect> mTouchableRegions = new HashMap<>();
@@ -52,8 +56,11 @@
      */
     private final Comparator<View> mChildRegionComparator =
             (view1, view2) -> {
-                int startingCoordView1 = mIsVertical ? view1.getTop() : view1.getLeft();
-                int startingCoordView2 = mIsVertical ? view2.getTop() : view2.getLeft();
+                int leftTopIndex = mIsVertical ? 1 : 0;
+                view1.getLocationInWindow(mTmpInt);
+                int startingCoordView1 = mTmpInt[leftTopIndex] - mWindowOffset[leftTopIndex];
+                view2.getLocationInWindow(mTmpInt);
+                int startingCoordView2 = mTmpInt[leftTopIndex] - mWindowOffset[leftTopIndex];
 
                 return startingCoordView1 - startingCoordView2;
             };
@@ -74,6 +81,7 @@
         mAttachedChildren.clear();
         mTouchableRegions.clear();
         addClickableChildren(this);
+        getLocationInWindow(mWindowOffset);
         cacheClosestChildLocations();
     }
 
@@ -147,8 +155,9 @@
     }
 
     private Rect getChildsBounds(View child) {
-        int left = child.getLeft();
-        int top = child.getTop();
+        child.getLocationInWindow(mTmpInt);
+        int left = mTmpInt[0] - mWindowOffset[0];
+        int top = mTmpInt[1] - mWindowOffset[1];
         int right = left + child.getWidth();
         int bottom = top + child.getHeight();
         return new Rect(left, top, right, bottom);
@@ -194,6 +203,7 @@
     public void dumpLogs(String prefix, PrintWriter pw) {
         pw.println(prefix + "NearestTouchFrame:");
 
+        pw.println(String.format("%s\tmWindowOffset=%s", prefix, Arrays.toString(mWindowOffset)));
         pw.println(String.format("%s\tmIsVertical=%s", prefix, mIsVertical));
         pw.println(String.format("%s\tmTouchingChild=%s", prefix, mTouchingChild));
         pw.println(String.format("%s\tmTouchableRegions=%s", prefix,
diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneGestureLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneGestureLayoutter.kt
index 3817f91..6d86f1b 100644
--- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneGestureLayoutter.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneGestureLayoutter.kt
@@ -20,6 +20,7 @@
 import android.view.ViewGroup
 import android.widget.ImageView
 import android.widget.LinearLayout
+import android.widget.Space
 import com.android.launcher3.taskbar.TaskbarActivityContext
 import com.android.systemui.shared.rotation.RotationButton
 
@@ -31,7 +32,8 @@
         startContextualContainer: ViewGroup,
         imeSwitcher: ImageView?,
         rotationButton: RotationButton?,
-        a11yButton: ImageView?
+        a11yButton: ImageView?,
+        space: Space,
 ) :
         AbstractNavButtonLayoutter(
                 resources,
@@ -40,7 +42,8 @@
                 startContextualContainer,
                 imeSwitcher,
                 rotationButton,
-                a11yButton
+                a11yButton,
+                space
         ) {
 
     override fun layoutButtons(context: TaskbarActivityContext, isA11yButtonPersistent: Boolean) {
diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt
index 4f5695e..db15542 100644
--- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneLandscapeNavLayoutter.kt
@@ -19,9 +19,11 @@
 import android.content.res.Resources
 import android.view.Gravity
 import android.view.ViewGroup
+import android.view.ViewGroup.LayoutParams.MATCH_PARENT
 import android.widget.FrameLayout
 import android.widget.ImageView
 import android.widget.LinearLayout
+import android.widget.Space
 import com.android.launcher3.R
 import com.android.launcher3.taskbar.TaskbarActivityContext
 import com.android.systemui.shared.rotation.RotationButton
@@ -34,6 +36,7 @@
         imeSwitcher: ImageView?,
         rotationButton: RotationButton?,
         a11yButton: ImageView?,
+        space: Space,
 ) :
     AbstractNavButtonLayoutter(
             resources,
@@ -42,7 +45,8 @@
             startContextualContainer,
             imeSwitcher,
             rotationButton,
-            a11yButton
+            a11yButton,
+            space
     ) {
 
     override fun layoutButtons(context: TaskbarActivityContext, isA11yButtonPersistent: Boolean) {
@@ -60,7 +64,7 @@
         val navButtonContainerHeight = contentWidth - contextualButtonHeight * 2
 
         val navContainerParams = FrameLayout.LayoutParams(
-            ViewGroup.LayoutParams.MATCH_PARENT, navButtonContainerHeight.toInt())
+                MATCH_PARENT, navButtonContainerHeight.toInt())
         navContainerParams.apply {
             topMargin =
                     (contextualButtonHeight + contentPadding + roundedCornerContentMargin).toInt()
@@ -125,6 +129,8 @@
         val contentPadding = resources.getDimensionPixelSize(R.dimen.taskbar_phone_content_padding)
         repositionContextualContainer(startContextualContainer, buttonSize,
                 roundedCornerContentMargin + contentPadding, 0, Gravity.TOP)
+        repositionContextualContainer(endContextualContainer, buttonSize,
+                0, roundedCornerContentMargin + contentPadding, Gravity.BOTTOM)
 
         if (imeSwitcher != null) {
             startContextualContainer.addView(imeSwitcher)
@@ -138,13 +144,13 @@
             startContextualContainer.addView(rotationButton.currentView)
             rotationButton.currentView.layoutParams = getParamsToCenterView()
         }
+        endContextualContainer.addView(space, MATCH_PARENT, MATCH_PARENT)
     }
 
     override fun repositionContextualContainer(contextualContainer: ViewGroup, buttonSize: Int,
                                                barAxisMarginTop: Int, barAxisMarginBottom: Int,
                                                gravity: Int) {
-        val contextualContainerParams = FrameLayout.LayoutParams(
-                ViewGroup.LayoutParams.MATCH_PARENT, buttonSize)
+        val contextualContainerParams = FrameLayout.LayoutParams(MATCH_PARENT, buttonSize)
         contextualContainerParams.apply {
             marginStart = 0
             marginEnd = 0
diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt
index 8448d0e..3eb25a2 100644
--- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhonePortraitNavLayoutter.kt
@@ -19,9 +19,11 @@
 import android.content.res.Resources
 import android.view.Gravity
 import android.view.ViewGroup
+import android.view.ViewGroup.LayoutParams.MATCH_PARENT
 import android.widget.FrameLayout
 import android.widget.ImageView
 import android.widget.LinearLayout
+import android.widget.Space
 import com.android.launcher3.R
 import com.android.launcher3.taskbar.TaskbarActivityContext
 import com.android.systemui.shared.rotation.RotationButton
@@ -34,6 +36,7 @@
         imeSwitcher: ImageView?,
         rotationButton: RotationButton?,
         a11yButton: ImageView?,
+        space: Space
 ) :
     AbstractNavButtonLayoutter(
             resources,
@@ -42,7 +45,8 @@
             startContextualContainer,
             imeSwitcher,
             rotationButton,
-            a11yButton
+            a11yButton,
+            space
     ) {
 
     override fun layoutButtons(context: TaskbarActivityContext, isA11yButtonPersistent: Boolean) {
@@ -110,9 +114,12 @@
         endContextualContainer.removeAllViews()
         startContextualContainer.removeAllViews()
 
+        repositionContextualContainer(startContextualContainer, contextualButtonWidth.toInt(),
+                roundedCornerContentMargin + contentPadding, 0, Gravity.START)
         repositionContextualContainer(endContextualContainer, contextualButtonWidth.toInt(), 0,
                 roundedCornerContentMargin + contentPadding, Gravity.END)
 
+        startContextualContainer.addView(space, MATCH_PARENT, MATCH_PARENT)
         if (imeSwitcher != null) {
             endContextualContainer.addView(imeSwitcher)
             imeSwitcher.layoutParams = getParamsToCenterView()
diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt
index 26e8987..899aab4 100644
--- a/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/PhoneSeascapeNavLayoutter.kt
@@ -19,8 +19,10 @@
 import android.content.res.Resources
 import android.view.Gravity
 import android.view.ViewGroup
+import android.view.ViewGroup.LayoutParams.MATCH_PARENT
 import android.widget.ImageView
 import android.widget.LinearLayout
+import android.widget.Space
 import com.android.launcher3.R
 import com.android.systemui.shared.rotation.RotationButton
 
@@ -31,7 +33,8 @@
         startContextualContainer: ViewGroup,
         imeSwitcher: ImageView?,
         rotationButton: RotationButton?,
-        a11yButton: ImageView?
+        a11yButton: ImageView?,
+        space: Space,
 ) :
         PhoneLandscapeNavLayoutter(
                 resources,
@@ -40,7 +43,8 @@
                 startContextualContainer,
                 imeSwitcher,
                 rotationButton,
-                a11yButton
+                a11yButton,
+                space
         ) {
 
     override fun addThreeButtons() {
@@ -57,9 +61,12 @@
         val roundedCornerContentMargin = resources.getDimensionPixelSize(
                 R.dimen.taskbar_phone_rounded_corner_content_margin)
         val contentPadding = resources.getDimensionPixelSize(R.dimen.taskbar_phone_content_padding)
+        repositionContextualContainer(startContextualContainer, buttonSize,
+                roundedCornerContentMargin + contentPadding, 0, Gravity.TOP)
         repositionContextualContainer(endContextualContainer, buttonSize, 0,
                 roundedCornerContentMargin + contentPadding,  Gravity.BOTTOM)
 
+        startContextualContainer.addView(space, MATCH_PARENT, MATCH_PARENT)
         if (imeSwitcher != null) {
             endContextualContainer.addView(imeSwitcher)
             imeSwitcher.layoutParams = getParamsToCenterView()
diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt
index d3410fa..f31443c 100644
--- a/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/SetupNavLayoutter.kt
@@ -23,6 +23,7 @@
 import android.widget.FrameLayout
 import android.widget.ImageView
 import android.widget.LinearLayout
+import android.widget.Space
 import com.android.launcher3.R
 import com.android.launcher3.taskbar.TaskbarActivityContext
 import com.android.systemui.shared.rotation.RotationButton
@@ -34,7 +35,8 @@
         startContextualContainer: ViewGroup,
         imeSwitcher: ImageView?,
         rotationButton: RotationButton?,
-        a11yButton: ImageView?
+        a11yButton: ImageView?,
+        space: Space,
 ) :
     AbstractNavButtonLayoutter(
             resources,
@@ -43,7 +45,8 @@
             startContextualContainer,
             imeSwitcher,
             rotationButton,
-            a11yButton
+            a11yButton,
+            space
     ) {
 
     override fun layoutButtons(context: TaskbarActivityContext, isA11yButtonPersistent: Boolean) {
diff --git a/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt b/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt
index 387844b..69e524e 100644
--- a/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/navbutton/TaskbarNavLayoutter.kt
@@ -23,6 +23,7 @@
 import android.widget.FrameLayout
 import android.widget.ImageView
 import android.widget.LinearLayout
+import android.widget.Space
 import com.android.launcher3.R
 import com.android.launcher3.taskbar.TaskbarActivityContext
 import com.android.systemui.shared.rotation.RotationButton
@@ -37,7 +38,8 @@
         startContextualContainer: ViewGroup,
         imeSwitcher: ImageView?,
         rotationButton: RotationButton?,
-        a11yButton: ImageView?
+        a11yButton: ImageView?,
+        space: Space
 ) :
     AbstractNavButtonLayoutter(
             resources,
@@ -46,7 +48,8 @@
             startContextualContainer,
             imeSwitcher,
             rotationButton,
-            a11yButton
+            a11yButton,
+            space
     ) {
 
     override fun layoutButtons(context: TaskbarActivityContext, isA11yButtonPersistent: Boolean) {
diff --git a/quickstep/tests/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactoryTest.kt b/quickstep/tests/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactoryTest.kt
index 9c7fdc6..87cbdd1 100644
--- a/quickstep/tests/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactoryTest.kt
+++ b/quickstep/tests/src/com/android/launcher3/taskbar/navbutton/NavButtonLayoutFactoryTest.kt
@@ -9,6 +9,7 @@
 import android.widget.FrameLayout
 import android.widget.ImageView
 import android.widget.LinearLayout
+import android.widget.Space
 import androidx.test.runner.AndroidJUnit4
 import com.android.launcher3.DeviceProfile
 import com.android.launcher3.R
@@ -38,6 +39,7 @@
     private val mockImeSwitcher: ImageView = mock()
     private val mockRotationButton: RotationButton = mock()
     private val mockA11yButton: ImageView = mock()
+    private val mockSpace: Space = mock()
 
     private var surfaceRotation = Surface.ROTATION_0
 
@@ -201,7 +203,8 @@
             surfaceRotation = surfaceRotation,
             imeSwitcher = mockImeSwitcher,
             rotationButton = mockRotationButton,
-            a11yButton = mockA11yButton
+            a11yButton = mockA11yButton,
+            space = mockSpace,
         )
     }
 }
diff --git a/res/values/id.xml b/res/values/id.xml
index 6156c91..198496f 100644
--- a/res/values/id.xml
+++ b/res/values/id.xml
@@ -32,6 +32,7 @@
     <item type="id" name="ime_switcher" />
     <item type="id" name="accessibility_button" />
     <item type="id" name="rotate_suggestion" />
+    <item type="id" name="space" />
     <!--  /Do not change, must be kept in sync with sysui navbar button IDs for tests!  -->
 
     <item type="id" name="quick_settings_button" />