From 164b832ec45017accce6d1b45da8ba087129f4d1 Mon Sep 17 00:00:00 2001 From: Mykola Podolian Date: Mon, 21 Oct 2024 23:29:30 +0000 Subject: [PATCH] Revert "Made the taskbar touchable during animation to home." This reverts commit d89732ef8598108095a29f182fb113bfa5d64bda. Reason for revert: b/374080485 Flag: NONE Change-Id: I56236f539957efaaa4caa30a4b887d017037709f --- .../taskbar/LauncherTaskbarUIController.java | 16 +++---- .../taskbar/TaskbarInsetsController.kt | 45 ++++++------------- .../TaskbarLauncherStateController.java | 24 +--------- .../taskbar/TaskbarUIController.java | 10 +---- .../launcher3/taskbar/TaskbarView.java | 1 + 5 files changed, 23 insertions(+), 73 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index 0b850bdee8..042bc9a8ab 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -154,6 +154,12 @@ public class LauncherTaskbarUIController extends TaskbarUIController { } } + @Override + protected boolean isTaskbarTouchable() { + return !(mTaskbarLauncherStateController.isAnimatingToLauncher() + && mTaskbarLauncherStateController.isTaskbarAlignedWithHotseat()); + } + public void setShouldDelayLauncherStateAnim(boolean shouldDelayLauncherStateAnim) { mTaskbarLauncherStateController.setShouldDelayLauncherStateAnim( shouldDelayLauncherStateAnim); @@ -446,16 +452,6 @@ public class LauncherTaskbarUIController extends TaskbarUIController { .getValue() == 0; } - @Override - public boolean isHotseatVisibleForTaskBarAlignment() { - return mTaskbarLauncherStateController.isHotseatVisibleForTaskbarAlignment(); - } - - @Override - public boolean isAnimatingToLauncher() { - return mTaskbarLauncherStateController.isAnimatingToLauncher(); - } - @Override protected boolean isInOverviewUi() { return mTaskbarLauncherStateController.isInOverviewUi(); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt index 55722a9b62..058dd07430 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt @@ -47,7 +47,6 @@ import androidx.core.graphics.toRegion import com.android.internal.policy.GestureNavigationSettingsObserver import com.android.launcher3.DeviceProfile import com.android.launcher3.R -import com.android.launcher3.Utilities import com.android.launcher3.anim.AlphaUpdateListener import com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION import com.android.launcher3.config.FeatureFlags.enableTaskbarNoRecreate @@ -134,6 +133,9 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas } val bubbleControllers = controllers.bubbleControllers.getOrNull() + val taskbarTouchableHeight = taskbarStashController.touchableHeight + val bubblesTouchableHeight = + bubbleControllers?.bubbleStashController?.getTouchableHeight() ?: 0 // reset touch bounds defaultTouchableRegion.setEmpty() if (bubbleControllers != null) { @@ -145,41 +147,16 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas defaultTouchableRegion.addBoundsToRegion(bubbleBarViewController.bubbleBarBounds) } } - val uiController = controllers.uiController if ( - !uiController.isHotseatVisibleForTaskBarAlignment || + taskbarStashController.isInApp || + taskbarStashController.isInOverview || DisplayController.showLockedTaskbarOnHome(context) ) { - // adding the taskbar touch region - var left = 0 - var right = context.deviceProfile.widthPx - val touchableHeight: Int - if (uiController.isAnimatingToLauncher) { - val dp = controllers.taskbarActivityContext.deviceProfile - touchableHeight = windowLayoutParams.height - if (dp.isQsbInline) { - // if Qsb is inline need to exclude search icon from touch region - val isRtl = Utilities.isRtl(context.resources) - val navBarOffset = - bubbleControllers?.bubbleBarViewController?.let { - val isBubblesOnLeft = it.bubbleBarLocation.isOnLeft(isRtl) - dp.getHotseatTranslationXForNavBar(context, isBubblesOnLeft) - } ?: 0 - val hotseatPadding: Rect = dp.getHotseatLayoutPadding(context) - val borderSpacing: Int = dp.hotseatBorderSpace - if (isRtl) { - right = dp.widthPx - hotseatPadding.right + borderSpacing + navBarOffset - } else { - left = hotseatPadding.left - borderSpacing + navBarOffset - } - } - } else { - // if not animating to launcher use the taskbar touchanle height - touchableHeight = taskbarStashController.touchableHeight - } + // only add the taskbar touch region if not on home val bottom = windowLayoutParams.height - val top = bottom - touchableHeight - defaultTouchableRegion.addBoundsToRegion(Rect(left, top, right, bottom)) + val top = bottom - taskbarTouchableHeight + 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 @@ -391,6 +368,10 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas // Let touches pass through us. insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) debugTouchableRegion.lastSetTouchableReason = "Stashed over IME" + } else if (!controllers.uiController.isTaskbarTouchable) { + // Let touches pass through us. + insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) + debugTouchableRegion.lastSetTouchableReason = "Taskbar is not touchable" } else if (controllers.taskbarDragController.isSystemDragInProgress) { // Let touches pass through us. insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index 4bc7d3c329..fa0473910b 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -190,8 +190,6 @@ public class TaskbarLauncherStateController { private boolean mIsQsbInline; - private boolean mIsHotseatVisibleForTaskbarAlignment; - private final DeviceProfile.OnDeviceProfileChangeListener mOnDeviceProfileChangeListener = new DeviceProfile.OnDeviceProfileChangeListener() { @Override @@ -733,7 +731,6 @@ public class TaskbarLauncherStateController { boolean committed) { boolean isInStashedState = mLauncherState.isTaskbarStashed(mLauncher); TaskbarStashController stashController = mControllers.taskbarStashController; - TaskbarInsetsController insetsController = mControllers.taskbarInsetsController; stashController.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE, isInStashedState); Animator stashAnimator = stashController.createApplyStateAnimator(duration); if (stashAnimator != null) { @@ -742,11 +739,7 @@ public class TaskbarLauncherStateController { public void onAnimationEnd(Animator animation) { if (isInStashedState && committed) { // Reset hotseat alpha to default - updateIconAlphaForHome( - /* taskbarAlpha = */ 0, - ALPHA_CHANNEL_TASKBAR_ALIGNMENT, - /* updateTaskbarAlpha = */ false - ); + mLauncher.getHotseat().setIconsAlpha(1, ALPHA_CHANNEL_TASKBAR_ALIGNMENT); } } @@ -871,14 +864,6 @@ public class TaskbarLauncherStateController { if (mIsQsbInline) { mLauncher.getHotseat().setQsbAlpha(targetAlpha, alphaChannel); } - if (alphaChannel == ALPHA_CHANNEL_TASKBAR_ALIGNMENT) { - boolean isHotseatVisibleForTaskbarAlignment = isHotseatVisibleForTaskbarAlignment(); - if (mIsHotseatVisibleForTaskbarAlignment != isHotseatVisibleForTaskbarAlignment) { - mIsHotseatVisibleForTaskbarAlignment = isHotseatVisibleForTaskbarAlignment; - mControllers.taskbarInsetsController - .onTaskbarOrBubblebarWindowHeightOrInsetsChanged(); - } - } } /** Updates launcher home screen appearance accordingly to the bubble bar location. */ @@ -939,13 +924,6 @@ public class TaskbarLauncherStateController { translationXAnimation.start(); } - /** Returns true if hotseat icons visible for the taskbar alignment */ - public boolean isHotseatVisibleForTaskbarAlignment() { - return mLauncher.getHotseat() - .getIconsAlpha(ALPHA_CHANNEL_TASKBAR_ALIGNMENT).getValue() == 1; - } - - private final class TaskBarRecentsAnimationListener implements RecentsAnimationCallbacks.RecentsAnimationListener { private final RecentsAnimationCallbacks mCallbacks; diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java index db69e8f1fe..7030088287 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java @@ -75,14 +75,8 @@ public class TaskbarUIController implements BubbleBarController.BubbleBarLocatio mControllers = null; } - /** Returns true if transition animation to launcher home is being played. */ - public boolean isAnimatingToLauncher() { - return false; - } - - /** Returns true if hotseat icons visible for the taskbar alignment. */ - public boolean isHotseatVisibleForTaskBarAlignment() { - return false; + protected boolean isTaskbarTouchable() { + return true; } /** diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index c0891a972d..fcb583ab4c 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -185,6 +185,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar resources.getDrawable(R.drawable.taskbar_overflow_icon)); mTaskbarOverflowView.setPadding(mItemPadding, mItemPadding, mItemPadding, mItemPadding); } + // TODO: Disable touch events on QSB otherwise it can crash. mQsb = LayoutInflater.from(context).inflate(R.layout.search_container_hotseat, this, false); mMaxNumIcons = calculateMaxNumIcons();