resolve merge conflicts of a754e678a7a2fddfa716783f8c5f2fc99da68973 to sc-v2-dev

Move qsb according to spec.

Bug: 175329686
Test: visual test
      checked 5x5 and confirmed no visual change
      checked 4x5 and confirmed visual change
      - tested various display sizes to ensure no overlapping is caused


Change-Id: I5e00fcf57ffde597c6af08c6464ddfd7e8456bca
Merged-In: I95a80b484516f634fa13347534810c7a51cecc8d
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 3c0cbb6..2eba4ed 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -162,6 +162,9 @@
     public final int hotseatBarSidePaddingEndPx;
     public final int hotseatQsbHeight;
 
+    public final float qsbBottomMarginOriginalPx;
+    public int qsbBottomMarginPx;
+
     // All apps
     public int allAppsOpenVerticalTranslate;
     public int allAppsCellHeightPx;
@@ -336,6 +339,10 @@
                 res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_extra_vertical_size);
         updateHotseatIconSize(pxFromDp(inv.iconSize, mMetrics, 1f));
 
+        qsbBottomMarginOriginalPx = isScalableGrid
+                ? res.getDimensionPixelSize(R.dimen.scalable_grid_qsb_bottom_margin)
+                : 0;
+
         overviewTaskMarginPx = res.getDimensionPixelSize(R.dimen.overview_task_margin);
         overviewTaskIconSizePx =
                 isTablet && FeatureFlags.ENABLE_OVERVIEW_GRID.get() ? res.getDimensionPixelSize(
@@ -364,6 +371,8 @@
             extraHotseatBottomPadding = Math.round(paddingHotseatBottom * iconScale);
 
             hotseatBarSizePx += extraHotseatBottomPadding;
+
+            qsbBottomMarginPx = Math.round(qsbBottomMarginOriginalPx * iconScale);
         } else if (!isVerticalBarLayout() && isPhone && isTallDevice) {
             // We increase the hotseat size when there is extra space.
             // ie. For a display with a large aspect ratio, we can keep the icons on the workspace
@@ -810,8 +819,13 @@
         int freeSpace = isTaskbarPresent
                 ? workspacePadding.bottom
                 : hotseatBarSizePx - hotseatCellHeightPx - hotseatQsbHeight;
-        return (int) (freeSpace * QSB_CENTER_FACTOR)
+
+        if (isScalableGrid && qsbBottomMarginPx <= freeSpace) {
+            return qsbBottomMarginPx;
+        } else {
+            return (int) (freeSpace * QSB_CENTER_FACTOR)
                 + (isTaskbarPresent ? taskbarSize : getInsets().bottom);
+        }
     }
 
     /**