diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 258359e982648..02f372fcb19a3 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -14248,34 +14248,34 @@ public class View implements Drawable.Callback, KeyEvent.Callback, hideTooltip(); return true; } - } - - if (action == R.id.accessibilityActionDragDrop) { - if (!canAcceptAccessibilityDrop()) { - return false; - } - try { - if (mAttachInfo != null && mAttachInfo.mSession != null) { - final int[] location = new int[2]; - getLocationInWindow(location); - final int centerX = location[0] + getWidth() / 2; - final int centerY = location[1] + getHeight() / 2; - return mAttachInfo.mSession.dropForAccessibility(mAttachInfo.mWindow, - centerX, centerY); + case R.id.accessibilityActionDragDrop: { + if (!canAcceptAccessibilityDrop()) { + return false; + } + try { + if (mAttachInfo != null && mAttachInfo.mSession != null) { + final int[] location = new int[2]; + getLocationInWindow(location); + final int centerX = location[0] + getWidth() / 2; + final int centerY = location[1] + getHeight() / 2; + return mAttachInfo.mSession.dropForAccessibility(mAttachInfo.mWindow, + centerX, centerY); + } + } catch (RemoteException e) { + Log.e(VIEW_LOG_TAG, "Unable to drop for accessibility", e); } - } catch (RemoteException e) { - Log.e(VIEW_LOG_TAG, "Unable to drop for accessibility", e); - } - return false; - } else if (action == R.id.accessibilityActionDragCancel) { - if (!startedSystemDragForAccessibility()) { return false; } - if (mAttachInfo != null && mAttachInfo.mDragToken != null) { - cancelDragAndDrop(); - return true; + case R.id.accessibilityActionDragCancel: { + if (!startedSystemDragForAccessibility()) { + return false; + } + if (mAttachInfo != null && mAttachInfo.mDragToken != null) { + cancelDragAndDrop(); + return true; + } + return false; } - return false; } return false; } diff --git a/core/java/android/view/accessibility/AccessibilityNodeInfo.java b/core/java/android/view/accessibility/AccessibilityNodeInfo.java index db7c6634c8a71..0a33d6cd82ea7 100644 --- a/core/java/android/view/accessibility/AccessibilityNodeInfo.java +++ b/core/java/android/view/accessibility/AccessibilityNodeInfo.java @@ -4321,15 +4321,13 @@ public class AccessibilityNodeInfo implements Parcelable { return "ACTION_PRESS_AND_HOLD"; case R.id.accessibilityActionImeEnter: return "ACTION_IME_ENTER"; + case R.id.accessibilityActionDragStart: + return "ACTION_DRAG"; + case R.id.accessibilityActionDragCancel: + return "ACTION_CANCEL_DRAG"; + case R.id.accessibilityActionDragDrop: + return "ACTION_DROP"; default: - // TODO(197520937): Use finalized constants in switch - if (action == R.id.accessibilityActionDragStart) { - return "ACTION_DRAG"; - } else if (action == R.id.accessibilityActionDragCancel) { - return "ACTION_CANCEL_DRAG"; - } else if (action == R.id.accessibilityActionDragDrop) { - return "ACTION_DROP"; - } return "ACTION_UNKNOWN"; } }