diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 2440854028..387f5164da 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -167,6 +167,8 @@ public class DeviceProfile { // Taskbar public boolean isTaskbarPresent; public int taskbarSize; + // How much of the bottom inset is due to Taskbar rather than other system elements. + public int nonOverlappingTaskbarInset; DeviceProfile(Context context, InvariantDeviceProfile inv, Info info, Point minSize, Point maxSize, int width, int height, boolean isLandscape, @@ -221,7 +223,7 @@ public class DeviceProfile { WindowInsets windowInsets = DisplayController.INSTANCE.get(context).getHolder(mInfo.id) .getDisplayContext().getSystemService(WindowManager.class) .getCurrentWindowMetrics().getWindowInsets(); - int nonOverlappingTaskbarInset = + nonOverlappingTaskbarInset = taskbarSize - windowInsets.getSystemWindowInsetBottom(); if (nonOverlappingTaskbarInset > 0) { nonFinalAvailableHeightPx -= nonOverlappingTaskbarInset; diff --git a/src/com/android/launcher3/LauncherRootView.java b/src/com/android/launcher3/LauncherRootView.java index 76c4518169..83ddf641b7 100644 --- a/src/com/android/launcher3/LauncherRootView.java +++ b/src/com/android/launcher3/LauncherRootView.java @@ -41,8 +41,15 @@ public class LauncherRootView extends InsettableFrameLayout { } private void handleSystemWindowInsets(Rect insets) { - // Update device profile before notifying th children. - mActivity.getDeviceProfile().updateInsets(insets); + DeviceProfile dp = mActivity.getDeviceProfile(); + + // Taskbar provides insets, but we don't want that for most Launcher elements so remove it. + mTempRect.set(insets); + insets = mTempRect; + insets.bottom = Math.max(0, insets.bottom - dp.nonOverlappingTaskbarInset); + + // Update device profile before notifying the children. + dp.updateInsets(insets); boolean resetState = !insets.equals(mInsets); setInsets(insets); diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 87fb6fb7a1..80d9bfc84b 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -310,6 +310,8 @@ public class Workspace extends PagedView Rect padding = grid.workspacePadding; setPadding(padding.left, padding.top, padding.right, padding.bottom); mInsets.set(insets); + // Increase our bottom insets so we don't overlap with the taskbar. + mInsets.bottom += grid.nonOverlappingTaskbarInset; if (mWorkspaceFadeInAdjacentScreens) { // In landscape mode the page spacing is set to the default. diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index edd9a9f7ef..b7b1229080 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -395,7 +395,8 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo @Override public WindowInsets dispatchApplyWindowInsets(WindowInsets insets) { if (Utilities.ATLEAST_Q) { - mNavBarScrimHeight = insets.getTappableElementInsets().bottom; + mNavBarScrimHeight = insets.getTappableElementInsets().bottom + - mLauncher.getDeviceProfile().nonOverlappingTaskbarInset; } else { mNavBarScrimHeight = insets.getStableInsetBottom(); } diff --git a/src/com/android/launcher3/pageindicators/WorkspacePageIndicator.java b/src/com/android/launcher3/pageindicators/WorkspacePageIndicator.java index 6189dc9557..a7cd10d628 100644 --- a/src/com/android/launcher3/pageindicators/WorkspacePageIndicator.java +++ b/src/com/android/launcher3/pageindicators/WorkspacePageIndicator.java @@ -269,7 +269,7 @@ public class WorkspacePageIndicator extends View implements Insettable, PageIndi lp.leftMargin = lp.rightMargin = 0; lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM; lp.bottomMargin = grid.isTaskbarPresent - ? grid.workspacePadding.bottom + insets.bottom + ? grid.workspacePadding.bottom + grid.taskbarSize : grid.hotseatBarSizePx + insets.bottom; } setLayoutParams(lp);