Merge "Set "usingRemoteAnim" for fallback recents" into ub-launcher3-qt-dev
diff --git a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
index 8276078..a53a06e 100644
--- a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
+++ b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
@@ -153,6 +153,7 @@
     private View mContentView;
     private boolean mTransitionedFromApp;
     private boolean mUsingRemoteAnimation;
+    private boolean mStartedEnterAnimation;
     private AnimatorSet mLayoutAnimation;
     private final ArraySet<View> mLayingOutViews = new ArraySet<>();
     private Rect mInsets;
@@ -298,6 +299,7 @@
      * becomes visible.
      */
     public void onBeginTransitionToOverview() {
+        mStartedEnterAnimation = false;
         if (mContext.getResources().getConfiguration().orientation == ORIENTATION_LANDSCAPE) {
             // Scroll to bottom of task in landscape mode. This is a non-issue in portrait mode as
             // all tasks should be visible to fill up the screen in portrait mode and the view will
@@ -322,16 +324,22 @@
                         + "of items to animate to.");
             }
             // Possible that task list loads faster than adapter changes propagate to layout so
-            // only start content fill animation if there aren't any pending adapter changes.
-            if (!mTaskRecyclerView.hasPendingAdapterUpdates()) {
+            // only start content fill animation if there aren't any pending adapter changes and
+            // we've started the on enter layout animation.
+            boolean needsContentFillAnimation =
+                    !mTaskRecyclerView.hasPendingAdapterUpdates() && mStartedEnterAnimation;
+            if (needsContentFillAnimation) {
                 // Set item animator for content filling animation. The item animator will switch
                 // back to the default on completion
                 mTaskRecyclerView.setItemAnimator(mLoadingContentItemAnimator);
+                mTaskAdapter.notifyItemRangeRemoved(TASKS_START_POSITION + numActualItems,
+                        numEmptyItems - numActualItems);
+                mTaskAdapter.notifyItemRangeChanged(TASKS_START_POSITION, numActualItems,
+                        CHANGE_EVENT_TYPE_EMPTY_TO_CONTENT);
+            } else {
+                // Notify change without animating.
+                mTaskAdapter.notifyDataSetChanged();
             }
-            mTaskAdapter.notifyItemRangeRemoved(TASKS_START_POSITION + numActualItems,
-                    numEmptyItems - numActualItems);
-            mTaskAdapter.notifyItemRangeChanged(TASKS_START_POSITION, numActualItems,
-                    CHANGE_EVENT_TYPE_EMPTY_TO_CONTENT);
         });
     }
 
@@ -622,6 +630,7 @@
             }
         });
         mLayoutAnimation.start();
