diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index 8df2eb8a4c..60fb094dbf 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -138,6 +138,11 @@ public class LauncherTaskbarUIController extends TaskbarUIController { mHomeState.removeListener(mVisibilityChangeListener); } + /** Returns {@code true} if launcher is currently presenting the home screen. */ + public boolean isOnHome() { + return mTaskbarLauncherStateController.isOnHome(); + } + private void onInAppDisplayProgressChanged() { if (mControllers != null) { // Update our shared state so we can restore it if taskbar gets recreated. diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt index 9dee47345a..ff1ea98f1b 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt @@ -136,14 +136,8 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas val taskbarTouchableHeight = controllers.taskbarStashController.touchableHeight val bubblesTouchableHeight = bubbleControllers?.bubbleStashController?.getTouchableHeight() ?: 0 - // add bounds for task bar and bubble bar stash controllers - val touchableHeight = max(taskbarTouchableHeight, bubblesTouchableHeight) - defaultTouchableRegion.set( - 0, - windowLayoutParams.height - touchableHeight, - context.deviceProfile.widthPx, - windowLayoutParams.height - ) + // reset touch bounds + defaultTouchableRegion.setEmpty() if (bubbleControllers != null) { val bubbleBarViewController = bubbleControllers.bubbleBarViewController val isBubbleBarVisible = bubbleControllers.bubbleStashController.isBubbleBarVisible() @@ -153,6 +147,15 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas defaultTouchableRegion.addBoundsToRegion(bubbleBarViewController.bubbleBarBounds) } } + val taskbarUIController = controllers.uiController as? LauncherTaskbarUIController + if (taskbarUIController?.isOnHome != true) { + // only add the bars touch region if not on home + val touchableHeight = max(taskbarTouchableHeight, bubblesTouchableHeight) + val bottom = windowLayoutParams.height + val top = bottom - touchableHeight + val right = context.deviceProfile.widthPx + defaultTouchableRegion.addBoundsToRegion(Rect(/* left= */ 0, top, right, bottom)) + } // Pre-calculate insets for different providers across different rotations for this gravity for (rotation in Surface.ROTATION_0..Surface.ROTATION_270) { @@ -221,20 +224,20 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas provider.insetsSize = getInsetsForGravityWithCutout(contentHeight, gravity, endRotation) } else if (provider.type == mandatorySystemGestures()) { if (context.isThreeButtonNav) { - provider.insetsSize = getInsetsForGravityWithCutout(contentHeight, gravity, - endRotation) + provider.insetsSize = + getInsetsForGravityWithCutout(contentHeight, gravity, endRotation) } else { val gestureHeight = - ResourceUtils.getNavbarSize( + ResourceUtils.getNavbarSize( ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE, - context.resources) - val isPinnedTaskbar = context.deviceProfile.isTaskbarPresent - && !context.deviceProfile.isTransientTaskbar - val mandatoryGestureHeight = - if (isPinnedTaskbar) contentHeight - else gestureHeight - provider.insetsSize = getInsetsForGravityWithCutout(mandatoryGestureHeight, gravity, - endRotation) + context.resources + ) + val isPinnedTaskbar = + context.deviceProfile.isTaskbarPresent && + !context.deviceProfile.isTransientTaskbar + val mandatoryGestureHeight = if (isPinnedTaskbar) contentHeight else gestureHeight + provider.insetsSize = + getInsetsForGravityWithCutout(mandatoryGestureHeight, gravity, endRotation) } } else if (provider.type == tappableElement()) { provider.insetsSize = getInsetsForGravity(tappableHeight, gravity) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index e6b3acdced..5c3add29a0 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -433,6 +433,11 @@ public class TaskbarLauncherStateController { return animator; } + /** Returns {@code true} if launcher is currently presenting the home screen. */ + public boolean isOnHome() { + return isInLauncher() && mLauncherState == LauncherState.NORMAL; + } + private Animator onStateChangeApplied(int changedFlags, long duration, boolean start) { final boolean isInLauncher = isInLauncher(); final boolean isIconAlignedWithHotseat = isIconAlignedWithHotseat(); @@ -445,9 +450,8 @@ public class TaskbarLauncherStateController { } mControllers.bubbleControllers.ifPresent(controllers -> { // Show the bubble bar when on launcher home or in overview. - boolean onHome = isInLauncher && mLauncherState == LauncherState.NORMAL; boolean onOverview = mLauncherState == LauncherState.OVERVIEW; - controllers.bubbleStashController.setBubblesShowingOnHome(onHome); + controllers.bubbleStashController.setBubblesShowingOnHome(isOnHome()); controllers.bubbleStashController.setBubblesShowingOnOverview(onOverview); }); diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 6109fd81b2..5392b70703 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -53,6 +53,7 @@ import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS; import static com.android.quickstep.GestureState.STATE_END_TARGET_ANIMATION_FINISHED; import static com.android.quickstep.GestureState.STATE_END_TARGET_SET; import static com.android.quickstep.GestureState.STATE_RECENTS_ANIMATION_CANCELED; +import static com.android.quickstep.GestureState.STATE_RECENTS_ANIMATION_STARTED; import static com.android.quickstep.GestureState.STATE_RECENTS_SCROLLING_FINISHED; import static com.android.quickstep.MultiStateCallback.DEBUG_STATES; import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.CANCEL_RECENTS_ANIMATION; @@ -468,6 +469,8 @@ public abstract class AbsSwipeUpHandler LauncherState.NORMAL)); } + //TODO(b/359277238): fix falling tests + @Ignore @Test @PortraitLandscape @TaskbarModeSwitch