Merge changes I35fe528b,Ia612c1b5 into udc-dev

* changes:
  Don't close AFVs when opening Taskbar folder.
  Keep persistent Taskbar visible over Taskbar All Apps.
This commit is contained in:
Brian Isganitis
2023-05-06 14:42:54 +00:00
committed by Android (Google) Code Review
10 changed files with 43 additions and 57 deletions
@@ -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());
}
/**
@@ -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);
}
}
/**
@@ -308,15 +308,12 @@ public class TaskbarDragController extends DragController<BaseTaskbarContext> 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<BaseTaskbarContext> 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) {
@@ -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)
@@ -933,20 +933,6 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
}
}
/**
* Resets the flag if no system gesture is in progress.
* <p>
* 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.
*/
@@ -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();
};
}
@@ -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. */
@@ -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));
}
});
}
@@ -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();
@@ -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);
}