Initial changes to support a fixed all-apps layout.

- Dynamically update padding and background depending on fixed bounds and searchbar
- Fixes issue with drag layer bg getting clobbered when rotating launcher
- Tapping outside the bounds of all apps should close all apps
- Fixing typo causing widgets to not show in sw720dp devices

Bug: 20127840

Change-Id: I29c3f905bdee940f938ffe054f58434887073092
diff --git a/src/com/android/launcher3/AppsContainerRecyclerView.java b/src/com/android/launcher3/AppsContainerRecyclerView.java
index c93bacf..bb2aeb0 100644
--- a/src/com/android/launcher3/AppsContainerRecyclerView.java
+++ b/src/com/android/launcher3/AppsContainerRecyclerView.java
@@ -196,13 +196,27 @@
                 }
                 break;
             case MotionEvent.ACTION_UP:
+                ViewConfiguration viewConfig = ViewConfiguration.get(getContext());
+                float dx = ev.getX() - mDownX;
+                float dy = ev.getY() - mDownY;
+                float distance = (float) Math.sqrt(dx * dx + dy * dy);
+                if (distance < viewConfig.getScaledTouchSlop()) {
+                    Rect backgroundPadding = new Rect();
+                    getBackground().getPadding(backgroundPadding);
+                    boolean isOutsideBounds = ev.getX() < backgroundPadding.left ||
+                            ev.getX() > (getWidth() - backgroundPadding.right);
+                    if (isOutsideBounds) {
+                        Launcher launcher = (Launcher) getContext();
+                        launcher.showWorkspace(true);
+                    }
+                }
+                // Fall through
             case MotionEvent.ACTION_CANCEL:
                 mDraggingFastScroller = false;
                 animateFastScrollerVisibility(false);
                 break;
         }
         return mDraggingFastScroller;
-
     }
 
     /**
diff --git a/src/com/android/launcher3/AppsContainerView.java b/src/com/android/launcher3/AppsContainerView.java
index 2de45cb..559f6eb 100644
--- a/src/com/android/launcher3/AppsContainerView.java
+++ b/src/com/android/launcher3/AppsContainerView.java
@@ -19,6 +19,7 @@
 import android.content.res.Resources;
 import android.graphics.Point;
 import android.graphics.Rect;
+import android.graphics.drawable.InsetDrawable;
 import android.support.v7.widget.RecyclerView;
 import android.text.Editable;
 import android.text.TextWatcher;
@@ -26,12 +27,13 @@
 import android.view.KeyEvent;
 import android.view.MotionEvent;
 import android.view.View;
+import android.view.ViewConfiguration;
 import android.view.inputmethod.EditorInfo;
 import android.view.inputmethod.InputMethodManager;
 import android.widget.EditText;
 import android.widget.FrameLayout;
+import android.widget.LinearLayout;
 import android.widget.TextView;
-
 import com.android.launcher3.util.Thunk;
 
 import java.util.List;
@@ -59,8 +61,13 @@
     private EditText mSearchBar;
     private int mNumAppsPerRow;
     private Point mLastTouchDownPos = new Point();
-    private Rect mPadding = new Rect();
+    private Rect mInsets = new Rect();
+    private Rect mFixedBounds = new Rect();
     private int mContentMarginStart;
+    // Normal container insets
+    private int mContainerInset;
+    // Fixed bounds container insets
+    private int mFixedBoundsContainerInset;
 
     public AppsContainerView(Context context) {
         this(context, null);
@@ -76,6 +83,10 @@
         DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
         Resources res = context.getResources();
 
+        mContainerInset = context.getResources().getDimensionPixelSize(
+                R.dimen.apps_container_inset);
+        mFixedBoundsContainerInset = context.getResources().getDimensionPixelSize(
+                R.dimen.apps_container_fixed_bounds_inset);
         mLauncher = (Launcher) context;
         mApps = new AlphabeticalAppsList(context);
         if (USE_LAYOUT == GRID_LAYOUT) {
@@ -126,6 +137,15 @@
     }
 
     /**
+     * Hides the search bar
+     */
+    public void hideSearchBar() {
+        mSearchBar.setVisibility(View.GONE);
+        updateBackgrounds();
+        updatePaddings();
+    }
+
+    /**
      * Scrolls this list view to the top.
      */
     public void scrollToTop() {
@@ -154,45 +174,58 @@
             ((AppsGridAdapter) mAdapter).setRtl(isRtl);
         }
         mSearchBar = (EditText) findViewById(R.id.app_search_box);
