Merge "Fixed issue when hotseat icons are not touchable" into main

This commit is contained in:
Mykola Podolian
2024-08-16 22:26:56 +00:00
committed by Android (Google) Code Review
5 changed files with 38 additions and 27 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);
});
@@ -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