Calculate taskbar content size for edu

Using the value calculated in layout was not working because TaskbarView onLayout() was being called after TaskbarEduView onMeasure(). Now uses the same value on all orientations based on taskbar icon size.

Fixes: 252945031
Test: manual
Change-Id: Ib6914901638c82f3b3ec4c9b86f6c20e84d34d0f
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduController.java
index 95b93fe..2c24161 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduController.java
@@ -222,7 +222,7 @@
         }
 
         int getIconLayoutBoundsWidth() {
-            return mControllers.taskbarViewController.getIconLayoutBounds().width();
+            return mControllers.taskbarViewController.getIconLayoutWidth();
         }
     }
 }
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
index bb82d19..1bddcca 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
@@ -321,12 +321,8 @@
     @Override
     protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
         int count = getChildCount();
-        int countExcludingQsb = count;
         DeviceProfile deviceProfile = mActivityContext.getDeviceProfile();
-        if (deviceProfile.isQsbInline) {
-            countExcludingQsb--;
-        }
-        int spaceNeeded = countExcludingQsb * (mItemMarginLeftRight * 2 + mIconTouchSize);
+        int spaceNeeded = getIconLayoutWidth();
         int navSpaceNeeded = deviceProfile.hotseatBarEndOffset;
         boolean layoutRtl = isLayoutRtl();
         int iconEnd = right - (right - left - spaceNeeded) / 2;
@@ -417,6 +413,18 @@
     }
 
     /**
+     * Returns the space used by the icons
+     */
+    public int getIconLayoutWidth() {
+        int countExcludingQsb = getChildCount();
+        DeviceProfile deviceProfile = mActivityContext.getDeviceProfile();
+        if (deviceProfile.isQsbInline) {
+            countExcludingQsb--;
+        }
+        return countExcludingQsb * (mItemMarginLeftRight * 2 + mIconTouchSize);
+    }
+
+    /**
      * Returns the app icons currently shown in the taskbar.
      */
     public View[] getIconViews() {
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
index 16dd90d..1530ce1 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
@@ -193,6 +193,10 @@
         return mTaskbarView.getIconLayoutBounds();
     }
 
+    public int getIconLayoutWidth() {
+        return mTaskbarView.getIconLayoutWidth();
+    }
+
     public View[] getIconViews() {
         return mTaskbarView.getIconViews();
     }