Loading src/com/android/launcher3/DeviceProfile.java +7 −20 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ import android.graphics.Point; import android.graphics.PointF; import android.graphics.Rect; import android.util.DisplayMetrics; import android.util.Pair; import android.view.Surface; import com.android.launcher3.CellLayout.ContainerType; Loading Loading @@ -215,8 +214,6 @@ public class DeviceProfile { // Whether Taskbar will inset the bottom of apps by taskbarSize. public boolean isTaskbarPresentInApps; public int taskbarSize; // How much of the bottom inset is due to Taskbar rather than other system elements. public int nonOverlappingTaskbarInset; // DragController public int flingToDeleteThresholdVelocity; Loading @@ -239,7 +236,7 @@ public class DeviceProfile { widthPx = windowBounds.bounds.width(); heightPx = windowBounds.bounds.height(); availableWidthPx = windowBounds.availableSize.x; int nonFinalAvailableHeightPx = windowBounds.availableSize.y; availableHeightPx = windowBounds.availableSize.y; mInfo = info; // If the device's pixel density was scaled (usually via settings for A11y), use the Loading @@ -266,15 +263,8 @@ public class DeviceProfile { isTaskbarPresent = isTablet && ApiWrapper.TASKBAR_DRAWN_IN_PROCESS && FeatureFlags.ENABLE_TASKBAR.get(); if (isTaskbarPresent) { // Taskbar will be added later, but provides bottom insets that we should subtract // from availableHeightPx. taskbarSize = res.getDimensionPixelSize(R.dimen.taskbar_size); nonOverlappingTaskbarInset = taskbarSize - windowBounds.insets.bottom; if (nonOverlappingTaskbarInset > 0) { nonFinalAvailableHeightPx -= nonOverlappingTaskbarInset; } } availableHeightPx = nonFinalAvailableHeightPx; edgeMarginPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_edge_margin); Loading Loading @@ -842,7 +832,7 @@ public class DeviceProfile { padding.right = hotseatBarSizePx; } } else { int hotseatTop = isTaskbarPresent ? taskbarSize : hotseatBarSizePx; int hotseatTop = hotseatBarSizePx; int paddingBottom = hotseatTop + workspacePageIndicatorHeight + workspaceBottomPadding - mWorkspacePageIndicatorOverlapWorkspace; if (isTablet) { Loading @@ -853,8 +843,7 @@ public class DeviceProfile { ((inv.numColumns - 1) * cellWidthPx))); availablePaddingX = (int) Math.min(availablePaddingX, widthPx * MAX_HORIZONTAL_PADDING_PERCENT); int hotseatVerticalPadding = isTaskbarPresent ? 0 : hotseatBarTopPaddingPx + hotseatBarBottomPaddingPx; int hotseatVerticalPadding = hotseatBarTopPaddingPx + hotseatBarBottomPaddingPx; int availablePaddingY = Math.max(0, heightPx - edgeMarginPx - paddingBottom - (2 * inv.numRows * cellHeightPx) - hotseatVerticalPadding); padding.set(availablePaddingX / 2, edgeMarginPx + availablePaddingY / 2, Loading Loading @@ -886,9 +875,9 @@ public class DeviceProfile { mInsets.right + hotseatBarSidePaddingStartPx, mInsets.bottom); } } else if (isTaskbarPresent) { int hotseatHeight = workspacePadding.bottom + taskbarSize; int hotseatHeight = workspacePadding.bottom; int taskbarOffset = getTaskbarOffsetY(); int hotseatTopDiff = hotseatHeight - taskbarSize - taskbarOffset; int hotseatTopDiff = hotseatHeight - taskbarOffset; int endOffset = ApiWrapper.getHotseatEndOffset(context); int requiredWidth = iconSizePx * numShownHotseatIcons; Loading Loading @@ -938,7 +927,8 @@ public class DeviceProfile { : hotseatBarSizePx - hotseatCellHeightPx - hotseatQsbHeight; if (isScalableGrid && qsbBottomMarginPx > mInsets.bottom) { return Math.min(qsbBottomMarginPx, freeSpace); // Note that taskbarSize = 0 unless isTaskbarPresent. return Math.min(qsbBottomMarginPx + taskbarSize, freeSpace); } else { return (int) (freeSpace * QSB_CENTER_FACTOR) + (isTaskbarPresent ? taskbarSize : mInsets.bottom); Loading Loading @@ -1116,10 +1106,7 @@ public class DeviceProfile { writer.println(prefix + "\tisTaskbarPresent:" + isTaskbarPresent); writer.println(prefix + "\tisTaskbarPresentInApps:" + isTaskbarPresentInApps); writer.println(prefix + pxToDpStr("taskbarSize", taskbarSize)); writer.println(prefix + pxToDpStr("nonOverlappingTaskbarInset", nonOverlappingTaskbarInset)); writer.println(prefix + pxToDpStr("workspacePadding.left", workspacePadding.left)); writer.println(prefix + pxToDpStr("workspacePadding.top", workspacePadding.top)); Loading src/com/android/launcher3/LauncherRootView.java +3 −16 Original line number Diff line number Diff line Loading @@ -47,15 +47,8 @@ public class LauncherRootView extends InsettableFrameLayout { } private void handleSystemWindowInsets(Rect 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); mActivity.getDeviceProfile().updateInsets(insets); boolean resetState = !insets.equals(mInsets); setInsets(insets); Loading Loading @@ -86,10 +79,6 @@ public class LauncherRootView extends InsettableFrameLayout { * get its insets, we calculate them ourselves so they are stable regardless of whether taskbar * is currently attached. * * TODO(b/198798034): Currently we always calculate nav insets as taskbarSize, but then we * subtract nonOverlappingTaskbarInset in handleSystemWindowInsets(). Instead, we should just * calculate the normal nav bar height here, and remove nonOverlappingTaskbarInset altogether. * * @param oldInsets The system-provided insets, which we are modifying. * @return The updated insets. */ Loading @@ -108,10 +97,8 @@ public class LauncherRootView extends InsettableFrameLayout { Insets oldNavInsets = oldInsets.getInsets(WindowInsets.Type.navigationBars()); Rect newNavInsets = new Rect(oldNavInsets.left, oldNavInsets.top, oldNavInsets.right, oldNavInsets.bottom); if (dp.isTaskbarPresent) { // TODO (see javadoc): Remove this block and fall into the next one instead. newNavInsets.bottom = dp.taskbarSize; } else if (dp.isLandscape) { if (dp.isLandscape) { if (dp.isTablet) { newNavInsets.bottom = ResourceUtils.getNavbarSize( "navigation_bar_height_landscape", resources); Loading src/com/android/launcher3/Workspace.java +0 −2 Original line number Diff line number Diff line Loading @@ -314,8 +314,6 @@ public class Workspace extends PagedView<WorkspacePageIndicator> 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. Loading src/com/android/launcher3/pageindicators/WorkspacePageIndicator.java +1 −3 Original line number Diff line number Diff line Loading @@ -268,9 +268,7 @@ public class WorkspacePageIndicator extends View implements Insettable, PageIndi } else { lp.leftMargin = lp.rightMargin = 0; lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM; lp.bottomMargin = grid.isTaskbarPresent ? grid.workspacePadding.bottom + grid.taskbarSize : grid.hotseatBarSizePx + insets.bottom; lp.bottomMargin = grid.hotseatBarSizePx + insets.bottom; } setLayoutParams(lp); } Loading src/com/android/launcher3/states/SpringLoadedState.java +1 −2 Original line number Diff line number Diff line Loading @@ -59,11 +59,10 @@ public class SpringLoadedState extends LauncherState { float scale = grid.workspaceSpringLoadShrinkFactor; Rect insets = launcher.getDragLayer().getInsets(); int insetsBottom = grid.isTaskbarPresent ? grid.taskbarSize : insets.bottom; float scaledHeight = scale * ws.getNormalChildHeight(); float shrunkTop = insets.top + grid.dropTargetBarSizePx; float shrunkBottom = ws.getMeasuredHeight() - insetsBottom float shrunkBottom = ws.getMeasuredHeight() - insets.bottom - grid.workspacePadding.bottom - grid.workspaceSpringLoadedBottomSpace; float totalShrunkSpace = shrunkBottom - shrunkTop; Loading Loading
src/com/android/launcher3/DeviceProfile.java +7 −20 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ import android.graphics.Point; import android.graphics.PointF; import android.graphics.Rect; import android.util.DisplayMetrics; import android.util.Pair; import android.view.Surface; import com.android.launcher3.CellLayout.ContainerType; Loading Loading @@ -215,8 +214,6 @@ public class DeviceProfile { // Whether Taskbar will inset the bottom of apps by taskbarSize. public boolean isTaskbarPresentInApps; public int taskbarSize; // How much of the bottom inset is due to Taskbar rather than other system elements. public int nonOverlappingTaskbarInset; // DragController public int flingToDeleteThresholdVelocity; Loading @@ -239,7 +236,7 @@ public class DeviceProfile { widthPx = windowBounds.bounds.width(); heightPx = windowBounds.bounds.height(); availableWidthPx = windowBounds.availableSize.x; int nonFinalAvailableHeightPx = windowBounds.availableSize.y; availableHeightPx = windowBounds.availableSize.y; mInfo = info; // If the device's pixel density was scaled (usually via settings for A11y), use the Loading @@ -266,15 +263,8 @@ public class DeviceProfile { isTaskbarPresent = isTablet && ApiWrapper.TASKBAR_DRAWN_IN_PROCESS && FeatureFlags.ENABLE_TASKBAR.get(); if (isTaskbarPresent) { // Taskbar will be added later, but provides bottom insets that we should subtract // from availableHeightPx. taskbarSize = res.getDimensionPixelSize(R.dimen.taskbar_size); nonOverlappingTaskbarInset = taskbarSize - windowBounds.insets.bottom; if (nonOverlappingTaskbarInset > 0) { nonFinalAvailableHeightPx -= nonOverlappingTaskbarInset; } } availableHeightPx = nonFinalAvailableHeightPx; edgeMarginPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_edge_margin); Loading Loading @@ -842,7 +832,7 @@ public class DeviceProfile { padding.right = hotseatBarSizePx; } } else { int hotseatTop = isTaskbarPresent ? taskbarSize : hotseatBarSizePx; int hotseatTop = hotseatBarSizePx; int paddingBottom = hotseatTop + workspacePageIndicatorHeight + workspaceBottomPadding - mWorkspacePageIndicatorOverlapWorkspace; if (isTablet) { Loading @@ -853,8 +843,7 @@ public class DeviceProfile { ((inv.numColumns - 1) * cellWidthPx))); availablePaddingX = (int) Math.min(availablePaddingX, widthPx * MAX_HORIZONTAL_PADDING_PERCENT); int hotseatVerticalPadding = isTaskbarPresent ? 0 : hotseatBarTopPaddingPx + hotseatBarBottomPaddingPx; int hotseatVerticalPadding = hotseatBarTopPaddingPx + hotseatBarBottomPaddingPx; int availablePaddingY = Math.max(0, heightPx - edgeMarginPx - paddingBottom - (2 * inv.numRows * cellHeightPx) - hotseatVerticalPadding); padding.set(availablePaddingX / 2, edgeMarginPx + availablePaddingY / 2, Loading Loading @@ -886,9 +875,9 @@ public class DeviceProfile { mInsets.right + hotseatBarSidePaddingStartPx, mInsets.bottom); } } else if (isTaskbarPresent) { int hotseatHeight = workspacePadding.bottom + taskbarSize; int hotseatHeight = workspacePadding.bottom; int taskbarOffset = getTaskbarOffsetY(); int hotseatTopDiff = hotseatHeight - taskbarSize - taskbarOffset; int hotseatTopDiff = hotseatHeight - taskbarOffset; int endOffset = ApiWrapper.getHotseatEndOffset(context); int requiredWidth = iconSizePx * numShownHotseatIcons; Loading Loading @@ -938,7 +927,8 @@ public class DeviceProfile { : hotseatBarSizePx - hotseatCellHeightPx - hotseatQsbHeight; if (isScalableGrid && qsbBottomMarginPx > mInsets.bottom) { return Math.min(qsbBottomMarginPx, freeSpace); // Note that taskbarSize = 0 unless isTaskbarPresent. return Math.min(qsbBottomMarginPx + taskbarSize, freeSpace); } else { return (int) (freeSpace * QSB_CENTER_FACTOR) + (isTaskbarPresent ? taskbarSize : mInsets.bottom); Loading Loading @@ -1116,10 +1106,7 @@ public class DeviceProfile { writer.println(prefix + "\tisTaskbarPresent:" + isTaskbarPresent); writer.println(prefix + "\tisTaskbarPresentInApps:" + isTaskbarPresentInApps); writer.println(prefix + pxToDpStr("taskbarSize", taskbarSize)); writer.println(prefix + pxToDpStr("nonOverlappingTaskbarInset", nonOverlappingTaskbarInset)); writer.println(prefix + pxToDpStr("workspacePadding.left", workspacePadding.left)); writer.println(prefix + pxToDpStr("workspacePadding.top", workspacePadding.top)); Loading
src/com/android/launcher3/LauncherRootView.java +3 −16 Original line number Diff line number Diff line Loading @@ -47,15 +47,8 @@ public class LauncherRootView extends InsettableFrameLayout { } private void handleSystemWindowInsets(Rect 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); mActivity.getDeviceProfile().updateInsets(insets); boolean resetState = !insets.equals(mInsets); setInsets(insets); Loading Loading @@ -86,10 +79,6 @@ public class LauncherRootView extends InsettableFrameLayout { * get its insets, we calculate them ourselves so they are stable regardless of whether taskbar * is currently attached. * * TODO(b/198798034): Currently we always calculate nav insets as taskbarSize, but then we * subtract nonOverlappingTaskbarInset in handleSystemWindowInsets(). Instead, we should just * calculate the normal nav bar height here, and remove nonOverlappingTaskbarInset altogether. * * @param oldInsets The system-provided insets, which we are modifying. * @return The updated insets. */ Loading @@ -108,10 +97,8 @@ public class LauncherRootView extends InsettableFrameLayout { Insets oldNavInsets = oldInsets.getInsets(WindowInsets.Type.navigationBars()); Rect newNavInsets = new Rect(oldNavInsets.left, oldNavInsets.top, oldNavInsets.right, oldNavInsets.bottom); if (dp.isTaskbarPresent) { // TODO (see javadoc): Remove this block and fall into the next one instead. newNavInsets.bottom = dp.taskbarSize; } else if (dp.isLandscape) { if (dp.isLandscape) { if (dp.isTablet) { newNavInsets.bottom = ResourceUtils.getNavbarSize( "navigation_bar_height_landscape", resources); Loading
src/com/android/launcher3/Workspace.java +0 −2 Original line number Diff line number Diff line Loading @@ -314,8 +314,6 @@ public class Workspace extends PagedView<WorkspacePageIndicator> 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. Loading
src/com/android/launcher3/pageindicators/WorkspacePageIndicator.java +1 −3 Original line number Diff line number Diff line Loading @@ -268,9 +268,7 @@ public class WorkspacePageIndicator extends View implements Insettable, PageIndi } else { lp.leftMargin = lp.rightMargin = 0; lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM; lp.bottomMargin = grid.isTaskbarPresent ? grid.workspacePadding.bottom + grid.taskbarSize : grid.hotseatBarSizePx + insets.bottom; lp.bottomMargin = grid.hotseatBarSizePx + insets.bottom; } setLayoutParams(lp); } Loading
src/com/android/launcher3/states/SpringLoadedState.java +1 −2 Original line number Diff line number Diff line Loading @@ -59,11 +59,10 @@ public class SpringLoadedState extends LauncherState { float scale = grid.workspaceSpringLoadShrinkFactor; Rect insets = launcher.getDragLayer().getInsets(); int insetsBottom = grid.isTaskbarPresent ? grid.taskbarSize : insets.bottom; float scaledHeight = scale * ws.getNormalChildHeight(); float shrunkTop = insets.top + grid.dropTargetBarSizePx; float shrunkBottom = ws.getMeasuredHeight() - insetsBottom float shrunkBottom = ws.getMeasuredHeight() - insets.bottom - grid.workspacePadding.bottom - grid.workspaceSpringLoadedBottomSpace; float totalShrunkSpace = shrunkBottom - shrunkTop; Loading