Snap for 12243189 from cafe06f63d to 24Q4-release

Change-Id: I523112a0c4f65a4df456950362ad03742c573040
This commit is contained in:
Android Build Coastguard Worker
2024-08-17 21:21:02 +00:00
6 changed files with 57 additions and 31 deletions
@@ -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.
@@ -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)
@@ -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);
});
@@ -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<T extends RecentsViewContainer,
mGestureState.runOnceAtState(STATE_END_TARGET_ANIMATION_FINISHED
| STATE_RECENTS_SCROLLING_FINISHED,
this::onSettledOnEndTarget);
mGestureState.runOnceAtState(STATE_END_TARGET_SET | STATE_RECENTS_ANIMATION_STARTED,
this::onCalculateEndTarget);
mStateCallback.runOnceAtState(STATE_HANDLER_INVALIDATED, this::invalidateHandler);
mStateCallback.runOnceAtState(STATE_LAUNCHER_PRESENT | STATE_HANDLER_INVALIDATED,
@@ -1152,6 +1155,22 @@ public abstract class AbsSwipeUpHandler<T extends RecentsViewContainer,
}
}
/**
* Called if the end target has been set and the recents animation is started.
*/
private void onCalculateEndTarget() {
final GestureEndTarget endTarget = mGestureState.getEndTarget();
switch (endTarget) {
case HOME:
// Early detach the nav bar if endTarget is determined as HOME
if (mRecentsAnimationController != null) {
mRecentsAnimationController.detachNavigationBarFromApp(true);
}
break;
}
}
private void onSettledOnEndTarget() {
// Fast-finish the attaching animation if it's still running.
maybeUpdateRecentsAttachedState(false);
@@ -1406,10 +1425,6 @@ public abstract class AbsSwipeUpHandler<T extends RecentsViewContainer,
duration = mContainer != null && mContainer.getDeviceProfile().isTaskbarPresent
? StaggeredWorkspaceAnim.DURATION_TASKBAR_MS
: StaggeredWorkspaceAnim.DURATION_MS;
// Early detach the nav bar once the endTarget is determined as HOME
if (mRecentsAnimationController != null) {
mRecentsAnimationController.detachNavigationBarFromApp(true);
}
ContextualEduStatsManager.INSTANCE.get(mContext).updateEduStats(
mGestureState.isTrackpadGesture(), GestureType.HOME);
} else if (endTarget == RECENTS) {
@@ -15,18 +15,15 @@
*/
package com.android.quickstep;
import static com.android.quickstep.TaskbarModeSwitchRule.Mode.PERSISTENT;
import android.graphics.Rect;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch;
import com.android.quickstep.TaskbarModeSwitchRule.TaskbarModeSwitch;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,9 +31,9 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
public class TaplTestsPersistentTaskbar extends AbstractTaplTestsTaskbar {
//TODO(b/359277238): fix falling tests
@Ignore
@Test
@TaskbarModeSwitch(mode = PERSISTENT)
@PortraitLandscape
@NavigationModeSwitch
public void testTaskbarFillsWidth() {
// Width check is performed inside TAPL whenever getTaskbar() is called.
@@ -521,6 +521,8 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
isInState(() -> LauncherState.NORMAL));
}
//TODO(b/359277238): fix falling tests
@Ignore
@Test
@PortraitLandscape
@TaskbarModeSwitch