summaryrefslogtreecommitdiff
path: root/services/people
diff options
context:
space:
mode:
authorMehdi Alizadeh <mett@google.com>2020-04-27 18:52:52 -0700
committerMehdi Alizadeh <mett@google.com>2020-05-26 03:30:55 +0000
commita3d22cec32a0578c07fdddac0f746865fef30c1f (patch)
tree08417a0cd869458ed0d4333019a491c6c4a4be6e /services/people
parent2cdbcea8ba29bbb8d50511a9fa6e5bd2763fb153 (diff)
Adds cacheFlags parameter to cache/uncacheShortcuts() methods
Bug: 155135890 Test: atest ShortcutManagerTest1 ShortcutManagerTest11 \ ConversationInfoTest DataManagerTest \ NotificationManagerServiceTest Change-Id: Idda777ba032546bd616ee3079b9c8dc8676dc589
Diffstat (limited to 'services/people')
-rw-r--r--services/people/java/com/android/server/people/data/ConversationInfo.java11
-rw-r--r--services/people/java/com/android/server/people/data/DataManager.java12
2 files changed, 13 insertions, 10 deletions
diff --git a/services/people/java/com/android/server/people/data/ConversationInfo.java b/services/people/java/com/android/server/people/data/ConversationInfo.java
index dc3fa2a048f6..17378285276f 100644
--- a/services/people/java/com/android/server/people/data/ConversationInfo.java
+++ b/services/people/java/com/android/server/people/data/ConversationInfo.java
@@ -142,9 +142,12 @@ public class ConversationInfo {
return hasShortcutFlags(ShortcutInfo.FLAG_LONG_LIVED);
}
- /** Whether the shortcut for this conversation is cached in Shortcut Service. */
- public boolean isShortcutCached() {
- return hasShortcutFlags(ShortcutInfo.FLAG_CACHED);
+ /**
+ * Whether the shortcut for this conversation is cached in Shortcut Service, with cache owner
+ * set as notifications.
+ */
+ public boolean isShortcutCachedForNotification() {
+ return hasShortcutFlags(ShortcutInfo.FLAG_CACHED_NOTIFICATIONS);
}
/** Whether this conversation is marked as important by the user. */
@@ -223,7 +226,7 @@ public class ConversationInfo {
if (isShortcutLongLived()) {
sb.append("Liv");
}
- if (isShortcutCached()) {
+ if (isShortcutCachedForNotification()) {
sb.append("Cac");
}
sb.append("]");
diff --git a/services/people/java/com/android/server/people/data/DataManager.java b/services/people/java/com/android/server/people/data/DataManager.java
index bbb0215788fb..63b716206313 100644
--- a/services/people/java/com/android/server/people/data/DataManager.java
+++ b/services/people/java/com/android/server/people/data/DataManager.java
@@ -294,14 +294,14 @@ public class DataManager {
if (notificationListener != null) {
String packageName = packageData.getPackageName();
packageData.forAllConversations(conversationInfo -> {
- if (conversationInfo.isShortcutCached()
+ if (conversationInfo.isShortcutCachedForNotification()
&& conversationInfo.getNotificationChannelId() == null
&& !notificationListener.hasActiveNotifications(
packageName, conversationInfo.getShortcutId())) {
mShortcutServiceInternal.uncacheShortcuts(userId,
mContext.getPackageName(), packageName,
Collections.singletonList(conversationInfo.getShortcutId()),
- userId);
+ userId, ShortcutInfo.FLAG_CACHED_NOTIFICATIONS);
}
});
}
@@ -821,12 +821,12 @@ public class DataManager {
// The shortcut was cached by Notification Manager synchronously when the
// associated notification was posted. Uncache it here when all the
// associated notifications are removed.
- if (conversationInfo.isShortcutCached()
+ if (conversationInfo.isShortcutCachedForNotification()
&& conversationInfo.getNotificationChannelId() == null) {
mShortcutServiceInternal.uncacheShortcuts(mUserId,
mContext.getPackageName(), sbn.getPackageName(),
Collections.singletonList(conversationInfo.getShortcutId()),
- mUserId);
+ mUserId, ShortcutInfo.FLAG_CACHED_NOTIFICATIONS);
}
} else {
mActiveNotifCounts.put(conversationKey, count);
@@ -891,12 +891,12 @@ public class DataManager {
ConversationInfo conversationInfo =
packageData != null ? packageData.getConversationInfo(shortcutId) : null;
if (conversationInfo != null
- && conversationInfo.isShortcutCached()
+ && conversationInfo.isShortcutCachedForNotification()
&& conversationInfo.getNotificationChannelId() == null) {
mShortcutServiceInternal.uncacheShortcuts(mUserId,
mContext.getPackageName(), packageName,
Collections.singletonList(shortcutId),
- mUserId);
+ mUserId, ShortcutInfo.FLAG_CACHED_NOTIFICATIONS);
}
}
}