Merge "Adding more diags for TAPL actions" into sc-v2-dev
diff --git a/res/drawable/rounded_action_button.xml b/res/drawable/rounded_action_button.xml
index 0c8755f..f043893 100644
--- a/res/drawable/rounded_action_button.xml
+++ b/res/drawable/rounded_action_button.xml
@@ -19,7 +19,7 @@
     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="?androidprv:attr/colorAccentPrimaryVariant" />
+    <stroke android:width="1dp" android:color="@color/all_apps_tab_background_selected" />
     <padding
         android:left="@dimen/rounded_button_padding"
         android:right="@dimen/rounded_button_padding" />
diff --git a/res/layout/work_apps_edu.xml b/res/layout/work_apps_edu.xml
index 84fdfdf..2a3d154 100644
--- a/res/layout/work_apps_edu.xml
+++ b/res/layout/work_apps_edu.xml
@@ -16,6 +16,7 @@
 <com.android.launcher3.allapps.WorkEduCard xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
+    android:layout_marginTop="8dp"
     android:gravity="center">
 
     <LinearLayout
diff --git a/res/layout/work_apps_paused.xml b/res/layout/work_apps_paused.xml
index 841734c..ec34b47 100644
--- a/res/layout/work_apps_paused.xml
+++ b/res/layout/work_apps_paused.xml
@@ -49,7 +49,7 @@
         android:text="@string/work_apps_enable_btn_text"
         android:textAlignment="center"
         android:background="@drawable/rounded_action_button"
-        android:paddingStart="8dp"
-        android:paddingEnd="8dp"
+        android:paddingStart="16dp"
+        android:paddingEnd="16dp"
         android:textSize="14sp" />
 </com.android.launcher3.allapps.WorkPausedCard>
\ No newline at end of file
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index a891e65..ef324e0 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -119,7 +119,7 @@
     <dimen name="all_apps_divider_margin_vertical">8dp</dimen>
 
 <!-- Floating action button inside work tab to toggle work profile -->
-    <dimen name="work_fab_height">48dp</dimen>
+    <dimen name="work_fab_height">56dp</dimen>
     <dimen name="work_fab_radius">24dp</dimen>
     <dimen name="work_card_padding_horizontal">24dp</dimen>
     <dimen name="work_card_padding_vertical">32dp</dimen>
@@ -128,7 +128,6 @@
     <dimen name="work_profile_footer_text_size">16sp</dimen>
     <dimen name="work_edu_card_margin">16dp</dimen>
 
-    <!-- rounded button shown inside card views, and snack bars  -->
     <dimen name="rounded_button_height">32dp</dimen>
     <dimen name="rounded_button_radius">16dp</dimen>
     <dimen name="rounded_button_padding">8dp</dimen>
diff --git a/src/com/android/launcher3/model/data/SearchActionItemInfo.java b/src/com/android/launcher3/model/data/SearchActionItemInfo.java
index 7ca283e..b3057d5 100644
--- a/src/com/android/launcher3/model/data/SearchActionItemInfo.java
+++ b/src/com/android/launcher3/model/data/SearchActionItemInfo.java
@@ -25,7 +25,6 @@
 
 import androidx.annotation.Nullable;
 
-import com.android.launcher3.Utilities;
 import com.android.launcher3.logger.LauncherAtom.ItemInfo;
 import com.android.launcher3.logger.LauncherAtom.SearchActionItem;
 
@@ -35,7 +34,6 @@
 public class SearchActionItemInfo extends ItemInfoWithIcon {
 
     public static final int FLAG_SHOULD_START = 1 << 1;
-    @Deprecated
     public static final int FLAG_SHOULD_START_FOR_RESULT = FLAG_SHOULD_START | 1 << 2;
     public static final int FLAG_BADGE_WITH_PACKAGE = 1 << 3;
     public static final int FLAG_PRIMARY_ICON_FROM_TITLE = 1 << 4;
@@ -91,13 +89,10 @@
      * Setter for mIntent with assertion for null value mPendingIntent
      */
     public void setIntent(Intent intent) {
-        if (mPendingIntent != null && intent != null && Utilities.IS_DEBUG_DEVICE) {
+        if (mPendingIntent != null && intent != null) {
             throw new RuntimeException(
                     "SearchActionItemInfo can only have either an Intent or a PendingIntent");
         }
-        if (intent != null) {
-            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        }
         mIntent = intent;
     }
 
@@ -109,7 +104,7 @@
      * Setter of mPendingIntent with assertion for null value mIntent
      */
     public void setPendingIntent(PendingIntent pendingIntent) {
-        if (mIntent != null && pendingIntent != null && Utilities.IS_DEBUG_DEVICE) {
+        if (mIntent != null && pendingIntent != null) {
             throw new RuntimeException(
                     "SearchActionItemInfo can only have either an Intent or a PendingIntent");
         }
diff --git a/src/com/android/launcher3/touch/ItemClickHandler.java b/src/com/android/launcher3/touch/ItemClickHandler.java
index 408ba28..b53f96e 100644
--- a/src/com/android/launcher3/touch/ItemClickHandler.java
+++ b/src/com/android/launcher3/touch/ItemClickHandler.java
@@ -262,12 +262,19 @@
      */
     public static void onClickSearchAction(Launcher launcher, SearchActionItemInfo itemInfo) {
         if (itemInfo.getIntent() != null) {
-            launcher.startActivity(itemInfo.getIntent());
+            if (itemInfo.hasFlags(SearchActionItemInfo.FLAG_SHOULD_START_FOR_RESULT)) {
+                launcher.startActivityForResult(itemInfo.getIntent(), 0);
+            } else {
+                launcher.startActivity(itemInfo.getIntent());
+            }
         } else if (itemInfo.getPendingIntent() != null) {
             try {
                 PendingIntent pendingIntent = itemInfo.getPendingIntent();
                 if (!itemInfo.hasFlags(SearchActionItemInfo.FLAG_SHOULD_START)) {
                     pendingIntent.send();
+                } else if (itemInfo.hasFlags(SearchActionItemInfo.FLAG_SHOULD_START_FOR_RESULT)) {
+                    launcher.startIntentSenderForResult(pendingIntent.getIntentSender(), 0, null, 0,
+                            0, 0);
                 } else {
                     launcher.startIntentSender(pendingIntent.getIntentSender(), null, 0, 0, 0);
                 }