launcher: create paddings for foldables
This creates a new padding file that bring some foldables up to spec
with VisD. For 2 panel layouts it now uses workspace margin instead of
cell layout padding.
Bug: 191879424
Fixes: 200035429
Test: checking paddings in HSV
Change-Id: I11b8e1afd76f535368d4c26e31630ce496171e13
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index d534c5d..523ac72 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -638,7 +638,10 @@
}
private int getPageWidthSize(int widthSize) {
- return (widthSize - mInsets.left - mInsets.right) / getPanelCount();
+ // It's necessary to add the padding back because it is remove when measuring children,
+ // like when MeasureSpec.getSize in CellLayout.
+ return (widthSize - mInsets.left - mInsets.right - getPaddingLeft() - getPaddingRight())
+ / getPanelCount() + getPaddingLeft() + getPaddingRight();
}
@Override