Fix a couple issues related to drag and drop in Touch Exploration mode
=> The framework no longer sends touch events after double-click and hold, and instead only triggers a single long-press event
=> As a result of the above, there is some additional state that must be set for accessible drag and drop, and further, we no longer initiate a drag in response to long press when Touch Exploration is on.
Test: manual
issue b/148308758
Change-Id: I26ab90b807965f31c8de93d451130410169f2fb0
diff --git a/src/com/android/launcher3/LauncherRootView.java b/src/com/android/launcher3/LauncherRootView.java
index ce1795a..2b2224a 100644
--- a/src/com/android/launcher3/LauncherRootView.java
+++ b/src/com/android/launcher3/LauncherRootView.java
@@ -8,7 +8,6 @@
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
-import android.graphics.Insets;
import android.graphics.Paint;
import android.graphics.Rect;
import android.os.Build;
diff --git a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
index a7ef9ef..ed869bb 100644
--- a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
+++ b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
@@ -166,13 +166,22 @@
}
public boolean performAction(final View host, final ItemInfo item, int action) {
- if (action == ACTION_LONG_CLICK && ShortcutUtil.isDeepShortcut(item)) {
- CustomActionsPopup popup = new CustomActionsPopup(mLauncher, host);
- if (popup.canShow()) {
- popup.show();
+ if (action == ACTION_LONG_CLICK) {
+ if (ShortcutUtil.isDeepShortcut(item)) {
+ CustomActionsPopup popup = new CustomActionsPopup(mLauncher, host);
+ if (popup.canShow()) {
+ popup.show();
+ return true;
+ }
+ } else if (host instanceof BubbleTextView) {
+ // Long press should be consumed for workspace items, and it should invoke the
+ // Shortcuts / Notifications / Actions pop-up menu, and not start a drag as the
+ // standard long press path does.
+ PopupContainerWithArrow.showForIcon((BubbleTextView) host);
return true;
}
}
+
if (action == MOVE) {
beginAccessibleDrag(host, item);
} else if (action == ADD_TO_WORKSPACE) {
diff --git a/src/com/android/launcher3/dragndrop/DragController.java b/src/com/android/launcher3/dragndrop/DragController.java
index 54a44ee..1b7b015 100644
--- a/src/com/android/launcher3/dragndrop/DragController.java
+++ b/src/com/android/launcher3/dragndrop/DragController.java
@@ -565,11 +565,13 @@
/**
* Since accessible drag and drop won't cause the same sequence of touch events, we manually
- * inject the appropriate state.
+ * inject the appropriate state which would have been otherwise initiated via touch events.
*/
public void prepareAccessibleDrag(int x, int y) {
mMotionDownX = x;
mMotionDownY = y;
+ mLastTouch[0] = x;
+ mLastTouch[1] = y;
}
/**