Announcing the final action when the drag-drop completes

Bug:31926812
Change-Id: Id0566cc7dc15732981320807a02fb9cae8a885e6
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index fc35064..e891b16 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -2760,6 +2760,9 @@
             }
             parent.onDropChild(cell);
         }
+        if (d.stateAnnouncer != null) {
+            d.stateAnnouncer.completeAction(R.string.item_moved);
+        }
     }
 
     /**
diff --git a/src/com/android/launcher3/accessibility/DragViewStateAnnouncer.java b/src/com/android/launcher3/accessibility/DragViewStateAnnouncer.java
index 8ff82dd..99deb7b 100644
--- a/src/com/android/launcher3/accessibility/DragViewStateAnnouncer.java
+++ b/src/com/android/launcher3/accessibility/DragViewStateAnnouncer.java
@@ -21,6 +21,8 @@
 import android.view.accessibility.AccessibilityEvent;
 import android.view.accessibility.AccessibilityManager;
 
+import com.android.launcher3.Launcher;
+
 /**
  * Periodically sends accessibility events to announce ongoing state changed. Based on the
  * implementation in ProgressBar.
@@ -50,6 +52,12 @@
         mTargetView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
     }
 
+    public void completeAction(int announceResId) {
+        cancel();
+        Launcher launcher = Launcher.getLauncher(mTargetView.getContext());
+        launcher.getDragLayer().announceForAccessibility(launcher.getText(announceResId));
+    }
+
     public static DragViewStateAnnouncer createFor(View v) {
         if (((AccessibilityManager) v.getContext().getSystemService(Context.ACCESSIBILITY_SERVICE))
                 .isEnabled()) {
diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java
index ebbe641..0ae3a62 100644
--- a/src/com/android/launcher3/folder/Folder.java
+++ b/src/com/android/launcher3/folder/Folder.java
@@ -1346,6 +1346,10 @@
             // The animation has already been shown while opening the folder.
             mInfo.setOption(FolderInfo.FLAG_MULTI_PAGE_ANIMATION, true, mLauncher);
         }
+
+        if (d.stateAnnouncer != null) {
+            d.stateAnnouncer.completeAction(R.string.item_moved);
+        }
     }
 
     // This is used so the item doesn't immediately appear in the folder when added. In one case