Updates layout when overflow button and alt-tab are both triggered.

Before this cl, the KQS view is closed and reopened when the
overflow button and alt-tab key are triggered one after the other.
This cl changes the behavior so that instead of reopening, the
list of task is updated and the KQS container layout is toggled
between "wrap content" and "match parent".

Bug: 368119679
Test: open KQS via taskbar and observe the layout change
Flag: com.android.launcher3.taskbar_overflow
Change-Id: I05ea4c66727daa206ff1d7906500dc8f9cc81982
This commit is contained in:
Wen-Chien Wang
2024-11-05 00:52:22 +00:00
parent 2e8707dffb
commit ca95004403
4 changed files with 87 additions and 18 deletions
@@ -128,6 +128,23 @@ public class KeyboardQuickSwitchViewController {
/* useDesktopTaskView= */ !onDesktop && hasDesktopTask);
}
protected void updateQuickSwitchView(
@NonNull List<GroupTask> tasks,
int numHiddenTasks,
int currentFocusIndexOverride,
boolean hasDesktopTask,
boolean wasDesktopTaskFilteredOut) {
mWasDesktopTaskFilteredOut = wasDesktopTaskFilteredOut;
mKeyboardQuickSwitchView.applyLoadPlan(
mOverlayContext,
tasks,
numHiddenTasks,
/* updateTasks= */ true,
currentFocusIndexOverride,
mViewCallbacks,
/* useDesktopTaskView= */ !mOnDesktop && hasDesktopTask);
}
protected void positionView(boolean wasOpenedFromTaskbar, boolean isTransientTaskbar) {
if (!wasOpenedFromTaskbar) {
// Keep the default positioning.
@@ -155,6 +172,20 @@ public class KeyboardQuickSwitchViewController {
mKeyboardQuickSwitchView.setLayoutParams(lp);
}
protected void updateLayoutForSurface(boolean updateLayoutFromTaskbar,
int currentFocusIndexOverride) {
BaseDragLayer.LayoutParams lp =
(BaseDragLayer.LayoutParams) mKeyboardQuickSwitchView.getLayoutParams();
if (updateLayoutFromTaskbar) {
lp.width = BaseDragLayer.LayoutParams.WRAP_CONTENT;
} else {
lp.width = BaseDragLayer.LayoutParams.MATCH_PARENT;
}
mKeyboardQuickSwitchView.animateOpen(currentFocusIndexOverride);
}
boolean isCloseAnimationRunning() {
return mCloseAnimation != null;
}