diff --git a/quickstep/src/com/android/launcher3/taskbar/DesktopNavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/DesktopNavbarButtonsViewController.java index 268024fd3d..885afffcbb 100644 --- a/quickstep/src/com/android/launcher3/taskbar/DesktopNavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/DesktopNavbarButtonsViewController.java @@ -47,9 +47,7 @@ public class DesktopNavbarButtonsViewController extends NavbarButtonsViewControl mStartContextualContainer = mNavButtonsView.findViewById(R.id.start_contextual_buttons); mAllAppsButton = LayoutInflater.from(context) .inflate(R.layout.taskbar_all_apps_button, mStartContextualContainer, false); - mAllAppsButton.setOnClickListener((View v) -> { - mControllers.taskbarAllAppsController.show(); - }); + mAllAppsButton.setOnClickListener(v -> mControllers.taskbarAllAppsController.toggle()); } /** diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 37f62841bf..6f40174e04 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -24,6 +24,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL; import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE; +import static com.android.launcher3.AbstractFloatingView.TYPE_TASKBAR_OVERLAY_PROXY; import static com.android.launcher3.Utilities.isRunningInTestHarness; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_OPEN; import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_DRAGGING; @@ -661,7 +662,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext { void onDragEndOrViewRemoved() { boolean isDragInProgress = mControllers.taskbarDragController.isSystemDragInProgress(); - if (!isDragInProgress && !AbstractFloatingView.hasOpenView(this, TYPE_ALL)) { + // Overlay AFVs are in a separate window and do not require Taskbar to be fullscreen. + if (!isDragInProgress + && !AbstractFloatingView.hasOpenView( + this, TYPE_ALL & ~TYPE_TASKBAR_OVERLAY_PROXY)) { // Reverts Taskbar window to its original size setTaskbarWindowFullscreen(false); } @@ -773,6 +777,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { } protected void onTaskbarIconClicked(View view) { + boolean shouldCloseAllOpenViews = true; Object tag = view.getTag(); if (tag instanceof Task) { Task task = (Task) tag; @@ -780,6 +785,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { ActivityOptions.makeBasic()); mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true); } else if (tag instanceof FolderInfo) { + shouldCloseAllOpenViews = false; FolderIcon folderIcon = (FolderIcon) view; Folder folder = folderIcon.getFolder(); @@ -876,7 +882,9 @@ public class TaskbarActivityContext extends BaseTaskbarContext { Log.e(TAG, "Unknown type clicked: " + tag); } - AbstractFloatingView.closeAllOpenViews(this); + if (shouldCloseAllOpenViews) { + AbstractFloatingView.closeAllOpenViews(this); + } } /** diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java index 41093bd039..72add4fc77 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java @@ -308,15 +308,12 @@ public class TaskbarDragController extends DragController im // Pre-drag has ended, start the global system drag. if (mDisallowGlobalDrag) { AbstractFloatingView.closeAllOpenViewsExcept(mActivity, TYPE_TASKBAR_ALL_APPS); - } else { - AbstractFloatingView.closeAllOpenViews(mActivity); + return; } - startSystemDrag((BubbleTextView) mDragObject.originalView); } private void startSystemDrag(BubbleTextView btv) { - if (mDisallowGlobalDrag) return; View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(btv) { @Override @@ -412,6 +409,9 @@ public class TaskbarDragController extends DragController im .log(StatsLogManager.LauncherEvent.LAUNCHER_ITEM_DRAG_STARTED); } } + + // Wait to close until after system drag has started, if applicable. + AbstractFloatingView.closeAllOpenViews(mActivity); } private void onSystemDragStarted(BubbleTextView btv) { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt index 19b9a1868e..4422fd4b75 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt @@ -34,8 +34,6 @@ import android.view.WindowManager import android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD import android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION import com.android.internal.policy.GestureNavigationSettingsObserver -import com.android.launcher3.AbstractFloatingView -import com.android.launcher3.AbstractFloatingView.TYPE_TASKBAR_OVERLAY_PROXY import com.android.launcher3.DeviceProfile import com.android.launcher3.R import com.android.launcher3.anim.AlphaUpdateListener @@ -190,7 +188,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas /** * Called to update the touchable insets. * - * @see InternalInsetsInfo.setTouchableInsets + * @see ViewTreeObserver.InternalInsetsInfo.setTouchableInsets */ fun updateInsetsTouchability(insetsInfo: ViewTreeObserver.InternalInsetsInfo) { insetsInfo.touchableRegion.setEmpty() @@ -205,7 +203,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) } else if ( controllers.navbarButtonsViewController.isImeVisible && - controllers.taskbarStashController.isStashed() + controllers.taskbarStashController.isStashed ) { insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) } else if (!controllers.uiController.isTaskbarTouchable) { @@ -214,26 +212,16 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas } else if (controllers.taskbarDragController.isSystemDragInProgress) { // Let touches pass through us. insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) - } else if (AbstractFloatingView.hasOpenView(context, TYPE_TASKBAR_OVERLAY_PROXY)) { - // Let touches pass through us if icons are hidden. - if (controllers.taskbarViewController.areIconsVisible()) { - insetsInfo.touchableRegion.set(touchableRegion) - } - insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) + } else if (context.isTaskbarWindowFullscreen) { + // Intercept entire fullscreen window. + insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_FRAME) + insetsIsTouchableRegion = false } else if ( - controllers.taskbarViewController.areIconsVisible() || - AbstractFloatingView.hasOpenView(context, AbstractFloatingView.TYPE_ALL) || - context.isNavBarKidsModeActive + controllers.taskbarViewController.areIconsVisible() || context.isNavBarKidsModeActive ) { // Taskbar has some touchable elements, take over the full taskbar area - insetsInfo.setTouchableInsets( - if (context.isTaskbarWindowFullscreen) { - TOUCHABLE_INSETS_FRAME - } else { - insetsInfo.touchableRegion.set(touchableRegion) - TOUCHABLE_INSETS_REGION - } - ) + insetsInfo.touchableRegion.set(touchableRegion) + insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) insetsIsTouchableRegion = false } else { insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index 5de5904638..c2175f2444 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -933,20 +933,6 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba } } - /** - * Resets the flag if no system gesture is in progress. - *

- * Otherwise, the reset should be deferred until after the gesture is finished. - * - * @see #setSystemGestureInProgress - */ - public void resetFlagIfNoGestureInProgress(int flag) { - if (!mIsSystemGestureInProgress) { - updateStateForFlag(flag, false); - applyState(mControllers.taskbarOverlayController.getCloseDuration()); - } - } - /** * When hiding the IME, delay the unstash animation to align with the end of the transition. */ diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index a7e2daa7d9..74291857e1 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -639,7 +639,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar public View.OnClickListener getAllAppsButtonClickListener() { return v -> { mActivity.getStatsLogManager().logger().log(LAUNCHER_TASKBAR_ALLAPPS_BUTTON_TAP); - mControllers.taskbarAllAppsController.show(); + mControllers.taskbarAllAppsController.toggle(); }; } diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java index 4266c71d3e..459a658099 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsController.java @@ -100,9 +100,13 @@ public final class TaskbarAllAppsController { } } - /** Opens the {@link TaskbarAllAppsContainerView} in a new window. */ - public void show() { - show(true); + /** Toggles visibility of {@link TaskbarAllAppsContainerView} in the overlay window. */ + public void toggle() { + if (isOpen()) { + mSlideInView.close(true); + } else { + show(true); + } } /** Returns {@code true} if All Apps is open. */ diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java index 7a3b3e8c7b..01342affb6 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsViewController.java @@ -16,7 +16,6 @@ package com.android.launcher3.taskbar.allapps; import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_STASHED_IN_TASKBAR_ALL_APPS; -import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.OnboardingPrefs.ALL_APPS_VISITED_COUNT; import com.android.launcher3.AbstractFloatingView; @@ -88,8 +87,10 @@ final class TaskbarAllAppsViewController { } private void setUpTaskbarStashing() { - mTaskbarStashController.updateStateForFlag(FLAG_STASHED_IN_TASKBAR_ALL_APPS, true); - mTaskbarStashController.applyState(mOverlayController.getOpenDuration()); + if (DisplayController.isTransientTaskbar(mContext)) { + mTaskbarStashController.updateStateForFlag(FLAG_STASHED_IN_TASKBAR_ALL_APPS, true); + mTaskbarStashController.applyState(mOverlayController.getOpenDuration()); + } mNavbarButtonsViewController.setSlideInViewVisible(true); mSlideInView.setOnCloseBeginListener(() -> { @@ -100,11 +101,6 @@ final class TaskbarAllAppsViewController { if (DisplayController.isTransientTaskbar(mContext)) { mTaskbarStashController.updateStateForFlag(FLAG_STASHED_IN_TASKBAR_ALL_APPS, false); mTaskbarStashController.applyState(mOverlayController.getCloseDuration()); - } else { - // Post in case view is closing due to gesture navigation. If a gesture is in - // progress, wait to unstash until after the gesture is finished. - MAIN_EXECUTOR.post(() -> mTaskbarStashController.resetFlagIfNoGestureInProgress( - FLAG_STASHED_IN_TASKBAR_ALL_APPS)); } }); } diff --git a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayContext.java b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayContext.java index 66d591889b..84a5228646 100644 --- a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayContext.java @@ -80,6 +80,12 @@ public class TaskbarOverlayContext extends BaseTaskbarContext { return mOverlayController; } + /** Returns {@code true} if overlay or Taskbar windows are handling a system drag. */ + boolean isAnySystemDragInProgress() { + return mDragController.isSystemDragInProgress() + || mTaskbarContext.getDragController().isSystemDragInProgress(); + } + @Override public DeviceProfile getDeviceProfile() { return mOverlayController.getLauncherDeviceProfile(); diff --git a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayDragLayer.java b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayDragLayer.java index 2c3e1ac28a..b4ec682a51 100644 --- a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayDragLayer.java +++ b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayDragLayer.java @@ -112,7 +112,7 @@ public class TaskbarOverlayDragLayer extends @Override public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo inoutInfo) { - if (mActivity.getDragController().isSystemDragInProgress()) { + if (mActivity.isAnySystemDragInProgress()) { inoutInfo.touchableRegion.setEmpty(); inoutInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION); }