Merge "Import translations. DO NOT MERGE ANYWHERE" into tm-qpr-dev
diff --git a/protos/launcher_atom.proto b/protos/launcher_atom.proto
index 151ec5a..677c992 100644
--- a/protos/launcher_atom.proto
+++ b/protos/launcher_atom.proto
@@ -130,7 +130,7 @@
   optional int32 cardinality = 2;
 }
 
-// Next value 40
+// Next value 41
 enum Attribute {
   UNKNOWN = 0;
   DEFAULT_LAYOUT = 1;       // icon automatically placed in workspace, folder, hotseat
@@ -186,6 +186,7 @@
   WEB_SEARCH_RESULT_PERSONAL = 36;
   WEB_SEARCH_RESULT_CALCULATOR = 37;
   WEB_SEARCH_RESULT_URL = 38;
+  WEB_SEARCH_RESULT_RICH_ANSWER = 40;
 
   WIDGETS_BOTTOM_TRAY = 28;
   WIDGETS_TRAY_PREDICTION = 29;
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
index e944480..87e2ab9 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
@@ -270,14 +270,13 @@
     }
 
     private void updateIconSize(Resources resources) {
-        float taskbarIconSize = resources.getDimension(DisplayController.isTransientTaskbar(this)
-                ? mDeviceProfile.isTwoPanels
-                        ? R.dimen.transient_taskbar_two_panels_icon_size
-                        : R.dimen.transient_taskbar_icon_size
-                : R.dimen.taskbar_icon_size);
-        mDeviceProfile.updateIconSize(1, resources);
-        float iconScale = taskbarIconSize / mDeviceProfile.iconSizePx;
-        mDeviceProfile.updateIconSize(iconScale, resources);
+        mDeviceProfile.iconSizePx = resources.getDimensionPixelSize(
+                DisplayController.isTransientTaskbar(this)
+                    ? mDeviceProfile.isTwoPanels
+                            ? R.dimen.transient_taskbar_two_panels_icon_size
+                            : R.dimen.transient_taskbar_icon_size
+                    : R.dimen.taskbar_icon_size);
+        mDeviceProfile.updateIconSize(1f, resources);
     }
 
     /**
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
index b58b6b5..168c353 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
@@ -428,8 +428,8 @@
     }
 
     public void onRotationChanged(DeviceProfile deviceProfile) {
-        if (mControllers.taskbarStashController.isInApp()) {
-            // We only translate on rotation when on home
+        if (!mControllers.uiController.isIconAlignedWithHotseat()) {
+            // We only translate on rotation when icon is aligned with hotseat
             return;
         }
         mActivity.setTaskbarWindowHeight(
diff --git a/quickstep/src/com/android/quickstep/views/FloatingTaskView.java b/quickstep/src/com/android/quickstep/views/FloatingTaskView.java
index 1d421b2..75a8ea2 100644
--- a/quickstep/src/com/android/quickstep/views/FloatingTaskView.java
+++ b/quickstep/src/com/android/quickstep/views/FloatingTaskView.java
@@ -28,6 +28,7 @@
 import com.android.launcher3.Utilities;
 import com.android.launcher3.anim.PendingAnimation;
 import com.android.launcher3.statemanager.StatefulActivity;
+import com.android.launcher3.taskbar.TaskbarActivityContext;
 import com.android.launcher3.touch.PagedOrientationHandler;
 import com.android.launcher3.util.SplitConfigurationOptions;
 import com.android.launcher3.views.BaseDragLayer;
@@ -85,6 +86,7 @@
     private PagedOrientationHandler mOrientationHandler;
     @SplitConfigurationOptions.StagePosition
     private int mStagePosition;
+    private final Rect mTmpRect = new Rect();
 
     public FloatingTaskView(Context context) {
         this(context, null);
@@ -158,10 +160,24 @@
     }
 
     public void updateInitialPositionForView(View originalView) {
-        Rect viewBounds = new Rect(0, 0, originalView.getWidth(), originalView.getHeight());
-        Utilities.getBoundsForViewInDragLayer(mActivity.getDragLayer(), originalView, viewBounds,
-                false /* ignoreTransform */, null /* recycle */,
-                mStartingPosition);
+        if (originalView.getContext() instanceof TaskbarActivityContext) {
+            // If original View is a button on the Taskbar, find the on-screen bounds and calculate
+            // the equivalent bounds in the DragLayer, so we can set the initial position of
+            // this FloatingTaskView and start the split animation at the correct spot.
+            originalView.getBoundsOnScreen(mTmpRect);
+            mStartingPosition.set(mTmpRect);
+            int[] dragLayerPositionRelativeToScreen =
+                    mActivity.getDragLayer().getLocationOnScreen();
+            mStartingPosition.offset(
+                    -dragLayerPositionRelativeToScreen[0],
+                    -dragLayerPositionRelativeToScreen[1]);
+        } else {
+            Rect viewBounds = new Rect(0, 0, originalView.getWidth(), originalView.getHeight());
+            Utilities.getBoundsForViewInDragLayer(mActivity.getDragLayer(), originalView,
+                    viewBounds, false /* ignoreTransform */, null /* recycle */,
+                    mStartingPosition);
+        }
+
         final BaseDragLayer.LayoutParams lp = new BaseDragLayer.LayoutParams(
                 Math.round(mStartingPosition.width()),
                 Math.round(mStartingPosition.height()));