-        mSearchBar.addTextChangedListener(this);
-        mSearchBar.setOnEditorActionListener(this);
+        if (mSearchBar != null) {
+            mSearchBar.addTextChangedListener(this);
+            mSearchBar.setOnEditorActionListener(this);
+        }
         mAppsListView = (AppsContainerRecyclerView) findViewById(R.id.apps_list_view);
         mAppsListView.setApps(mApps);
         mAppsListView.setNumAppsPerRow(mNumAppsPerRow);
         mAppsListView.setLayoutManager(mLayoutManager);
         mAppsListView.setAdapter(mAdapter);
         mAppsListView.setHasFixedSize(true);
-        if (isRtl) {
-            mAppsListView.setPadding(
-                    mAppsListView.getPaddingLeft(),
-                    mAppsListView.getPaddingTop(),
-                    mAppsListView.getPaddingRight() + mContentMarginStart,
-                    mAppsListView.getPaddingBottom());
-        } else {
-            mAppsListView.setPadding(
-                    mAppsListView.getPaddingLeft() + mContentMarginStart,
-                    mAppsListView.getPaddingTop(),
-                    mAppsListView.getPaddingRight(),
-                    mAppsListView.getPaddingBottom());
-        }
         if (mItemDecoration != null) {
             mAppsListView.addItemDecoration(mItemDecoration);
         }
