Revert "Revert "Adding support for hiding widgets from the widget tray and reconfiguring widgets""

This reverts commit f502e5faecbd460ad3b8258168c5812cbaa34c4e.

Reason for revert: Reverting post-build

Change-Id: I09eb292dbbbe37ffaf3abc477aa2ddb5700093b8
diff --git a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
index 3b6fea9..2cd8b1d 100644
--- a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
+++ b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
@@ -47,8 +47,8 @@
     private static final String TAG = "LauncherAccessibilityDelegate";
 
     public static final int REMOVE = R.id.action_remove;
-    public static final int INFO = R.id.action_info;
     public static final int UNINSTALL = R.id.action_uninstall;
+    public static final int RECONFIGURE = R.id.action_reconfigure;
     protected static final int ADD_TO_WORKSPACE = R.id.action_add_to_workspace;
     protected static final int MOVE = R.id.action_move;
     protected static final int MOVE_TO_WORKSPACE = R.id.action_move_to_workspace;
@@ -77,10 +77,10 @@
 
         mActions.put(REMOVE, new AccessibilityAction(REMOVE,
                 launcher.getText(R.string.remove_drop_target_label)));
-        mActions.put(INFO, new AccessibilityAction(INFO,
-                launcher.getText(R.string.app_info_drop_target_label)));
         mActions.put(UNINSTALL, new AccessibilityAction(UNINSTALL,
                 launcher.getText(R.string.uninstall_drop_target_label)));
+        mActions.put(RECONFIGURE, new AccessibilityAction(RECONFIGURE,
+                launcher.getText(R.string.gadget_setup_text)));
         mActions.put(ADD_TO_WORKSPACE, new AccessibilityAction(ADD_TO_WORKSPACE,
                 launcher.getText(R.string.action_add_to_workspace)));
         mActions.put(MOVE, new AccessibilityAction(MOVE,
@@ -110,7 +110,7 @@
         }
 
         for (ButtonDropTarget target : mLauncher.getDropTargetBar().getDropTargets()) {
-            if (target.supportsAccessibilityDrop(item)) {
+            if (target.supportsAccessibilityDrop(item, host)) {
                 info.addAction(mActions.get(target.getAccessibilityAction()));
             }
         }
@@ -222,7 +222,8 @@
             return PopupContainerWithArrow.showForIcon((BubbleTextView) host) != null;
         } else {
             for (ButtonDropTarget dropTarget : mLauncher.getDropTargetBar().getDropTargets()) {
-                if (action == dropTarget.getAccessibilityAction()) {
+                if (dropTarget.supportsAccessibilityDrop(item, host) &&
+                        action == dropTarget.getAccessibilityAction()) {
                     dropTarget.onAccessibilityDrop(host, item);
                     return true;
                 }