diff --git a/res/color-night-v31/widgets_picker_scrim.xml b/res/color-night-v31/widgets_picker_scrim.xml
deleted file mode 100644
index be7010b..0000000
--- a/res/color-night-v31/widgets_picker_scrim.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2021, 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.
-*/
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-  <item android:color="@android:color/system_neutral1_900" android:alpha="0.8" />
-</selector>
diff --git a/res/color-v31/widgets_picker_scrim.xml b/res/color-v31/widgets_picker_scrim.xml
deleted file mode 100644
index 648824a..0000000
--- a/res/color-v31/widgets_picker_scrim.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2021, 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.
-*/
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-  <item android:color="@android:color/system_neutral1_200" android:alpha="0.8" />
-</selector>
diff --git a/res/color/widgets_picker_scrim.xml b/res/color/widgets_picker_scrim.xml
index 1cf97f6..5d51300 100644
--- a/res/color/widgets_picker_scrim.xml
+++ b/res/color/widgets_picker_scrim.xml
@@ -18,5 +18,5 @@
 */
 -->
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:color="#000000" android:alpha="0.32" />
+    <item android:color="#000000" android:alpha="0.65" />
 </selector>
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index fdc52b5..ecfd230 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -2716,6 +2716,7 @@
      */
     void onDragEnter() {
         mDragging = true;
+        mPreviousSolution = null;
     }
 
     /**
@@ -2730,6 +2731,7 @@
         }
 
         // Invalidate the drag data
+        mPreviousSolution = null;
         mDragCell[0] = mDragCell[1] = -1;
         mDragCellSpan[0] = mDragCellSpan[1] = -1;
         mDragOutlineAnims[mDragOutlineCurrent].animateOut();
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index bfde8da..7ccd195 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -817,6 +817,11 @@
      * Returns the amount of extra (or unused) vertical space.
      */
     private int updateAvailableDimensions(Resources res) {
+        float invIconSizeDp = inv.iconSize[mTypeIndex];
+        float invIconTextSizeSp = inv.iconTextSize[mTypeIndex];
+        iconSizePx = Math.max(1, pxFromDp(invIconSizeDp, mMetrics));
+        iconTextSizePx = pxFromSp(invIconTextSizeSp, mMetrics);
+
         updateIconSize(1f, res);
 
         updateWorkspacePadding();
@@ -873,13 +878,7 @@
 
         // Workspace
         final boolean isVerticalLayout = isVerticalBarLayout();
-        float invIconSizeDp = inv.iconSize[mTypeIndex];
-        float invIconTextSizeSp = inv.iconTextSize[mTypeIndex];
-
-        iconSizePx = Math.max(1, pxFromDp(invIconSizeDp, mMetrics));
-        iconTextSizePx = pxFromSp(invIconTextSizeSp, mMetrics);
         iconDrawablePaddingPx = (int) (iconDrawablePaddingOriginalPx * iconScale);
-
         cellLayoutBorderSpacePx = getCellLayoutBorderSpace(inv, scale);
 
         if (isScalableGrid) {
diff --git a/src/com/android/launcher3/allapps/BaseSearchConfig.java b/src/com/android/launcher3/allapps/BaseSearchConfig.java
index 3900954..9f47e8d 100644
--- a/src/com/android/launcher3/allapps/BaseSearchConfig.java
+++ b/src/com/android/launcher3/allapps/BaseSearchConfig.java
@@ -25,11 +25,4 @@
     public boolean isKeyboardSyncEnabled() {
         return false;
     }
-
-    /**
-     * Returns whether IME is enabled on swipe up.
-     */
-    public boolean isImeEnabledOnSwipeUp() {
-        return false;
-    }
 }
diff --git a/src/com/android/launcher3/views/ArrowTipView.java b/src/com/android/launcher3/views/ArrowTipView.java
index 8d16a8d..73c5ad4 100644
--- a/src/com/android/launcher3/views/ArrowTipView.java
+++ b/src/com/android/launcher3/views/ArrowTipView.java
@@ -162,6 +162,7 @@
         params.gravity = gravity;
         params.leftMargin = mArrowMinOffset + grid.getInsets().left;
         params.rightMargin = mArrowMinOffset + grid.getInsets().right;
+        params.width = LayoutParams.MATCH_PARENT;
         LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mArrowView.getLayoutParams();
 
         lp.gravity = gravity;