Merge "Adding suggested app as part of app discovery." into ub-launcher3-dorval-polish
diff --git a/AndroidManifest-common.xml b/AndroidManifest-common.xml
index 50fb2d7..3a60a98 100644
--- a/AndroidManifest-common.xml
+++ b/AndroidManifest-common.xml
@@ -107,5 +107,13 @@
             </intent-filter>
         </activity>
 
+        <!--
+        Should point to the content provider which can be used to dump Launcher3 compatible
+        worspace configuration to the dump's file descriptor by using launcher_dump.proto
+        -->
+        <meta-data
+            android:name="com.android.launcher3.launcher_dump_provider"
+            android:value="com.android.launcher3.LauncherProvider" />
+
     </application>
 </manifest>
diff --git a/res/layout/widgets_bottom_sheet.xml b/res/layout/widgets_bottom_sheet.xml
index 826235b..c2270d2 100644
--- a/res/layout/widgets_bottom_sheet.xml
+++ b/res/layout/widgets_bottom_sheet.xml
@@ -19,7 +19,6 @@
     android:orientation="vertical"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:paddingStart="16dp"
     android:paddingTop="28dp"
     android:background="?android:attr/colorPrimary"
     android:elevation="@dimen/deep_shortcuts_elevation"
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 0d1e9e1..d0c01f4 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -2571,6 +2571,7 @@
         Intent intent = new Intent(Intent.ACTION_APPLICATION_PREFERENCES)
                 .setPackage(getPackageName());
         intent.setSourceBounds(getViewBounds(v));
+        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         startActivity(intent, getActivityLaunchOptions(v));
     }
 
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index c84eecb..ca9f312 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -1049,7 +1049,8 @@
                                     info = c.loadSimpleShortcut();
 
                                     // Shortcuts are only available on the primary profile
-                                    if (pmHelper.isAppSuspended(targetPkg, c.user)) {
+                                    if (!TextUtils.isEmpty(targetPkg)
+                                            && pmHelper.isAppSuspended(targetPkg, c.user)) {
                                         disabledState |= ShortcutInfo.FLAG_DISABLED_SUSPENDED;
                                     }
 
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index 09fb953..bd53b4d 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -741,7 +741,6 @@
                     }
                 }
                 case 2:
-                    removeGhostWidgets(db);
                 case 3:
                     // data updated
                     return;
diff --git a/src/com/android/launcher3/widget/WidgetsBottomSheet.java b/src/com/android/launcher3/widget/WidgetsBottomSheet.java
index a423154..5fe00c2 100644
--- a/src/com/android/launcher3/widget/WidgetsBottomSheet.java
+++ b/src/com/android/launcher3/widget/WidgetsBottomSheet.java
@@ -133,10 +133,19 @@
             }
         }
 
-        // If there is only one widget, we want to center it instead of left-align.
-        WidgetsBottomSheet.LayoutParams params = (WidgetsBottomSheet.LayoutParams)
-                widgetRow.getLayoutParams();
-        params.gravity = widgets.size() == 1 ? Gravity.CENTER_HORIZONTAL : Gravity.START;
+        if (widgets.size() == 1) {
+            // If there is only one widget, we want to center it instead of left-align.
+            WidgetsBottomSheet.LayoutParams params = (WidgetsBottomSheet.LayoutParams)
+                    widgetRow.getLayoutParams();
+            params.gravity = Gravity.CENTER_HORIZONTAL;
+        } else {
+            // Otherwise, add an empty view to the start as padding (but still scroll edge to edge).
+            View leftPaddingView = LayoutInflater.from(getContext()).inflate(
+                    R.layout.widget_list_divider, widgetRow, false);
+            leftPaddingView.getLayoutParams().width = Utilities.pxFromDp(
+                    16, getResources().getDisplayMetrics());
+            widgetCells.addView(leftPaddingView, 0);
+        }
     }
 
     private void addDivider(ViewGroup parent) {