summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/launcher3/ItemInfo.java3
-rw-r--r--src/com/android/launcher3/popup/SystemShortcut.java1
-rw-r--r--src/com/android/launcher3/util/PackageUserKey.java5
-rw-r--r--src_shortcuts_overrides/com/android/launcher3/shortcuts/DeepShortcutManager.java5
4 files changed, 13 insertions, 1 deletions
diff --git a/src/com/android/launcher3/ItemInfo.java b/src/com/android/launcher3/ItemInfo.java
index 134e11606..3f723d17f 100644
--- a/src/com/android/launcher3/ItemInfo.java
+++ b/src/com/android/launcher3/ItemInfo.java
@@ -22,6 +22,8 @@ import android.content.Intent;
import android.os.Process;
import android.os.UserHandle;
+import androidx.annotation.Nullable;
+
import com.android.launcher3.util.ContentWriter;
/**
@@ -134,6 +136,7 @@ public class ItemInfo {
return null;
}
+ @Nullable
public ComponentName getTargetComponent() {
Intent intent = getIntent();
if (intent != null) {
diff --git a/src/com/android/launcher3/popup/SystemShortcut.java b/src/com/android/launcher3/popup/SystemShortcut.java
index 563f3b3c6..78bd81b46 100644
--- a/src/com/android/launcher3/popup/SystemShortcut.java
+++ b/src/com/android/launcher3/popup/SystemShortcut.java
@@ -131,6 +131,7 @@ public abstract class SystemShortcut<T extends BaseDraggingActivity> extends Ite
@Override
public View.OnClickListener getOnClickListener(final Launcher launcher,
final ItemInfo itemInfo) {
+ if (itemInfo.getTargetComponent() == null) return null;
final List<WidgetItem> widgets =
launcher.getPopupDataProvider().getWidgetsForPackageUser(new PackageUserKey(
itemInfo.getTargetComponent().getPackageName(), itemInfo.user));
diff --git a/src/com/android/launcher3/util/PackageUserKey.java b/src/com/android/launcher3/util/PackageUserKey.java
index e62451758..8dc45f547 100644
--- a/src/com/android/launcher3/util/PackageUserKey.java
+++ b/src/com/android/launcher3/util/PackageUserKey.java
@@ -3,6 +3,8 @@ package com.android.launcher3.util;
import android.os.UserHandle;
import android.service.notification.StatusBarNotification;
+import androidx.annotation.Nullable;
+
import com.android.launcher3.ItemInfo;
import com.android.launcher3.shortcuts.DeepShortcutManager;
@@ -15,7 +17,9 @@ public class PackageUserKey {
public UserHandle mUser;
private int mHashCode;
+ @Nullable
public static PackageUserKey fromItemInfo(ItemInfo info) {
+ if (info.getTargetComponent() == null) return null;
return new PackageUserKey(info.getTargetComponent().getPackageName(), info.user);
}
@@ -38,6 +42,7 @@ public class PackageUserKey {
* @return Whether this PackageUserKey was successfully updated - it shouldn't be used if not.
*/
public boolean updateFromItemInfo(ItemInfo info) {
+ if (info.getTargetComponent() == null) return false;
if (ShortcutUtil.supportsShortcuts(info)) {
update(info.getTargetComponent().getPackageName(), info.user);
return true;
diff --git a/src_shortcuts_overrides/com/android/launcher3/shortcuts/DeepShortcutManager.java b/src_shortcuts_overrides/com/android/launcher3/shortcuts/DeepShortcutManager.java
index 7119aeadf..09b189049 100644
--- a/src_shortcuts_overrides/com/android/launcher3/shortcuts/DeepShortcutManager.java
+++ b/src_shortcuts_overrides/com/android/launcher3/shortcuts/DeepShortcutManager.java
@@ -27,6 +27,8 @@ import android.os.Bundle;
import android.os.UserHandle;
import android.util.Log;
+import androidx.annotation.Nullable;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -78,8 +80,9 @@ public class DeepShortcutManager {
* Gets all the manifest and dynamic shortcuts associated with the given package and user,
* to be displayed in the shortcuts container on long press.
*/
- public List<ShortcutInfo> queryForShortcutsContainer(ComponentName activity,
+ public List<ShortcutInfo> queryForShortcutsContainer(@Nullable ComponentName activity,
UserHandle user) {
+ if (activity == null) return Collections.EMPTY_LIST;
return query(ShortcutQuery.FLAG_MATCH_MANIFEST | ShortcutQuery.FLAG_MATCH_DYNAMIC,
activity.getPackageName(), activity, null, user);
}