Merge changes I6fe1139e,I581dddf2 into main

* changes:
  Handle new bubble notification while drag is in progress.
  Made the bubble bar react to drag events from the Shell.
This commit is contained in:
Mykola Podolian
2025-02-18 14:03:17 -08:00
committed by Android (Google) Code Review
7 changed files with 226 additions and 24 deletions
@@ -52,6 +52,7 @@ import android.view.ViewRootImpl;
import android.window.SurfaceSyncGroup;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.android.app.animation.Interpolators;
import com.android.internal.logging.InstanceId;
@@ -75,6 +76,7 @@ import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.popup.PopupContainerWithArrow;
import com.android.launcher3.shortcuts.DeepShortcutView;
import com.android.launcher3.shortcuts.ShortcutDragPreviewProvider;
import com.android.launcher3.taskbar.bubbles.BubbleBarViewController;
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.util.DisplayController;
@@ -517,6 +519,7 @@ public class TaskbarDragController extends DragController<BaseTaskbarContext> im
return mIsSystemDragInProgress;
}
@VisibleForTesting
private void maybeOnDragEnd() {
if (!isDragging()) {
((BubbleTextView) mDragObject.originalView).setIconDisabled(false);
@@ -524,17 +527,38 @@ public class TaskbarDragController extends DragController<BaseTaskbarContext> im
TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_DRAGGING, false);
mActivity.onDragEnd();
if (mReturnAnimator == null) {
// If an item is dropped on the bubble bar, the bubble bar handles the drop,
// so it should not collapse along with the taskbar.
boolean droppedOnBubbleBar = notifyBubbleBarItemDropped();
// Upon successful drag, immediately stash taskbar.
// Note, this must be done last to ensure no AutohideSuspendFlags are active, as
// that will prevent us from stashing until the timeout.
mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true);
mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(
/* stash = */ true,
/* shouldBubblesFollow = */ !droppedOnBubbleBar
);
mActivity.getStatsLogManager().logger().withItemInfo(mDragObject.dragInfo)
.log(LAUNCHER_APP_LAUNCH_DRAGDROP);
}
}
}
/**
* Exits the Bubble Bar drop target mode if applicable.
*
* @return {@code true} if drop target mode was active.
*/
private boolean notifyBubbleBarItemDropped() {
return mControllers.bubbleControllers.map(bc -> {
BubbleBarViewController bubbleBarViewController = bc.bubbleBarViewController;
boolean showingDropTarget = bubbleBarViewController.isShowingDropTarget();
if (showingDropTarget) {
bubbleBarViewController.onItemDroppedInBubbleBarDragZone();
}
return showingDropTarget;
}).orElse(false);
}
@Override
protected void endDrag() {
if (mDisallowGlobalDrag) {