Snap for 7697873 from 6bad4d88773ce986fcb71c015a349d8945224e31 to sc-v2-release

Change-Id: Icbe899f562c29059b242941ea1c73e34ff29e59e
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index e99835e..aeb10aa 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -1357,22 +1357,23 @@
             }
         }
 
+        int targetPage = -1;
         if (mNextPage == INVALID_PAGE) {
             // Set the current page to the running task, but not if settling on new task.
             if (runningTaskId != -1) {
-                setCurrentPage(indexOfChild(newRunningTaskView));
+                targetPage = indexOfChild(newRunningTaskView);
             } else if (getTaskViewCount() > 0) {
-                setCurrentPage(indexOfChild(getTaskViewAt(0)));
+                targetPage = indexOfChild(getTaskViewAt(0));
             }
         } else if (currentTaskId != -1) {
             currentTaskView = getTaskViewByTaskId(currentTaskId);
             if (currentTaskView != null) {
-                int currentTaskViewIndex = indexOfChild(currentTaskView);
-                if (mCurrentPage != currentTaskViewIndex) {
-                    setCurrentPage(currentTaskViewIndex);
-                }
+                targetPage = indexOfChild(currentTaskView);
             }
         }
+        if (targetPage != -1 && mCurrentPage != targetPage) {
+            setCurrentPage(targetPage);
+        }
 
         if (mIgnoreResetTaskId != -1 &&
                 getTaskViewByTaskId(mIgnoreResetTaskId) != ignoreResetTaskView) {
diff --git a/res/drawable/padded_rounded_action_button.xml b/res/drawable/padded_rounded_action_button.xml
index 6432efd..6863f92 100644
--- a/res/drawable/padded_rounded_action_button.xml
+++ b/res/drawable/padded_rounded_action_button.xml
@@ -14,18 +14,11 @@
   ~ limitations under the License.
   -->
 
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
     <item
+        android:drawable="@drawable/rounded_action_button"
         android:left="@dimen/padded_rounded_button_padding"
         android:top="@dimen/padded_rounded_button_padding"
         android:right="@dimen/padded_rounded_button_padding"
-        android:bottom="@dimen/padded_rounded_button_padding">
-        <shape android:shape="rectangle">
-            <corners android:radius="@dimen/rounded_button_radius" />
-            <stroke android:width="1dp"
-                android:color="?androidprv:attr/colorAccentPrimaryVariant" />
-        </shape>
-    </item>
+        android:bottom="@dimen/padded_rounded_button_padding" />
 </layer-list>
-
diff --git a/res/drawable/rounded_action_button.xml b/res/drawable/rounded_action_button.xml
index f043893..b9942c0 100644
--- a/res/drawable/rounded_action_button.xml
+++ b/res/drawable/rounded_action_button.xml
@@ -19,7 +19,9 @@
     xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
     android:shape="rectangle">
     <corners android:radius="@dimen/rounded_button_radius" />
-    <stroke android:width="1dp" android:color="@color/all_apps_tab_background_selected" />
+    <stroke
+        android:width="1dp"
+        android:color="?androidprv:attr/colorAccentPrimaryVariant" />
     <padding
         android:left="@dimen/rounded_button_padding"
         android:right="@dimen/rounded_button_padding" />
diff --git a/res/layout/arrow_toast.xml b/res/layout/arrow_toast.xml
index 9a6f8c3..88a92eb 100644
--- a/res/layout/arrow_toast.xml
+++ b/res/layout/arrow_toast.xml
@@ -27,15 +27,13 @@
         android:gravity="center"
         android:padding="16dp"
         android:background="@drawable/arrow_toast_rounded_background"
-        android:elevation="2dp"
-        android:outlineProvider="none"
+        android:elevation="@dimen/arrow_toast_elevation"
         android:textColor="@color/arrow_tip_view_content"
         android:textSize="14sp"/>
 
     <View
         android:id="@+id/arrow"
-        android:elevation="2dp"
-        android:outlineProvider="none"
+        android:elevation="@dimen/arrow_toast_elevation"
         android:layout_width="@dimen/arrow_toast_arrow_width"
         android:layout_height="10dp"/>
 </merge>
diff --git a/res/layout/system_shortcut.xml b/res/layout/system_shortcut.xml
index 89895e5..21d532e 100644
--- a/res/layout/system_shortcut.xml
+++ b/res/layout/system_shortcut.xml
@@ -17,7 +17,8 @@
 <com.android.launcher3.shortcuts.DeepShortcutView
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="@dimen/bg_popup_item_width"
-    android:layout_height="@dimen/bg_popup_item_height"
+    android:layout_height="wrap_content"
+    android:minHeight="@dimen/bg_popup_item_height"
     android:elevation="@dimen/deep_shortcuts_elevation"
     android:background="@drawable/middle_item_primary"
     android:theme="@style/PopupItem" >
diff --git a/res/layout/system_shortcut_content.xml b/res/layout/system_shortcut_content.xml
index 8b39202..3ef0b94 100644
--- a/res/layout/system_shortcut_content.xml
+++ b/res/layout/system_shortcut_content.xml
@@ -22,6 +22,9 @@
         android:id="@+id/bubble_text"
         android:background="?android:attr/selectableItemBackground"
         android:gravity="start|center_vertical"
+        android:paddingTop="@dimen/bg_popup_item_vertical_padding"
+        android:paddingBottom="@dimen/bg_popup_item_vertical_padding"
+        android:minHeight="@dimen/bg_popup_item_height"
         android:textAlignment="viewStart"
         android:paddingStart="@dimen/deep_shortcuts_text_padding_start"
         android:paddingEnd="@dimen/popup_padding_end"
diff --git a/res/layout/work_apps_paused.xml b/res/layout/work_apps_paused.xml
index ec34b47..79bce70 100644
--- a/res/layout/work_apps_paused.xml
+++ b/res/layout/work_apps_paused.xml
@@ -28,7 +28,7 @@
         android:layout_marginTop="40dp"
         android:text="@string/work_apps_paused_title"
         android:textAlignment="center"
-        android:textSize="22sp" />
+        android:textSize="18sp" />
 
     <TextView
         android:layout_width="wrap_content"
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 86b4e71..bb06be8 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -110,6 +110,7 @@
     <dimen name="all_apps_tip_bottom_margin">8dp</dimen>
     <!-- The size of corner radius of the arrow in the arrow toast. -->
     <dimen name="arrow_toast_corner_radius">2dp</dimen>
+    <dimen name="arrow_toast_elevation">2dp</dimen>
     <dimen name="arrow_toast_arrow_width">10dp</dimen>
 
 <!-- Search bar in All Apps -->
@@ -240,6 +241,7 @@
     <dimen name="bg_popup_padding">2dp</dimen>
     <dimen name="bg_popup_item_width">216dp</dimen>
     <dimen name="bg_popup_item_height">56dp</dimen>
+    <dimen name="bg_popup_item_vertical_padding">12dp</dimen>
     <dimen name="pre_drag_view_scale">6dp</dimen>
     <!-- an icon with shortcuts must be dragged this far before the container is removed. -->
     <dimen name="deep_shortcuts_start_drag_threshold">16dp</dimen>
@@ -346,4 +348,5 @@
     <dimen name="search_row_icon_size">48dp</dimen>
     <dimen name="search_row_small_icon_size">32dp</dimen>
     <dimen name="padded_rounded_button_padding">8dp</dimen>
+
 </resources>
diff --git a/src/com/android/launcher3/DropTargetBar.java b/src/com/android/launcher3/DropTargetBar.java
index 88f6c49..eb42a65 100644
--- a/src/com/android/launcher3/DropTargetBar.java
+++ b/src/com/android/launcher3/DropTargetBar.java
@@ -25,6 +25,7 @@
 import android.content.Context;
 import android.graphics.Rect;
 import android.util.AttributeSet;
+import android.util.Log;
 import android.util.TypedValue;
 import android.view.Gravity;
 import android.view.View;
@@ -32,10 +33,13 @@
 import android.view.ViewPropertyAnimator;
 import android.widget.FrameLayout;
 
+import androidx.annotation.NonNull;
+
 import com.android.launcher3.anim.Interpolators;
 import com.android.launcher3.dragndrop.DragController;
 import com.android.launcher3.dragndrop.DragController.DragListener;
 import com.android.launcher3.dragndrop.DragOptions;
+import com.android.launcher3.testing.TestProtocol;
 
 /*
  * The top bar containing various drop targets: Delete/App Info/Uninstall.
@@ -212,6 +216,9 @@
     }
 
     public void animateToVisibility(boolean isVisible) {
+        if (TestProtocol.sDebugTracing) {
+            Log.d(TestProtocol.NO_DROP_TARGET, "8");
+        }
         if (mVisible != isVisible) {
             mVisible = isVisible;
 
@@ -238,6 +245,9 @@
      */
     @Override
     public void onDragStart(DropTarget.DragObject dragObject, DragOptions options) {
+        if (TestProtocol.sDebugTracing) {
+            Log.d(TestProtocol.NO_DROP_TARGET, "7");
+        }
         animateToVisibility(true);
     }
 
@@ -261,4 +271,12 @@
     public ButtonDropTarget[] getDropTargets() {
         return mDropTargets;
     }
+
+    @Override
+    protected void onVisibilityChanged(@NonNull View changedView, int visibility) {
+        super.onVisibilityChanged(changedView, visibility);
+        if (TestProtocol.sDebugTracing && visibility == VISIBLE) {
+            Log.d(TestProtocol.NO_DROP_TARGET, "9");
+        }
+    }
 }