-        mPadding.set(getPaddingLeft(), getPaddingTop(), getPaddingRight(),
-                getPaddingBottom());
+        updateBackgrounds();
+        updatePaddings();
     }
 
     @Override
     public void setInsets(Rect insets) {
-        setPadding(mPadding.left + insets.left, mPadding.top + insets.top,
-                mPadding.right + insets.right, mPadding.bottom + insets.bottom);
+        mInsets.set(insets);
+        updatePaddings();
+    }
+
+    /**
+     * Sets the fixed bounds for this Apps view.
+     */
+    public void setFixedBounds(Context context, Rect fixedBounds) {
+        if (!fixedBounds.isEmpty() && !fixedBounds.equals(mFixedBounds)) {
+            // Update the number of items in the grid
+            LauncherAppState app = LauncherAppState.getInstance();
+            DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
+            if (grid.updateAppsViewNumCols(context.getResources(), fixedBounds.width())) {
+                mNumAppsPerRow = grid.appsViewNumCols;
+                mAppsListView.setNumAppsPerRow(mNumAppsPerRow);
+                if (USE_LAYOUT == GRID_LAYOUT) {
+                    ((AppsGridAdapter) mAdapter).setNumAppsPerRow(mNumAppsPerRow);
+                }
+            }
+
+            mFixedBounds.set(fixedBounds);
+        }
+        updateBackgrounds();
+        updatePaddings();
     }
 
     @Override
     public boolean onTouch(View v, MotionEvent ev) {
-        if (ev.getAction() == MotionEvent.ACTION_DOWN ||
-                ev.getAction() == MotionEvent.ACTION_MOVE) {
-            mLastTouchDownPos.set((int) ev.getX(), (int) ev.getY());
+        switch (ev.getAction()) {
+            case MotionEvent.ACTION_DOWN:
+            case MotionEvent.ACTION_MOVE:
+                mLastTouchDownPos.set((int) ev.getX(), (int) ev.getY());
+                break;
         }
         return false;
     }
@@ -359,7 +392,9 @@
     public void onLauncherTransitionPrepare(Launcher l, boolean animated, boolean toWorkspace) {
         if (!toWorkspace) {
             // Disable the focus so that the search bar doesn't get focus
-            mSearchBar.setFocusableInTouchMode(false);
+            if (mSearchBar != null) {
+                mSearchBar.setFocusableInTouchMode(false);
+            }
         }
     }
 
@@ -375,11 +410,69 @@
 
     @Override
     public void onLauncherTransitionEnd(Launcher l, boolean animated, boolean toWorkspace) {
-        if (toWorkspace) {
-            // Clear the search bar
-            mSearchBar.setText("");
-        } else {
-            mSearchBar.setFocusableInTouchMode(true);
+        if (mSearchBar != null) {
+            if (toWorkspace) {
+                // Clear the search bar
+                mSearchBar.setText("");
+            } else {
+                mSearchBar.setFocusableInTouchMode(true);
+            }
         }
     }
+
+    /**
+     * Update the padding of the Apps view and children.  To ensure that the RecyclerView has the
+     * full width to handle touches right to the edge of the screen, we only apply the top and
+     * bottom padding to the AppsContainerView and then the left/right padding on the RecyclerView
+     * itself.  In particular, the left/right padding is applied to the background of the view,
+     * and then additionally inset by the start margin.
+     */
+    private void updatePaddings() {
+        boolean isRtl = (getResources().getConfiguration().getLayoutDirection() ==
+                LAYOUT_DIRECTION_RTL);
+        boolean hasSearchBar = (mSearchBar != null) && (mSearchBar.getVisibility() == View.VISIBLE);
+
+        if (mFixedBounds.isEmpty()) {
+            // If there are no fixed bounds, then use the default padding and insets
+            setPadding(mInsets.left, mContainerInset + mInsets.top, mInsets.right,
+                    mContainerInset + mInsets.bottom);
+        } else {
+            // If there are fixed bounds, then we update the padding to reflect the fixed bounds.
+            setPadding(mFixedBounds.left, mFixedBounds.top + mFixedBoundsContainerInset,
+                    getMeasuredWidth() - mFixedBounds.right,
+                    mInsets.bottom + mFixedBoundsContainerInset);
+        }
+
+        // Update the apps recycler view
+        int inset = mFixedBounds.isEmpty() ? mContainerInset : mFixedBoundsContainerInset;
+        if (isRtl) {
+            mAppsListView.setPadding(inset, inset, inset + mContentMarginStart, inset);
+        } else {
+            mAppsListView.setPadding(inset + mContentMarginStart, inset, inset, inset);
+        }
+
+        // Update the search bar
+        if (hasSearchBar) {
+            LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mSearchBar.getLayoutParams();
+            lp.leftMargin = lp.rightMargin = inset;
+        }
+    }
+
+    /**
+     * Update the background of the Apps view and children.
+     */
+    private void updateBackgrounds() {
+        int inset = mFixedBounds.isEmpty() ? mContainerInset : mFixedBoundsContainerInset;
+        boolean hasSearchBar = (mSearchBar != null) && (mSearchBar.getVisibility() == View.VISIBLE);
+
+        // Update the background of the reveal view and list to be inset with the fixed bound
+        // insets instead of the default insets
+        mAppsListView.setBackground(new InsetDrawable(
+                getContext().getResources().getDrawable(
+                        hasSearchBar ? R.drawable.apps_list_search_bg : R.drawable.apps_list_bg),
+                inset, 0, inset, 0));
+        getRevealView().setBackground(new InsetDrawable(
+                getContext().getResources().getDrawable(R.drawable.apps_reveal_bg),
+                inset, 0, inset, 0));
+    }
 }
diff --git a/src/com/android/launcher3/AppsGridAdapter.java b/src/com/android/launcher3/AppsGridAdapter.java
index 5b6967c..c8ce397 100644
--- a/src/com/android/launcher3/AppsGridAdapter.java
+++ b/src/com/android/launcher3/AppsGridAdapter.java
@@ -112,6 +112,7 @@
 
     private LayoutInflater mLayoutInflater;
     @Thunk AlphabeticalAppsList mApps;
+    private GridLayoutManager mGridLayoutMgr;
     private GridSpanSizer mGridSizer;
     private GridItemDecoration mItemDecoration;
     private View.OnTouchListener mTouchListener;
@@ -135,6 +136,9 @@
         mApps = apps;
         mAppsPerRow = appsPerRow;
         mGridSizer = new GridSpanSizer();
+        mGridLayoutMgr = new GridLayoutManager(context, appsPerRow, GridLayoutManager.VERTICAL,
+                false);
+        mGridLayoutMgr.setSpanSizeLookup(mGridSizer);
         mItemDecoration = new GridItemDecoration();
         mLayoutInflater = LayoutInflater.from(context);
         mTouchListener = touchListener;
@@ -150,6 +154,14 @@
     }
 
     /**
+     * Sets the number of apps per row.
+     */
+    public void setNumAppsPerRow(int appsPerRow) {
+        mAppsPerRow = appsPerRow;
+        mGridLayoutMgr.setSpanCount(appsPerRow);
+    }
+
+    /**
      * Sets whether we are in RTL mode.
      */
     public void setRtl(boolean rtl) {
@@ -167,10 +179,7 @@
      * Returns the grid layout manager.
      */
     public GridLayoutManager getLayoutManager(Context context) {
-        GridLayoutManager layoutMgr = new GridLayoutManager(context, mAppsPerRow,
-                GridLayoutManager.VERTICAL, false);
-        layoutMgr.setSpanSizeLookup(mGridSizer);
-        return layoutMgr;
+        return mGridLayoutMgr;
     }
 
     /**
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index ea28520..786f2ce 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -423,13 +423,21 @@
             allAppsNumCols = Math.max(minEdgeCellCount, Math.min(maxCols, allAppsNumCols));
         }
 
-        int appsContainerViewPx = res.getDimensionPixelSize(R.dimen.apps_container_width);
+        int appsContainerViewWidthPx = res.getDimensionPixelSize(R.dimen.apps_container_width);
+        updateAppsViewNumCols(res, appsContainerViewWidthPx);
+    }
+
+    public boolean updateAppsViewNumCols(Resources res, int containerWidth) {
         int appsViewLeftMarginPx =
                 res.getDimensionPixelSize(R.dimen.apps_grid_view_start_margin);
-        int availableAppsWidthPx = (appsContainerViewPx > 0) ? appsContainerViewPx :
-                availableWidthPx;
-        appsViewNumCols = (availableAppsWidthPx - appsViewLeftMarginPx) /
+        int availableAppsWidthPx = (containerWidth > 0) ? containerWidth : availableWidthPx;
+        int numCols = (availableAppsWidthPx - appsViewLeftMarginPx) /
                 (allAppsCellWidthPx + 2 * allAppsCellPaddingPx);
+        if (numCols != appsViewNumCols) {
+            appsViewNumCols = numCols;
+            return true;
+        }
+        return false;
     }
 
     void updateFromConfiguration(Context context, Resources resources, int wPx, int hPx,
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 068934e..3d2a346 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -520,6 +520,17 @@
 
     public boolean setLauncherCallbacks(LauncherCallbacks callbacks) {
         mLauncherCallbacks = callbacks;
+        mLauncherCallbacks.setLauncherAppsCallback(new Launcher.LauncherAppsCallbacks() {
+            @Override
+            public void onAllAppsBoundsChanged(Rect bounds) {
+                mAppsView.setFixedBounds(Launcher.this, bounds);
+            }
+
+            @Override
+            public void dismissAllApps() {
+                showWorkspace(true);
+            }
+        });
         return true;
     }
 
@@ -1141,6 +1152,19 @@
         public void forceExitFullImmersion();
     }
 
+    public interface LauncherAppsCallbacks {
+        /**
+         * Updates launcher to the available space that AllApps can take so as not to overlap with
+         * any other views.
+         */
+        public void onAllAppsBoundsChanged(Rect bounds);
+
+        /**
+         * Called to dismiss all apps if it is showing.
+         */
+        public void dismissAllApps();
+    }
+
     public interface LauncherOverlayCallbacks {
         /**
          * This method indicates whether a call to {@link #enterFullImmersion()} will succeed,
@@ -1418,6 +1442,9 @@
 
         // Setup Apps
         mAppsView = (AppsContainerView) findViewById(R.id.apps_view);
+        if (mLauncherCallbacks != null && mLauncherCallbacks.overrideAllAppsSearch()) {
+            mAppsView.hideSearchBar();
+        }
 
         // Setup AppsCustomize
         mWidgetsView = (WidgetsContainerView) findViewById(R.id.widgets_view);
@@ -2587,9 +2614,6 @@
         } else {
             showAppsView(true /* animated */, false /* resetListToTop */);
         }
