Loading services/people/java/com/android/server/people/data/ConversationInfo.java +8 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,11 @@ 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 this conversation is marked as important by the user. */ public boolean isImportant() { return hasConversationFlags(FLAG_IMPORTANT); Loading Loading @@ -213,6 +218,9 @@ public class ConversationInfo { if (isShortcutLongLived()) { sb.append("Liv"); } if (isShortcutCached()) { sb.append("Cac"); } sb.append("]"); sb.append(", conversationFlags=0x").append(Integer.toHexString(mConversationFlags)); sb.append(" ["); Loading services/people/java/com/android/server/people/data/DataManager.java +9 −1 Original line number Diff line number Diff line Loading @@ -696,7 +696,15 @@ public class DataManager { break; } conversationStore.addOrUpdate(builder.build()); // TODO: Cache the shortcut when a conversation's notification setting is changed. if (modificationType == NOTIFICATION_CHANNEL_OR_GROUP_UPDATED && conversationInfo.isShortcutLongLived() && !conversationInfo.isShortcutCached()) { mShortcutServiceInternal.cacheShortcuts(user.getIdentifier(), mContext.getPackageName(), pkg, Collections.singletonList(conversationInfo.getShortcutId()), user.getIdentifier()); } } } Loading services/tests/servicestests/src/com/android/server/people/data/ConversationInfoTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ public final class ConversationInfoTest { .setContactUri(CONTACT_URI) .setContactPhoneNumber(PHONE_NUMBER) .setNotificationChannelId(NOTIFICATION_CHANNEL_ID) .setShortcutFlags(ShortcutInfo.FLAG_LONG_LIVED) .setShortcutFlags(ShortcutInfo.FLAG_LONG_LIVED | ShortcutInfo.FLAG_CACHED) .setImportant(true) .setNotificationSilenced(true) .setBubbled(true) Loading @@ -62,6 +62,7 @@ public final class ConversationInfoTest { assertEquals(PHONE_NUMBER, conversationInfo.getContactPhoneNumber()); assertEquals(NOTIFICATION_CHANNEL_ID, conversationInfo.getNotificationChannelId()); assertTrue(conversationInfo.isShortcutLongLived()); assertTrue(conversationInfo.isShortcutCached()); assertTrue(conversationInfo.isImportant()); assertTrue(conversationInfo.isNotificationSilenced()); assertTrue(conversationInfo.isBubbled()); Loading @@ -83,6 +84,7 @@ public final class ConversationInfoTest { assertNull(conversationInfo.getContactPhoneNumber()); assertNull(conversationInfo.getNotificationChannelId()); assertFalse(conversationInfo.isShortcutLongLived()); assertFalse(conversationInfo.isShortcutCached()); assertFalse(conversationInfo.isImportant()); assertFalse(conversationInfo.isNotificationSilenced()); assertFalse(conversationInfo.isBubbled()); Loading services/tests/servicestests/src/com/android/server/people/data/DataManagerTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -416,6 +416,9 @@ public final class DataManagerTest { assertTrue(conversationInfo.isImportant()); assertFalse(conversationInfo.isNotificationSilenced()); assertFalse(conversationInfo.isDemoted()); verify(mShortcutServiceInternal).cacheShortcuts( anyInt(), any(), eq(TEST_PKG_NAME), eq(Collections.singletonList(TEST_SHORTCUT_ID)), eq(USER_ID_PRIMARY)); } @Test Loading Loading @@ -612,6 +615,7 @@ public final class DataManagerTest { when(mockContext.getUser()).thenReturn(UserHandle.of(userId)); ShortcutInfo.Builder builder = new ShortcutInfo.Builder(mockContext, id) .setShortLabel(id) .setLongLived(true) .setIntent(new Intent("TestIntent")); if (person != null) { builder.setPersons(new Person[] {person}); Loading Loading
services/people/java/com/android/server/people/data/ConversationInfo.java +8 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,11 @@ 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 this conversation is marked as important by the user. */ public boolean isImportant() { return hasConversationFlags(FLAG_IMPORTANT); Loading Loading @@ -213,6 +218,9 @@ public class ConversationInfo { if (isShortcutLongLived()) { sb.append("Liv"); } if (isShortcutCached()) { sb.append("Cac"); } sb.append("]"); sb.append(", conversationFlags=0x").append(Integer.toHexString(mConversationFlags)); sb.append(" ["); Loading
services/people/java/com/android/server/people/data/DataManager.java +9 −1 Original line number Diff line number Diff line Loading @@ -696,7 +696,15 @@ public class DataManager { break; } conversationStore.addOrUpdate(builder.build()); // TODO: Cache the shortcut when a conversation's notification setting is changed. if (modificationType == NOTIFICATION_CHANNEL_OR_GROUP_UPDATED && conversationInfo.isShortcutLongLived() && !conversationInfo.isShortcutCached()) { mShortcutServiceInternal.cacheShortcuts(user.getIdentifier(), mContext.getPackageName(), pkg, Collections.singletonList(conversationInfo.getShortcutId()), user.getIdentifier()); } } } Loading
services/tests/servicestests/src/com/android/server/people/data/ConversationInfoTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ public final class ConversationInfoTest { .setContactUri(CONTACT_URI) .setContactPhoneNumber(PHONE_NUMBER) .setNotificationChannelId(NOTIFICATION_CHANNEL_ID) .setShortcutFlags(ShortcutInfo.FLAG_LONG_LIVED) .setShortcutFlags(ShortcutInfo.FLAG_LONG_LIVED | ShortcutInfo.FLAG_CACHED) .setImportant(true) .setNotificationSilenced(true) .setBubbled(true) Loading @@ -62,6 +62,7 @@ public final class ConversationInfoTest { assertEquals(PHONE_NUMBER, conversationInfo.getContactPhoneNumber()); assertEquals(NOTIFICATION_CHANNEL_ID, conversationInfo.getNotificationChannelId()); assertTrue(conversationInfo.isShortcutLongLived()); assertTrue(conversationInfo.isShortcutCached()); assertTrue(conversationInfo.isImportant()); assertTrue(conversationInfo.isNotificationSilenced()); assertTrue(conversationInfo.isBubbled()); Loading @@ -83,6 +84,7 @@ public final class ConversationInfoTest { assertNull(conversationInfo.getContactPhoneNumber()); assertNull(conversationInfo.getNotificationChannelId()); assertFalse(conversationInfo.isShortcutLongLived()); assertFalse(conversationInfo.isShortcutCached()); assertFalse(conversationInfo.isImportant()); assertFalse(conversationInfo.isNotificationSilenced()); assertFalse(conversationInfo.isBubbled()); Loading
services/tests/servicestests/src/com/android/server/people/data/DataManagerTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -416,6 +416,9 @@ public final class DataManagerTest { assertTrue(conversationInfo.isImportant()); assertFalse(conversationInfo.isNotificationSilenced()); assertFalse(conversationInfo.isDemoted()); verify(mShortcutServiceInternal).cacheShortcuts( anyInt(), any(), eq(TEST_PKG_NAME), eq(Collections.singletonList(TEST_SHORTCUT_ID)), eq(USER_ID_PRIMARY)); } @Test Loading Loading @@ -612,6 +615,7 @@ public final class DataManagerTest { when(mockContext.getUser()).thenReturn(UserHandle.of(userId)); ShortcutInfo.Builder builder = new ShortcutInfo.Builder(mockContext, id) .setShortLabel(id) .setLongLived(true) .setIntent(new Intent("TestIntent")); if (person != null) { builder.setPersons(new Person[] {person}); Loading