From 338ce5db92a3385dff37d03a70c037a76b06f5cd Mon Sep 17 00:00:00 2001 From: Danning Chen Date: Tue, 28 Apr 2020 17:40:21 -0700 Subject: [PATCH] Query with the flag FLAG_MATCH_PINNED_BY_ANY_LAUNCHER for notification's shortcuts This change is to make sure the pinned-only shortcuts are cached when the associated notifications are posted. Change-Id: I30b104bd07a8c54e0efca236b855b9f7df2c51f8 Test: Manual test Bug: 154663170 --- .../java/com/android/server/notification/ShortcutHelper.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/notification/ShortcutHelper.java b/services/core/java/com/android/server/notification/ShortcutHelper.java index 96da649350b04..2e4cfaeb0fb6d 100644 --- a/services/core/java/com/android/server/notification/ShortcutHelper.java +++ b/services/core/java/com/android/server/notification/ShortcutHelper.java @@ -18,7 +18,7 @@ package com.android.server.notification; import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_CACHED; import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_DYNAMIC; -import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_PINNED; +import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_PINNED_BY_ANY_LAUNCHER; import android.annotation.NonNull; import android.content.IntentFilter; @@ -171,7 +171,8 @@ public class ShortcutHelper { LauncherApps.ShortcutQuery query = new LauncherApps.ShortcutQuery(); query.setPackage(packageName); query.setShortcutIds(Arrays.asList(shortcutId)); - query.setQueryFlags(FLAG_MATCH_DYNAMIC | FLAG_MATCH_PINNED | FLAG_MATCH_CACHED); + query.setQueryFlags( + FLAG_MATCH_DYNAMIC | FLAG_MATCH_PINNED_BY_ANY_LAUNCHER | FLAG_MATCH_CACHED); List shortcuts = mLauncherAppsService.getShortcuts(query, user); ShortcutInfo info = shortcuts != null && shortcuts.size() > 0 ? shortcuts.get(0)