Stop using bottom inset in preview
We are not using the bottom inset (navbar) in Launcher anymore, so we should not use it in preview as well.
Fixes 205284107
Test: manual
Change-Id: Iefd71b3cbe8e738c4559716af8c85015ba7c3c41
diff --git a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
index 88ce57e..2459e09 100644
--- a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
+++ b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
@@ -111,7 +111,7 @@
* 3) Place appropriate elements like icons and first-page qsb
* 4) Measure and draw the view on a canvas
*/
-@TargetApi(Build.VERSION_CODES.O)
+@TargetApi(Build.VERSION_CODES.R)
public class LauncherPreviewRenderer extends ContextWrapper
implements ActivityContext, WorkspaceLayoutManager, LayoutInflater.Factory2 {
@@ -186,19 +186,13 @@
mIdp = idp;
mDp = idp.getDeviceProfile(context).copy(context);
- if (Utilities.ATLEAST_R) {
- WindowInsets currentWindowInsets = context.getSystemService(WindowManager.class)
- .getCurrentWindowMetrics().getWindowInsets();
- mInsets = new Rect(
- currentWindowInsets.getSystemWindowInsetLeft(),
- currentWindowInsets.getSystemWindowInsetTop(),
- currentWindowInsets.getSystemWindowInsetRight(),
- currentWindowInsets.getSystemWindowInsetBottom());
- } else {
- mInsets = new Rect();
- mInsets.left = mInsets.right = (mDp.widthPx - mDp.availableWidthPx) / 2;
- mInsets.top = mInsets.bottom = (mDp.heightPx - mDp.availableHeightPx) / 2;
- }
+ WindowInsets currentWindowInsets = context.getSystemService(WindowManager.class)
+ .getCurrentWindowMetrics().getWindowInsets();
+ mInsets = new Rect(
+ currentWindowInsets.getSystemWindowInsetLeft(),
+ currentWindowInsets.getSystemWindowInsetTop(),
+ currentWindowInsets.getSystemWindowInsetRight(),
+ mDp.isTaskbarPresent ? 0 : currentWindowInsets.getSystemWindowInsetBottom());
mDp.updateInsets(mInsets);
BaseIconFactory iconFactory =