From e0227551cf632f13cc016f5d21349a2a80245250 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Wed, 6 Apr 2022 19:44:43 +0100 Subject: [PATCH] Clone mInsets when copying DeviceProfile to taskbar - Set mInsets with windowBounds.insets when initialized, and set windowBounds.insets when cloning DeviceProfile - Added more bottom sheet / all apps in DeviceProfile dump - Also dump taskbar's device profile in dumpsys Fix: 226968237 Test: Taskbar AllApps should have correct top padding Test: adb shell dumpsys activity com.google.android.apps.nexuslauncher Test: adb shell dumpsys activity service com.google.android.apps.nexuslauncher/com.android.quickstep.TouchInteractionService Change-Id: I7739c699fb16544b92dc820354a643f745694c25 --- .../launcher3/taskbar/TaskbarActivityContext.java | 1 + .../android/quickstep/TouchInteractionService.java | 2 +- src/com/android/launcher3/DeviceProfile.java | 13 +++++++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 1c6d4a2992..296000b054 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -785,5 +785,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext { pw.println(String.format( "%s\tmBindInProgress=%b", prefix, mBindingItems)); mControllers.dumpLogs(prefix + "\t", pw); + mDeviceProfile.dump(prefix, pw); } } diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index a38728a357..e59ae88f20 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -963,10 +963,10 @@ public class TouchInteractionService extends Service RecentsModel.INSTANCE.get(this).dump("", pw); pw.println("ProtoTrace:"); pw.println(" file=" + ProtoTracer.INSTANCE.get(this).getTraceFile()); - mTaskbarManager.dumpLogs("", pw); if (createdOverviewActivity != null) { createdOverviewActivity.getDeviceProfile().dump("", pw); } + mTaskbarManager.dumpLogs("", pw); } } diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 3489c31306..d8956c2f83 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -246,6 +246,7 @@ public class DeviceProfile { windowX = windowBounds.bounds.left; windowY = windowBounds.bounds.top; this.rotationHint = windowBounds.rotationHint; + mInsets.set(windowBounds.insets); isScalableGrid = inv.isScalable && !isVerticalBarLayout() && !isMultiWindowMode; @@ -298,7 +299,7 @@ public class DeviceProfile { desiredWorkspaceHorizontalMarginPx = getHorizontalMarginPx(inv, res); desiredWorkspaceHorizontalMarginOriginalPx = desiredWorkspaceHorizontalMarginPx; - bottomSheetTopPadding = windowBounds.insets.top // statusbar height + bottomSheetTopPadding = mInsets.top // statusbar height + res.getDimensionPixelSize(R.dimen.bottom_sheet_extra_top_padding) + (isTablet ? 0 : edgeMarginPx); // phones need edgeMarginPx additional padding @@ -567,6 +568,7 @@ public class DeviceProfile { WindowBounds bounds = new WindowBounds( widthPx, heightPx, availableWidthPx, availableHeightPx, rotationHint); bounds.bounds.offsetTo(windowX, windowY); + bounds.insets.set(mInsets); return new Builder(context, inv, mInfo) .setWindowBounds(bounds) .setUseTwoPanels(isTwoPanels) @@ -1144,9 +1146,12 @@ public class DeviceProfile { writer.println(prefix + pxToDpStr("windowY", windowY)); writer.println(prefix + pxToDpStr("widthPx", widthPx)); writer.println(prefix + pxToDpStr("heightPx", heightPx)); - writer.println(prefix + pxToDpStr("availableWidthPx", availableWidthPx)); writer.println(prefix + pxToDpStr("availableHeightPx", availableHeightPx)); + writer.println(prefix + pxToDpStr("mInsets.left", mInsets.left)); + writer.println(prefix + pxToDpStr("mInsets.top", mInsets.top)); + writer.println(prefix + pxToDpStr("mInsets.right", mInsets.right)); + writer.println(prefix + pxToDpStr("mInsets.bottom", mInsets.bottom)); writer.println(prefix + "\taspectRatio:" + aspectRatio); @@ -1187,6 +1192,10 @@ public class DeviceProfile { writer.println(prefix + pxToDpStr("folderCellLayoutBorderSpacePx Vertical", folderCellLayoutBorderSpacePx.y)); + writer.println(prefix + pxToDpStr("bottomSheetTopPadding", bottomSheetTopPadding)); + + writer.println(prefix + pxToDpStr("allAppsShiftRange", allAppsShiftRange)); + writer.println(prefix + pxToDpStr("allAppsTopPadding", allAppsTopPadding)); writer.println(prefix + pxToDpStr("allAppsIconSizePx", allAppsIconSizePx)); writer.println(prefix + pxToDpStr("allAppsIconTextSizePx", allAppsIconTextSizePx)); writer.println(prefix + pxToDpStr("allAppsIconDrawablePaddingPx",