Adding a flag (enabled by default) to remove the all-apps button.

All apps can still be opened by clicking the caret.

Bug: 29398447
Change-Id: I61f1b05cea83a0a49d7cc16c518c5419618ba779
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index c1c41a8..d768ea8 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1457,13 +1457,14 @@
 
     /**
      * Sets the all apps button. This method is called from {@link Hotseat}.
+     * TODO: Get rid of this.
      */
     public void setAllAppsButton(View allAppsButton) {
         mAllAppsButton = allAppsButton;
     }
 
-    public View getAllAppsButton() {
-        return mAllAppsButton;
+    public View getStartViewForAllAppsRevealAnimation() {
+        return FeatureFlags.NO_ALL_APPS_ICON ? mPageIndicator : mAllAppsButton;
     }
 
     public View getWidgetsButton() {
@@ -2491,7 +2492,7 @@
             if (v instanceof FolderIcon) {
                 onClickFolderIcon(v);
             }
-        } else if (v instanceof PageIndicator || v == mAllAppsButton) {
+        } else if (v instanceof PageIndicator || (v == mAllAppsButton && mAllAppsButton != null)) {
             onClickAllAppsButton(v);
         } else if (tag instanceof AppInfo) {
             startAppShortcutOrInfoActivity(v);
@@ -3096,7 +3097,7 @@
         if (isWorkspaceLocked()) return false;
         if (mState != State.WORKSPACE) return false;
 
-        if (v == mAllAppsButton) {
+        if (v == mAllAppsButton && mAllAppsButton != null) {
             onLongClickAllAppsButton(v);
             return true;
         }
@@ -3127,7 +3128,6 @@
 
         // The hotseat touch handling does not go through Workspace, and we always allow long press
         // on hotseat items.
-        final boolean inHotseat = isHotseatLayout(v);
         if (!mDragController.isDragging()) {
             if (itemUnderLongClick == null) {
                 // User long pressed on empty space
@@ -3138,13 +3138,12 @@
                 } else {
                     showOverviewMode(true);
                     mHotseat.requestDisallowInterceptTouchEvent(true);
-
                 }
             } else {
-                final boolean isAllAppsButton = inHotseat && isAllAppsButtonRank(
-                        mHotseat.getOrderInHotseat(
-                                longClickCellInfo.cellX,
-                                longClickCellInfo.cellY));
+                final boolean isAllAppsButton =
+                        !FeatureFlags.NO_ALL_APPS_ICON && isHotseatLayout(v) &&
+                                mDeviceProfile.inv.isAllAppsButtonRank(mHotseat.getOrderInHotseat(
+                                        longClickCellInfo.cellX, longClickCellInfo.cellY));
                 if (!(itemUnderLongClick instanceof Folder || isAllAppsButton)) {
                     // User long pressed on an item
                     mWorkspace.startDrag(longClickCellInfo);
@@ -3989,13 +3988,6 @@
         }
     }
 
-    public boolean isAllAppsButtonRank(int rank) {
-        if (mHotseat != null) {
-            return mHotseat.isAllAppsButtonRank(rank);
-        }
-        return false;
-    }
-
     private boolean canRunNewAppsAnimation() {
         long diff = System.currentTimeMillis() - mDragController.getLastGestureUpTime();
         return diff > (NEW_APPS_ANIMATION_INACTIVE_TIMEOUT_SECONDS * 1000)