diff --git a/src/com/android/launcher3/dragndrop/DragController.java b/src/com/android/launcher3/dragndrop/DragController.java
index 1e0edac..fdb2799 100644
--- a/src/com/android/launcher3/dragndrop/DragController.java
+++ b/src/com/android/launcher3/dragndrop/DragController.java
@@ -22,6 +22,7 @@
 import android.graphics.Point;
 import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
+import android.util.Log;
 import android.view.DragEvent;
 import android.view.KeyEvent;
 import android.view.MotionEvent;
@@ -34,6 +35,7 @@
 import com.android.launcher3.logging.InstanceId;
 import com.android.launcher3.model.data.ItemInfo;
 import com.android.launcher3.model.data.WorkspaceItemInfo;
+import com.android.launcher3.testing.TestProtocol;
 import com.android.launcher3.util.ItemInfoMatcher;
 import com.android.launcher3.util.TouchController;
 import com.android.launcher3.views.ActivityContext;
@@ -146,6 +148,9 @@
             float initialDragViewScale,
             float dragViewScaleOnDrop,
             DragOptions options) {
+        if (TestProtocol.sDebugTracing) {
+            Log.d(TestProtocol.NO_DROP_TARGET, "4");
+        }
         return startDrag(drawable, /* view= */ null, originalView, dragLayerX, dragLayerY,
                 source, dragInfo, dragOffset, dragRegion, initialDragViewScale, dragViewScaleOnDrop,
                 options);
@@ -203,6 +208,9 @@
             DragOptions options);
 
     protected void callOnDragStart() {
+        if (TestProtocol.sDebugTracing) {
+            Log.d(TestProtocol.NO_DROP_TARGET, "6");
+        }
         if (mOptions.preDragCondition != null) {
             mOptions.preDragCondition.onPreDragEnd(mDragObject, true /* dragStarted*/);
         }
diff --git a/src/com/android/launcher3/dragndrop/LauncherDragController.java b/src/com/android/launcher3/dragndrop/LauncherDragController.java
index 0e8b0a5..dcbfa50 100644
--- a/src/com/android/launcher3/dragndrop/LauncherDragController.java
+++ b/src/com/android/launcher3/dragndrop/LauncherDragController.java
@@ -24,6 +24,7 @@
 import android.graphics.Point;
 import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
+import android.util.Log;
 import android.view.HapticFeedbackConstants;
 import android.view.View;
 
@@ -36,6 +37,7 @@
 import com.android.launcher3.R;
 import com.android.launcher3.accessibility.DragViewStateAnnouncer;
 import com.android.launcher3.model.data.ItemInfo;
+import com.android.launcher3.testing.TestProtocol;
 
 /**
  * Drag controller for Launcher activity
@@ -65,6 +67,9 @@
             float initialDragViewScale,
             float dragViewScaleOnDrop,
             DragOptions options) {
+        if (TestProtocol.sDebugTracing) {
+            Log.d(TestProtocol.NO_DROP_TARGET, "5");
+        }
         if (PROFILE_DRAWING_DURING_DRAG) {
             android.os.Debug.startMethodTracing("Launcher");
         }
diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java
index 42a38b6..ed52e20 100644
--- a/src/com/android/launcher3/testing/TestProtocol.java
+++ b/src/com/android/launcher3/testing/TestProtocol.java
@@ -119,4 +119,5 @@
     public static final String FALLBACK_ACTIVITY_NO_SET = "b/181019015";
     public static final String TASK_VIEW_ID_CRASH = "b/195430732";
     public static final String L3_SWIPE_TO_HOME = "b/192018189";
+    public static final String NO_DROP_TARGET = "b/195031154";
 }
diff --git a/src/com/android/launcher3/widget/BaseWidgetSheet.java b/src/com/android/launcher3/widget/BaseWidgetSheet.java
index b6cec12..00a0050 100644
--- a/src/com/android/launcher3/widget/BaseWidgetSheet.java
+++ b/src/com/android/launcher3/widget/BaseWidgetSheet.java
@@ -19,6 +19,7 @@
 import android.graphics.Point;
 import android.graphics.Rect;
 import android.util.AttributeSet;
+import android.util.Log;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.view.View.OnLongClickListener;
@@ -108,6 +109,9 @@
 
     @Override
     public boolean onLongClick(View v) {
+        if (TestProtocol.sDebugTracing) {
+            Log.d(TestProtocol.NO_DROP_TARGET, "1");
+        }
         TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "Widgets.onLongClick");
         v.cancelLongPress();
         if (!ItemLongClickListener.canStartDrag(mActivityContext)) return false;
@@ -178,6 +182,9 @@
     }
 
     private boolean beginDraggingWidget(WidgetCell v) {
+        if (TestProtocol.sDebugTracing) {
+            Log.d(TestProtocol.NO_DROP_TARGET, "2");
+        }
         // Get the widget preview as the drag representation
         WidgetImageView image = v.getWidgetView();
 
diff --git a/src/com/android/launcher3/widget/PendingItemDragHelper.java b/src/com/android/launcher3/widget/PendingItemDragHelper.java
index 2347d28..463f4ac 100644
--- a/src/com/android/launcher3/widget/PendingItemDragHelper.java
+++ b/src/com/android/launcher3/widget/PendingItemDragHelper.java
@@ -22,6 +22,7 @@
 import android.graphics.Point;
 import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
+import android.util.Log;
 import android.util.Size;
 import android.view.View;
 import android.view.View.MeasureSpec;
@@ -41,6 +42,7 @@
 import com.android.launcher3.icons.FastBitmapDrawable;
 import com.android.launcher3.icons.LauncherIcons;
 import com.android.launcher3.icons.RoundDrawableWrapper;
+import com.android.launcher3.testing.TestProtocol;
 import com.android.launcher3.widget.dragndrop.AppWidgetHostViewDragListener;
 import com.android.launcher3.widget.util.WidgetSizes;
 
@@ -94,6 +96,9 @@
      */
     public void startDrag(Rect previewBounds, int previewBitmapWidth, int previewViewWidth,
             Point screenPos, DragSource source, DragOptions options) {
+        if (TestProtocol.sDebugTracing) {
+            Log.d(TestProtocol.NO_DROP_TARGET, "3");
+        }
         final Launcher launcher = Launcher.getLauncher(mView.getContext());
         LauncherAppState app = LauncherAppState.getInstance(launcher);