Parse share-targets defined by non-main activities
Some system apps do not have any launcher icons but want to publish
sharing shortcuts. As a fix, all activities are parsed for their XML
resource, which implies some of these shortcut may not hold an
activity. This CL removes that assumption from launcher side.
Bug: 136353429
Test: Manual test
Change-Id: I2994da17fe078b2fab61a614c1326fddd5fd8571
diff --git a/src/com/android/launcher3/model/BgDataModel.java b/src/com/android/launcher3/model/BgDataModel.java
index 32fce0b..fdfcef1 100644
--- a/src/com/android/launcher3/model/BgDataModel.java
+++ b/src/com/android/launcher3/model/BgDataModel.java
@@ -424,7 +424,8 @@
// Now add the new shortcuts to the map.
for (ShortcutInfo shortcut : shortcuts) {
boolean shouldShowInContainer = shortcut.isEnabled()
- && (shortcut.isDeclaredInManifest() || shortcut.isDynamic());
+ && (shortcut.isDeclaredInManifest() || shortcut.isDynamic())
+ && shortcut.getActivity() != null;
if (shouldShowInContainer) {
ComponentKey targetComponent
= new ComponentKey(shortcut.getActivity(), shortcut.getUserHandle());