-        if (mLauncherCallbacks != null) {
-            mLauncherCallbacks.onClickAllAppsButton(v);
-        }
     }
 
     private void showBrokenAppInstallDialog(final String packageName,
@@ -3270,7 +3294,9 @@
     }
 
     void showWorkspace(boolean animated, Runnable onCompleteRunnable) {
-        if (mState != State.WORKSPACE || mWorkspace.getState() != Workspace.State.NORMAL) {
+        boolean changed = mState != State.WORKSPACE ||
+                mWorkspace.getState() != Workspace.State.NORMAL;
+        if (changed) {
             boolean wasInSpringLoadedMode = (mState != State.WORKSPACE);
             mWorkspace.setVisibility(View.VISIBLE);
             mStateTransitionAnimation.startAnimationToWorkspace(mState, Workspace.State.NORMAL,
@@ -3295,11 +3321,13 @@
         mUserPresent = true;
         updateAutoAdvanceState();
 
-        // Send an accessibility event to announce the context change
-        getWindow().getDecorView()
-                .sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
+        if (changed) {
+            // Send an accessibility event to announce the context change
+            getWindow().getDecorView()
+                    .sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
 
-        onWorkspaceShown(animated);
+            onWorkspaceShown(animated);
+        }
     }
 
     void showOverviewMode(boolean animated) {
@@ -3350,6 +3378,9 @@
 
         if (toState == State.APPS) {
             mStateTransitionAnimation.startAnimationToAllApps(animated);
+            if (mLauncherCallbacks != null) {
+                mLauncherCallbacks.onAllAppsShown();
+            }
         } else {
             mStateTransitionAnimation.startAnimationToWidgets(animated);
         }
diff --git a/src/com/android/launcher3/LauncherCallbacks.java b/src/com/android/launcher3/LauncherCallbacks.java
index d8128d6..2fee81c 100644
--- a/src/com/android/launcher3/LauncherCallbacks.java
+++ b/src/com/android/launcher3/LauncherCallbacks.java
@@ -50,6 +50,7 @@
     public void onLauncherProviderChange();
     public void finishBindingItems(final boolean upgradePath);
     public void onClickAllAppsButton(View v);
+    public void onAllAppsShown();
     public void bindAllApplications(ArrayList<AppInfo> apps);
     public void onClickFolderIcon(View v);
     public void onClickAppShortcut(View v);
@@ -87,6 +88,7 @@
     public ComponentName getWallpaperPickerComponent();
     public boolean overrideWallpaperDimensions();
     public boolean isLauncherPreinstalled();
+    public boolean overrideAllAppsSearch();
 
     /**
      * Returning true will immediately result in a call to {@link #setLauncherOverlayView(ViewGroup,
@@ -106,4 +108,12 @@
     public Launcher.LauncherOverlay setLauncherOverlayView(InsettableFrameLayout container,
             Launcher.LauncherOverlayCallbacks callbacks);
 
+    /**
+     * Sets the callbacks to allow any extensions to callback to the launcher.
+     *
+     * @param callbacks A set of callbacks to the Launcher, is actually a LauncherAppsCallback, but
+     *                  for implementation purposes is passed around as an object.
+     */
+    public void setLauncherAppsCallback(Object callbacks);
+
 }
diff --git a/src/com/android/launcher3/LauncherExtension.java b/src/com/android/launcher3/LauncherExtension.java
index fe9bd6c..e4fdbbc 100644
--- a/src/com/android/launcher3/LauncherExtension.java
+++ b/src/com/android/launcher3/LauncherExtension.java
@@ -124,6 +124,10 @@
         }
 
         @Override
+        public void onAllAppsShown() {
+        }
+
+        @Override
         public void bindAllApplications(ArrayList<AppInfo> apps) {
         }
 
@@ -246,6 +250,11 @@
         }
 
         @Override
+        public boolean overrideAllAppsSearch() {
+            return false;
+        }
+
+        @Override
         public boolean isLauncherPreinstalled() {
             return false;
         }
@@ -265,6 +274,11 @@
             return mLauncherOverlay;
         }
 