+        mStartedEnterAnimation = true;
     }
 
     /**
@@ -647,6 +656,7 @@
         playRemoteAppScaleDownAnim(anim, appMatrix, appTarget, recentsTarget,
                 bottomView.getThumbnailView());
         playRemoteTaskListFadeIn(anim, bottomView);
+        mStartedEnterAnimation = true;
     }
 
     /**
diff --git a/protos/launcher_log.proto b/protos/launcher_log.proto
index 02c6b0f..49fd436 100644
--- a/protos/launcher_log.proto
+++ b/protos/launcher_log.proto
@@ -56,6 +56,7 @@
   optional int32 predictedRank = 15;
   optional TargetExtension extension = 16;
   optional TipType tip_type = 17;
+  optional int32 search_query_length = 18;
 }
 
 // Used to define what type of item a Target would represent.
diff --git a/quickstep/recents_ui_overrides/res/layout/proactive_hints_container.xml b/quickstep/recents_ui_overrides/res/layout/proactive_hints_container.xml
new file mode 100644
index 0000000..be3f17a
--- /dev/null
+++ b/quickstep/recents_ui_overrides/res/layout/proactive_hints_container.xml
@@ -0,0 +1,7 @@
+<com.android.quickstep.hints.ProactiveHintsContainer
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center_horizontal|bottom"
+    android:gravity="center_horizontal">
+</com.android.quickstep.hints.ProactiveHintsContainer>
\ No newline at end of file
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
index 11a1885..c3a7698 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
@@ -31,6 +31,7 @@
 import com.android.launcher3.LauncherStateManager.AnimationConfig;
 import com.android.launcher3.anim.AnimatorSetBuilder;
 import com.android.launcher3.anim.PropertySetter;
+import com.android.quickstep.hints.ProactiveHintsContainer;
 import com.android.quickstep.views.ClearAllButton;
 import com.android.quickstep.views.LauncherRecentsView;
 import com.android.quickstep.views.RecentsView;
@@ -53,6 +54,14 @@
         if (state.overviewUi) {
             mRecentsView.updateEmptyMessage();
             mRecentsView.resetTaskVisuals();
+            mRecentsView.setHintVisibility(1f);
+        } else {
+            mRecentsView.setHintVisibility(0f);
+            ProactiveHintsContainer
+                    proactiveHintsContainer = mRecentsView.getProactiveHintsContainer();
+            if (proactiveHintsContainer != null) {
+                proactiveHintsContainer.removeAllViews();
+            }
         }
         setAlphas(PropertySetter.NO_ANIM_PROPERTY_SETTER, state.getVisibleElements(mLauncher));
     }
@@ -64,6 +73,14 @@
 
         if (!toState.overviewUi) {
             builder.addOnFinishRunnable(mRecentsView::resetTaskVisuals);
+            mRecentsView.setHintVisibility(0f);
+            builder.addOnFinishRunnable(() -> {
+                ProactiveHintsContainer
+                        proactiveHintsContainer = mRecentsView.getProactiveHintsContainer();
+                if (proactiveHintsContainer != null) {
+                    proactiveHintsContainer.removeAllViews();
+                }
+            });
         }
 
         if (toState.overviewUi) {
@@ -75,6 +92,7 @@
             updateAnim.setDuration(config.duration);
             builder.play(updateAnim);
             mRecentsView.updateEmptyMessage();
+            builder.addOnFinishRunnable(() -> mRecentsView.setHintVisibility(1f));
         }
 
         setAlphas(config.getPropertySetter(builder), toState.getVisibleElements(mLauncher));
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
index 49c95f1..d927d83 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -1095,14 +1095,15 @@
 
             homeAnim.setPlayFraction(progress);
 
-            float iconAlpha = Utilities.mapToRange(interpolatedProgress, 0,
-                    windowAlphaThreshold, 0f, 1f, Interpolators.LINEAR);
-            mTransformParams.setCurrentRectAndTargetAlpha(currentRect, 1f - iconAlpha);
+            float windowAlpha = Utilities.mapToRange(interpolatedProgress, 0,
+                    windowAlphaThreshold, 1f, 0f, Interpolators.LINEAR);
+            mTransformParams.setProgress(progress)
+                    .setCurrentRectAndTargetAlpha(currentRect, windowAlpha);
             mClipAnimationHelper.applyTransform(targetSet, mTransformParams,
                     false /* launcherOnTop */);
 
             if (isFloatingIconView) {
-                ((FloatingIconView) floatingView).update(currentRect, iconAlpha, progress,
+                ((FloatingIconView) floatingView).update(currentRect, 1f, progress,
                         windowAlphaThreshold, mClipAnimationHelper.getCurrentCornerRadius(), false);
             }
 
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/hints/ProactiveHintsContainer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/hints/ProactiveHintsContainer.java
new file mode 100644
index 0000000..74a4851
--- /dev/null
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/hints/ProactiveHintsContainer.java
@@ -0,0 +1,55 @@
+package com.android.quickstep.hints;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.util.FloatProperty;
+import android.view.View;
+import android.widget.FrameLayout;
+
+public class ProactiveHintsContainer extends FrameLayout {
+
+  public static final FloatProperty<ProactiveHintsContainer> HINT_VISIBILITY =
+      new FloatProperty<ProactiveHintsContainer>("hint_visibility") {
+        @Override
+        public void setValue(ProactiveHintsContainer proactiveHintsContainer, float v) {
+          proactiveHintsContainer.setHintVisibility(v);
+        }
+
+        @Override
+        public Float get(ProactiveHintsContainer proactiveHintsContainer) {
+          return proactiveHintsContainer.mHintVisibility;
+        }
+      };
+
+  private float mHintVisibility;
+
+  public ProactiveHintsContainer(Context context) {
+    super(context);
+  }
+
+  public ProactiveHintsContainer(Context context, AttributeSet attrs) {
+    super(context, attrs);
+  }
+
+  public ProactiveHintsContainer(Context context, AttributeSet attrs, int defStyleAttr) {
+    super(context, attrs, defStyleAttr);
+  }
+
+  public ProactiveHintsContainer(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+    super(context, attrs, defStyleAttr, defStyleRes);
+  }
+
+  public void setView(View v) {
+    removeAllViews();
+    addView(v);
+  }
+
+  public void setHintVisibility(float v) {
+    if (v == 1) {
+      setVisibility(VISIBLE);
+    } else {
+      setVisibility(GONE);
+    }
+    mHintVisibility = v;
+  }
+}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RectFSpringAnim.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RectFSpringAnim.java
index 40b9c4d..09db695 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RectFSpringAnim.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/RectFSpringAnim.java
@@ -33,6 +33,8 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import static com.android.launcher3.anim.Interpolators.DEACCEL;
+
 /**
  * Applies spring forces to animate from a starting rect to a target rect,
  * while providing update callbacks to the caller.
@@ -45,7 +47,7 @@
      * can be done in parallel at a fixed duration. Update callbacks are sent based on the progress
      * of this animation, while the end callback is sent after all animations finish.
      */
-    private static final long RECT_SCALE_DURATION = 180;
+    private static final long RECT_SCALE_DURATION = 250;
 
     private static final FloatPropertyCompat<RectFSpringAnim> RECT_CENTER_X =
             new FloatPropertyCompat<RectFSpringAnim>("rectCenterXSpring") {
@@ -148,6 +150,7 @@
         mRectScaleAnim = ObjectAnimator.ofPropertyValuesHolder(this,
                 PropertyValuesHolder.ofFloat(RECT_SCALE_PROGRESS, 1))
                 .setDuration(RECT_SCALE_DURATION);
+        mRectScaleAnim.setInterpolator(DEACCEL);
         mRectScaleAnim.addListener(new AnimationSuccessListener() {
             @Override
             public void onAnimationSuccess(Animator animator) {
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java
index d6f2235..bdac750 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java
@@ -34,6 +34,8 @@
 import android.util.AttributeSet;
 import android.view.View;
 
+import androidx.annotation.Nullable;
+
 import com.android.launcher3.DeviceProfile;
 import com.android.launcher3.Launcher;
 import com.android.launcher3.LauncherState;
@@ -41,8 +43,11 @@
 import com.android.launcher3.anim.Interpolators;
 import com.android.launcher3.appprediction.PredictionUiStateManager;
 import com.android.launcher3.appprediction.PredictionUiStateManager.Client;
+import com.android.launcher3.util.PendingAnimation;
+import com.android.launcher3.views.BaseDragLayer;
 import com.android.launcher3.views.ScrimView;
 import com.android.quickstep.SysUINavigationMode;
+import com.android.quickstep.hints.ProactiveHintsContainer;
 import com.android.quickstep.util.ClipAnimationHelper;
 import com.android.quickstep.util.ClipAnimationHelper.TransformParams;
 import com.android.quickstep.util.LayoutUtils;
@@ -54,6 +59,8 @@
 public class LauncherRecentsView extends RecentsView<Launcher> {
 
     private final TransformParams mTransformParams = new TransformParams();
+    private final int mChipOverhang;
+    @Nullable private ProactiveHintsContainer mProactiveHintsContainer;
 
     public LauncherRecentsView(Context context) {
         this(context, null);
@@ -66,6 +73,16 @@
     public LauncherRecentsView(Context context, AttributeSet attrs, int defStyleAttr) {
         super(context, attrs, defStyleAttr);
         setContentAlpha(0);
+        mChipOverhang = (int) context.getResources().getDimension(R.dimen.chip_hint_overhang);
+    }
+
+    @Override
+    protected void onAttachedToWindow() {
+        super.onAttachedToWindow();
+        View hintContainer = mActivity.findViewById(R.id.hints);
+        mProactiveHintsContainer =
+                hintContainer instanceof ProactiveHintsContainer
+                        ? (ProactiveHintsContainer) hintContainer : null;
     }
 
     @Override
@@ -84,6 +101,11 @@
         }
     }
 
+    @Nullable
+    public ProactiveHintsContainer getProactiveHintsContainer() {
+        return mProactiveHintsContainer;
+    }
+
     @Override
     public void draw(Canvas canvas) {
         maybeDrawEmptyMessage(canvas);
@@ -137,6 +159,48 @@
     @Override
     protected void getTaskSize(DeviceProfile dp, Rect outRect) {
         LayoutUtils.calculateLauncherTaskSize(getContext(), dp, outRect);
+        if (mProactiveHintsContainer != null) {
+            BaseDragLayer.LayoutParams params = (BaseDragLayer.LayoutParams) mProactiveHintsContainer.getLayoutParams();
+            params.bottomMargin = getHeight() - outRect.bottom - mChipOverhang;
+            params.width = outRect.width();
+        }
+    }
+
+    @Override
+    public PendingAnimation createTaskLauncherAnimation(TaskView tv, long duration) {
+        PendingAnimation anim = super.createTaskLauncherAnimation(tv, duration);
+
+        if (mProactiveHintsContainer != null) {
+            anim.anim.play(ObjectAnimator.ofFloat(
+                    mProactiveHintsContainer, ProactiveHintsContainer.HINT_VISIBILITY, 0));
+        }
+
+        return anim;
+    }
+
+    @Override
+    public PendingAnimation createTaskDismissAnimation(TaskView taskView, boolean animateTaskView,
+            boolean shouldRemoveTask, long duration) {
+        PendingAnimation anim = super.createTaskDismissAnimation(taskView, animateTaskView,
+                shouldRemoveTask, duration);
+
+        if (mProactiveHintsContainer != null) {
+            anim.anim.play(ObjectAnimator.ofFloat(
+                    mProactiveHintsContainer, ProactiveHintsContainer.HINT_VISIBILITY, 0));
+            anim.addEndListener(onEndListener -> {
+                if (!onEndListener.isSuccess) {
+                    mProactiveHintsContainer.setHintVisibility(1);
+                }
+            });
+        }
+
+        return anim;
+    }
+
+    public void setHintVisibility(float v) {
+        if (mProactiveHintsContainer != null) {
+            mProactiveHintsContainer.setHintVisibility(v);
+        }
     }
 
     @Override
diff --git a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
index 3b75304..7dd4df7 100644
--- a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
+++ b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
@@ -104,16 +104,18 @@
     private static final String CONTROL_REMOTE_APP_TRANSITION_PERMISSION =
             "android.permission.CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS";
 
-    private static final long APP_LAUNCH_DURATION = 500;
+    private static final long APP_LAUNCH_DURATION = 450;
     // Use a shorter duration for x or y translation to create a curve effect
-    private static final long APP_LAUNCH_CURVED_DURATION = APP_LAUNCH_DURATION / 2;
+    private static final long APP_LAUNCH_CURVED_DURATION = 250;
     private static final long APP_LAUNCH_ALPHA_DURATION = 50;
+    private static final long APP_LAUNCH_ALPHA_START_DELAY = 50;
 
     // We scale the durations for the downward app launch animations (minus the scale animation).
     private static final float APP_LAUNCH_DOWN_DUR_SCALE_FACTOR = 0.8f;
     private static final long APP_LAUNCH_DOWN_DURATION =
             (long) (APP_LAUNCH_DURATION * APP_LAUNCH_DOWN_DUR_SCALE_FACTOR);
-    private static final long APP_LAUNCH_DOWN_CURVED_DURATION = APP_LAUNCH_DOWN_DURATION / 2;
+    private static final long APP_LAUNCH_DOWN_CURVED_DURATION =
+            (long) (APP_LAUNCH_CURVED_DURATION * APP_LAUNCH_DOWN_DUR_SCALE_FACTOR);
     private static final long APP_LAUNCH_ALPHA_DOWN_DURATION =
             (long) (APP_LAUNCH_ALPHA_DURATION * APP_LAUNCH_DOWN_DUR_SCALE_FACTOR);
 
@@ -475,17 +477,18 @@
         float shapeRevealDuration = APP_LAUNCH_DURATION * SHAPE_PROGRESS_DURATION;
 
         final float windowRadius = mDeviceProfile.isMultiWindowMode
-                ? 0 :  getWindowCornerRadius(mLauncher.getResources());
-
+                ? 0 : getWindowCornerRadius(mLauncher.getResources());
         appAnimator.addUpdateListener(new MultiValueUpdateListener() {
             FloatProp mDx = new FloatProp(0, dX, 0, xDuration, AGGRESSIVE_EASE);
             FloatProp mDy = new FloatProp(0, dY, 0, yDuration, AGGRESSIVE_EASE);
             FloatProp mIconScale = new FloatProp(initialStartScale, scale, 0, APP_LAUNCH_DURATION,
                     EXAGGERATED_EASE);
-            FloatProp mIconAlpha = new FloatProp(1f, 0f, shapeRevealDuration, alphaDuration,
-                    LINEAR);
+            FloatProp mIconAlpha = new FloatProp(1f, 0f, APP_LAUNCH_ALPHA_START_DELAY,
+                    alphaDuration, LINEAR);
             FloatProp mCropHeight = new FloatProp(windowTargetBounds.width(),
-                    windowTargetBounds.height(), 0, shapeRevealDuration, AGGRESSIVE_EASE);
+                    windowTargetBounds.height(), 0, APP_LAUNCH_DURATION, EXAGGERATED_EASE);
+            FloatProp mWindowRadius = new FloatProp(windowTargetBounds.width() / 2f,
+                    windowRadius, 0, APP_LAUNCH_DURATION, EXAGGERATED_EASE);
 
             @Override
             public void onUpdate(float percent) {
@@ -518,6 +521,7 @@
                 float transX0 = temp.left - offsetX;
                 float transY0 = temp.top - offsetY;
 
+                float croppedHeight = (windowTargetBounds.height() - crop.height()) * scale;
                 SurfaceParams[] params = new SurfaceParams[targets.length];
                 for (int i = targets.length - 1; i >= 0; i--) {
                     RemoteAnimationTargetCompat target = targets[i];
@@ -529,8 +533,9 @@
                         matrix.postTranslate(transX0, transY0);
                         targetCrop = crop;
                         alpha = 1f - mIconAlpha.value;
-                        cornerRadius = windowRadius;
+                        cornerRadius = mWindowRadius.value;
                         matrix.mapRect(currentBounds, targetBounds);
+                        currentBounds.bottom -= croppedHeight;
                         mFloatingView.update(currentBounds, mIconAlpha.value, percent, 0f,
                                 cornerRadius * scale, true /* isOpening */);
                     } else {
diff --git a/res/layout/launcher.xml b/res/layout/launcher.xml
index cca899b..9cab9c2 100644
--- a/res/layout/launcher.xml
+++ b/res/layout/launcher.xml
@@ -48,6 +48,11 @@
             layout="@layout/overview_panel"
             android:visibility="gone" />
 
+        <include
+            android:id="@+id/hints"
+            layout="@layout/proactive_hints_container"
+            android:visibility="gone"/>
+
         <!-- Keep these behind the workspace so that they are not visible when
          we go into AllApps -->
         <com.android.launcher3.pageindicators.WorkspacePageIndicator
diff --git a/res/layout/proactive_hints_container.xml b/res/layout/proactive_hints_container.xml
new file mode 100644
index 0000000..2637f03
--- /dev/null
+++ b/res/layout/proactive_hints_container.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2016 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<Space
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="0dp"
+    android:layout_height="0dp" />
\ No newline at end of file
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 469b176..0da56da 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -235,6 +235,7 @@
 <!-- Hints -->
     <dimen name="chip_hint_height">26dp</dimen>
     <dimen name="chip_hint_bottom_margin">194dp</dimen>
+    <dimen name="chip_hint_overhang">15dp</dimen>
 
 <!-- Theming related -->
     <dimen name="default_dialog_corner_radius">8dp</dimen>
diff --git a/src/com/android/launcher3/anim/FlingSpringAnim.java b/src/com/android/launcher3/anim/FlingSpringAnim.java
index bb0f855..3d981c1 100644
--- a/src/com/android/launcher3/anim/FlingSpringAnim.java
+++ b/src/com/android/launcher3/anim/FlingSpringAnim.java
@@ -30,8 +30,8 @@
     private static final float FLING_FRICTION = 1.5f;
     // Have the spring pull towards the target if we've slowed down too much before reaching it.
     private static final float FLING_END_THRESHOLD_PX = 50f;
-    private static final float SPRING_STIFFNESS = 350f;
-    private static final float SPRING_DAMPING = SpringForce.DAMPING_RATIO_LOW_BOUNCY;
+    private static final float SPRING_STIFFNESS = 200;
+    private static final float SPRING_DAMPING = 0.85f;
 
     private final FlingAnimation mFlingAnim;
     private SpringAnimation mSpringAnim;
diff --git a/src/com/android/launcher3/logging/LoggerUtils.java b/src/com/android/launcher3/logging/LoggerUtils.java
index 1ffa698..9b75b43 100644
--- a/src/com/android/launcher3/logging/LoggerUtils.java
+++ b/src/com/android/launcher3/logging/LoggerUtils.java
@@ -144,6 +144,10 @@
                     + "), pageIdx=" + t.pageIndex;
 
         }
+        if (t.searchQueryLength != 0) {
+            typeStr += ", searchQueryLength=" + t.searchQueryLength;
+        }
+
         if (t.itemType == ItemType.TASK) {
             typeStr += ", pageIdx=" + t.pageIndex;
         }
diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java
index 787c93c..73f11b2 100644
--- a/src/com/android/launcher3/views/FloatingIconView.java
+++ b/src/com/android/launcher3/views/FloatingIconView.java
@@ -98,10 +98,9 @@
     private RectF mPositionOut;
     private Runnable mOnTargetChangeRunnable;
 
+    private final Rect mOutline = new Rect();
     private final Rect mFinalDrawableBounds = new Rect();
     private final Rect mBgDrawableBounds = new Rect();
-    private float mBgDrawableStartScale = 1f;
-    private float mBgDrawableEndScale = 1f;
 
     private AnimatorSet mFadeAnimatorSet;
     private ListenerView mListenerView;
@@ -143,11 +142,10 @@
         setTranslationX(dX);
         setTranslationY(dY);
 
-        float scaleX = rect.width() / (float) lp.width;
-        float scaleY = rect.height() / (float) lp.height;
-        float scale = mIsAdaptiveIcon && !isOpening ? Math.max(scaleX, scaleY)
-                : Math.min(scaleX, scaleY);
-        scale = Math.max(1f, scale);
+        float minSize = Math.min(lp.width, lp.height);
+        float scaleX = rect.width() / minSize;
+        float scaleY = rect.height() / minSize;
+        float scale = Math.max(1f, Math.min(scaleX, scaleY));
 
         setPivotX(0);
         setPivotY(0);
@@ -160,27 +158,27 @@
                 Math.max(shapeProgressStart, progress), shapeProgressStart, 1f, 0, toMax,
                 LINEAR), 0, 1);
 
-        mTaskCornerRadius = cornerRadius;
-        if (mIsAdaptiveIcon && shapeRevealProgress >= 0) {
-            if (mRevealAnimator == null) {
-                mRevealAnimator = (ValueAnimator) IconShape.getShape().createRevealAnimator(this,
-                        mStartRevealRect, mEndRevealRect, mTaskCornerRadius / scale, !isOpening);
-                mRevealAnimator.addListener(new AnimatorListenerAdapter() {
-                    @Override
-                    public void onAnimationEnd(Animator animation) {
-                        mRevealAnimator = null;
-                    }
-                });
-                mRevealAnimator.start();
-                // We pause here so we can set the current fraction ourselves.
-                mRevealAnimator.pause();
+        mOutline.bottom = (int) (rect.height() / scale);
+        mTaskCornerRadius = cornerRadius / scale;
+        if (mIsAdaptiveIcon) {
+            if (!isOpening && shapeRevealProgress >= 0) {
+                if (mRevealAnimator == null) {
+                    mRevealAnimator = (ValueAnimator) IconShape.getShape().createRevealAnimator(
+                            this, mStartRevealRect, mOutline, mTaskCornerRadius, !isOpening);
+                    mRevealAnimator.addListener(new AnimatorListenerAdapter() {
+                        @Override
+                        public void onAnimationEnd(Animator animation) {
+                            mRevealAnimator = null;
+                        }
+                    });
+                    mRevealAnimator.start();
+                    // We pause here so we can set the current fraction ourselves.
+                    mRevealAnimator.pause();
+                }
+                mRevealAnimator.setCurrentFraction(shapeRevealProgress);
             }
 
-            mRevealAnimator.setCurrentFraction(shapeRevealProgress);
-
-            float bgScale = (mBgDrawableEndScale * shapeRevealProgress) + mBgDrawableStartScale
-                    * (1 - shapeRevealProgress);
-            setBackgroundDrawableBounds(bgScale);
+            setBackgroundDrawableBounds(mOutline.height() / minSize);
         }
         invalidate();
         invalidateOutline();
@@ -363,24 +361,22 @@
                 layout(lp.leftMargin, lp.topMargin, lp.leftMargin + lp.width, lp.topMargin
                         + lp.height);
 
-                Rect rectOutline = new Rect();
                 float scale = Math.max((float) lp.height / originalHeight,
                         (float) lp.width / originalWidth);
+                float bgDrawableStartScale;
                 if (isOpening) {
-                    mBgDrawableStartScale = 1f;
-                    mBgDrawableEndScale = scale;
-                    rectOutline.set(0, 0, originalWidth, originalHeight);
+                    bgDrawableStartScale = 1f;
+                    mOutline.set(0, 0, originalWidth, originalHeight);
                 } else {
-                    mBgDrawableStartScale = scale;
-                    mBgDrawableEndScale = 1f;
-                    rectOutline.set(0, 0, lp.width, lp.height);
+                    bgDrawableStartScale = scale;
+                    mOutline.set(0, 0, lp.width, lp.height);
                 }
+                setBackgroundDrawableBounds(bgDrawableStartScale);
                 mEndRevealRect.set(0, 0, lp.width, lp.height);
-                setBackgroundDrawableBounds(mBgDrawableStartScale);
                 setOutlineProvider(new ViewOutlineProvider() {
                     @Override
                     public void getOutline(View view, Outline outline) {
-                        outline.setRoundRect(rectOutline, mTaskCornerRadius);
+                        outline.setRoundRect(mOutline, mTaskCornerRadius);
                     }
                 });
                 setClipToOutline(true);
@@ -630,5 +626,7 @@
         mListenerView.setListener(null);
         mOriginalIcon = null;
         mOnTargetChangeRunnable = null;
+        mTaskCornerRadius = 0;
+        mOutline.setEmpty();
     }
 }