From f65c5d1c020234a49f13033bacd5bb60a4f86cf7 Mon Sep 17 00:00:00 2001 From: Daniel Chapin Date: Tue, 4 Mar 2025 07:06:52 -0800 Subject: [PATCH] Revert "Not refresh predicted app in right click" This reverts commit b17cde5c3a3b5112c90272fff79640025a116277. Reason for revert: bug: b/400596380 Change-Id: I8f4d6755653d59ec6264bf93a2835c60122640be --- .../launcher3/dragndrop/DragController.java | 8 +++- .../dragndrop/LauncherDragController.java | 41 +------------------ 2 files changed, 7 insertions(+), 42 deletions(-) diff --git a/src/com/android/launcher3/dragndrop/DragController.java b/src/com/android/launcher3/dragndrop/DragController.java index d329a68a1a..c50c008f30 100644 --- a/src/com/android/launcher3/dragndrop/DragController.java +++ b/src/com/android/launcher3/dragndrop/DragController.java @@ -521,13 +521,17 @@ public abstract class DragController mDragObject.dragComplete = true; if (mIsInPreDrag) { - mDragObject.cancelled = true; + if (dropTarget != null) { + dropTarget.onDragExit(mDragObject); + } + return; } + // Drop onto the target. boolean accepted = false; if (dropTarget != null) { dropTarget.onDragExit(mDragObject); - if (!mIsInPreDrag && dropTarget.acceptDrop(mDragObject)) { + if (dropTarget.acceptDrop(mDragObject)) { if (flingAnimation != null) { flingAnimation.run(); } else { diff --git a/src/com/android/launcher3/dragndrop/LauncherDragController.java b/src/com/android/launcher3/dragndrop/LauncherDragController.java index e3b8965884..4aa3673586 100644 --- a/src/com/android/launcher3/dragndrop/LauncherDragController.java +++ b/src/com/android/launcher3/dragndrop/LauncherDragController.java @@ -15,8 +15,6 @@ */ package com.android.launcher3.dragndrop; -import static android.view.View.VISIBLE; - import static com.android.launcher3.AbstractFloatingView.TYPE_DISCOVERY_BOUNCE; import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY; import static com.android.launcher3.LauncherState.EDIT_MODE; @@ -27,7 +25,6 @@ import android.content.res.Resources; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.view.HapticFeedbackConstants; -import android.view.MotionEvent; import android.view.View; import androidx.annotation.Nullable; @@ -36,13 +33,10 @@ import androidx.annotation.VisibleForTesting; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.DragSource; import com.android.launcher3.DropTarget; -import com.android.launcher3.DropTarget.DragObject; import com.android.launcher3.Launcher; import com.android.launcher3.R; import com.android.launcher3.accessibility.DragViewStateAnnouncer; -import com.android.launcher3.dragndrop.DragOptions.PreDragCondition; import com.android.launcher3.model.data.ItemInfo; -import com.android.launcher3.util.TouchUtil; import com.android.launcher3.widget.util.WidgetDragScaleUtils; /** @@ -53,9 +47,6 @@ public class LauncherDragController extends DragController { private static final boolean PROFILE_DRAWING_DURING_DRAG = false; private final FlingToDeleteHelper mFlingToDeleteHelper; - /** Whether or not the drag operation is triggered by mouse right click. */ - private boolean mIsInMouseRightClick = false; - public LauncherDragController(Launcher launcher) { super(launcher); mFlingToDeleteHelper = new FlingToDeleteHelper(launcher); @@ -78,27 +69,6 @@ public class LauncherDragController extends DragController { android.os.Debug.startMethodTracing("Launcher"); } - if (mIsInMouseRightClick && options.preDragCondition == null - && originalView instanceof View v) { - options.preDragCondition = new PreDragCondition() { - - @Override - public boolean shouldStartDrag(double distanceDragged) { - return false; - } - - @Override - public void onPreDragStart(DragObject dragObject) { - // Set it to visible so the text of FolderIcon would not flash (avoid it from - // being invisible and then visible) - v.setVisibility(VISIBLE); - } - - @Override - public void onPreDragEnd(DragObject dragObject, boolean dragStarted) { } - }; - } - mActivity.hideKeyboard(); AbstractFloatingView.closeOpenViews(mActivity, false, TYPE_DISCOVERY_BOUNCE); @@ -221,7 +191,7 @@ public class LauncherDragController extends DragController { @Override protected void exitDrag() { - if (!mIsInPreDrag && !mActivity.isInState(EDIT_MODE)) { + if (!mActivity.isInState(EDIT_MODE)) { mActivity.getStateManager().goToState(NORMAL, SPRING_LOADED_EXIT_DELAY); } } @@ -248,13 +218,4 @@ public class LauncherDragController extends DragController { dropCoordinates); return mActivity.getWorkspace(); } - - /** - * Intercepts touch events from a drag source view. - */ - @Override - public boolean onControllerInterceptTouchEvent(MotionEvent ev) { - mIsInMouseRightClick = TouchUtil.isMouseRightClickDownOrMove(ev); - return super.onControllerInterceptTouchEvent(ev); - } }