+        @Override
+        public void setLauncherAppsCallback(Object callbacks) {
+            // Do nothing
+        }
+
         class LauncherExtensionOverlay implements LauncherOverlay {
             LauncherOverlayCallbacks mLauncherOverlayCallbacks;
             ViewGroup mOverlayView;
diff --git a/src/com/android/launcher3/LauncherStateTransitionAnimation.java b/src/com/android/launcher3/LauncherStateTransitionAnimation.java
index e92bfb0..57bd5b2 100644
--- a/src/com/android/launcher3/LauncherStateTransitionAnimation.java
+++ b/src/com/android/launcher3/LauncherStateTransitionAnimation.java
@@ -174,7 +174,7 @@
             }
         };
         startAnimationToOverlay(Workspace.State.NORMAL_HIDDEN, toView, toView.getContentView(),
-                toView.getRevealView(), null, animated, cb);
+                toView.getRevealView(), animated, false /* hideSearchBar */, cb);
     }
 
     /**
@@ -198,7 +198,7 @@
             }
         };
         startAnimationToOverlay(Workspace.State.OVERVIEW_HIDDEN, toView, toView.getContentView(),
-                toView.getRevealView(), null, animated, cb);
+                toView.getRevealView(), animated, true /* hideSearchBar */, cb);
     }
 
     /**
@@ -226,8 +226,8 @@
      * Creates and starts a new animation to a particular overlay view.
      */
     private void startAnimationToOverlay(final Workspace.State toWorkspaceState, final View toView,
-             final View contentView, final View revealView, final View pageIndicatorsView,
-             final boolean animated, final PrivateTransitionCallbacks pCb) {
+             final View contentView, final View revealView, final boolean animated,
+             final boolean hideSearchBar, final PrivateTransitionCallbacks pCb) {
         final Resources res = mLauncher.getResources();
         final boolean material = Utilities.isLmpOrAbove();
         final int revealDuration = res.getInteger(R.integer.config_appsCustomizeRevealTime);
@@ -293,15 +293,6 @@
             layerViews.put(revealView, BUILD_AND_SET_LAYER);
             mStateAnimation.play(panelAlphaAndDrift);
 
-            // Setup the animation for the page indicators
-            if (pageIndicatorsView != null) {
-                pageIndicatorsView.setAlpha(0.01f);
-                ObjectAnimator indicatorsAlpha =
-                        ObjectAnimator.ofFloat(pageIndicatorsView, "alpha", 1f);
-                indicatorsAlpha.setDuration(revealDuration);
-                mStateAnimation.play(indicatorsAlpha);
-            }
-
             // Setup the animation for the content view
             contentView.setVisibility(View.VISIBLE);
             contentView.setAlpha(0f);
@@ -354,8 +345,9 @@
                         }
                     }
 
