From d11fa28df9d7718ab78ba815cdbc8fafc075bb0b Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Fri, 17 Jan 2020 15:51:36 -0800 Subject: [PATCH] Fix regression where ShortcutRequest returns no results There was a subtle bug introduced by ag/9898176 where we now accept String... shortcutIds. There are a couple calls that don't pass any id's, which means the shortcut query is doomed to return an empty list. Instead, we should pass null to match all shortcuts for that package. Bug: 147831521 Change-Id: I928b6ed23b7e0ad01d95749cabf88ada053bcdd3 --- .../android/launcher3/shortcuts/ShortcutRequest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/com/android/launcher3/shortcuts/ShortcutRequest.java b/src/com/android/launcher3/shortcuts/ShortcutRequest.java index e6203b45a3..5291ce4620 100644 --- a/src/com/android/launcher3/shortcuts/ShortcutRequest.java +++ b/src/com/android/launcher3/shortcuts/ShortcutRequest.java @@ -58,10 +58,20 @@ public class ShortcutRequest { mUserHandle = userHandle; } + /** @see #forPackage(String, List) */ + public ShortcutRequest forPackage(String packageName) { + return forPackage(packageName, (List) null); + } + + /** @see #forPackage(String, List) */ public ShortcutRequest forPackage(String packageName, String... shortcutIds) { return forPackage(packageName, Arrays.asList(shortcutIds)); } + /** + * @param shortcutIds If null, match all shortcuts, otherwise only match the given id's. + * @return A list of ShortcutInfo's associated with the given package. + */ public ShortcutRequest forPackage(String packageName, @Nullable List shortcutIds) { if (!GO_DISABLE_WIDGETS && packageName != null) { mQuery.setPackage(packageName);