Fix bug where Files app keeps getting added to the workspace.
Caused by mainline updates where Files app session commit is broadcasted.
Launcher workaround is to not auto-add system apps to the workspace.
Bug: 139663018
Change-Id: Id61532bd0df2cd5f3bdfc28a3616ba5e5ff3d18a
diff --git a/src/com/android/launcher3/model/AddWorkspaceItemsTask.java b/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
index 1b98783..37f28a9 100644
--- a/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
+++ b/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
@@ -76,6 +76,11 @@
if (shortcutExists(dataModel, item.getIntent(), item.user)) {
continue;
}
+
+ // b/139663018 Short-circuit this logic if the icon is a system app
+ if (PackageManagerHelper.isSystemApp(app.getContext(), item.getIntent())) {
+ continue;
+ }
}
if (item.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION) {
diff --git a/src/com/android/launcher3/util/PackageManagerHelper.java b/src/com/android/launcher3/util/PackageManagerHelper.java
index ef4307e..e97adb5 100644
--- a/src/com/android/launcher3/util/PackageManagerHelper.java
+++ b/src/com/android/launcher3/util/PackageManagerHelper.java
@@ -236,6 +236,9 @@
} else {
packageName = cn.getPackageName();
}
+ if (packageName == null) {
+ packageName = intent.getPackage();
+ }
if (packageName != null) {
try {
PackageInfo info = pm.getPackageInfo(packageName, 0);