-                    // Hide the search bar
-                    mCb.onStateTransitionHideSearchBar();
+                    if (hideSearchBar) {
+                        mCb.onStateTransitionHideSearchBar();
+                    }
 
                     // This can hold unnecessary references to views.
                     mStateAnimation = null;
@@ -414,8 +406,9 @@
             // Show the content view
             contentView.setVisibility(View.VISIBLE);
 
-            // Hide the search bar
-            mCb.onStateTransitionHideSearchBar();
+            if (hideSearchBar) {
+                mCb.onStateTransitionHideSearchBar();
+            }
 
             dispatchOnLauncherTransitionPrepare(fromView, animated, false);
             dispatchOnLauncherTransitionStart(fromView, animated, false);
@@ -484,8 +477,7 @@
             }
         };
         startAnimationToWorkspaceFromOverlay(toWorkspaceState, appsView, appsView.getContentView(),
-                appsView.getRevealView(), null /* pageIndicatorsView */, animated,
-                onCompleteRunnable, cb);
+                appsView.getRevealView(), animated, onCompleteRunnable, cb);
     }
 
     /**
@@ -516,8 +508,8 @@
             }
         };
         startAnimationToWorkspaceFromOverlay(toWorkspaceState, widgetsView,
-                widgetsView.getContentView(), widgetsView.getRevealView(),
-                null, animated, onCompleteRunnable, cb);
+                widgetsView.getContentView(), widgetsView.getRevealView(), animated,
+                onCompleteRunnable, cb);
     }
 
     /**
@@ -525,8 +517,8 @@
      */
     private void startAnimationToWorkspaceFromOverlay(final Workspace.State toWorkspaceState,
               final View fromView, final View contentView, final View revealView,
-              final View pageIndicatorsView, final boolean animated,
-              final Runnable onCompleteRunnable, final PrivateTransitionCallbacks pCb) {
+              final boolean animated, final Runnable onCompleteRunnable,
+              final PrivateTransitionCallbacks pCb) {
         final Resources res = mLauncher.getResources();
         final boolean material = Utilities.isLmpOrAbove();
         final int revealDuration = res.getInteger(R.integer.config_appsCustomizeRevealTime);
@@ -631,16 +623,6 @@
                 itemsAlpha.setInterpolator(decelerateInterpolator);
                 mStateAnimation.play(itemsAlpha);
 
-                // Setup the page indicators animation
-                if (pageIndicatorsView != null) {
-                    pageIndicatorsView.setAlpha(1f);
-                    ObjectAnimator indicatorsAlpha =
-                            LauncherAnimUtils.ofFloat(pageIndicatorsView, "alpha", 0f);
-                    indicatorsAlpha.setDuration(revealDuration);
-                    indicatorsAlpha.setInterpolator(new DecelerateInterpolator(1.5f));
-                    mStateAnimation.play(indicatorsAlpha);
-                }
-
                 if (material) {
                     // Animate the all apps button
                     float finalRadius = pCb.getMaterialRevealViewStartFinalRadius();
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 8cc99a0..9173971 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -1700,7 +1700,11 @@
 
         mLastCustomContentScrollProgress = progress;
 
-        mLauncher.getDragLayer().setBackgroundAlpha(progress * 0.8f);
+        // We should only update the drag layer background alpha if we are not in all apps or the
+        // widgets tray
+        if (mState == State.NORMAL) {
+            mLauncher.getDragLayer().setBackgroundAlpha(progress * 0.8f);
+        }
 
         if (mLauncher.getHotseat() != null) {
             mLauncher.getHotseat().setTranslationX(translationX);
@@ -2252,7 +2256,8 @@
         float finalBackgroundAlpha = (stateIsSpringLoaded || stateIsOverview) ? 1.0f : 0f;
         float finalHotseatAndPageIndicatorAlpha = (stateIsNormal || stateIsSpringLoaded) ? 1f : 0f;
         float finalOverviewPanelAlpha = stateIsOverview ? 1f : 0f;
-        float finalSearchBarAlpha = !stateIsNormal ? 0f : 1f;
+        // We keep the search bar visible on the workspace and in AllApps now
+        float finalSearchBarAlpha = (stateIsNormal || stateIsNormalHidden) ? 1f : 0f;
         float finalWorkspaceTranslationY = stateIsOverview || stateIsOverviewHidden ?
                 getOverviewModeTranslationY() : 0;