Merge "[People Service] Fix issue in AOSP people service where setupUser
in the People DataManager is stuck" into tm-qpr-dev am: 971c479068
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20833226 Change-Id: I86b80cd9f23b616f3b50c7eb950d7f948a00d855 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
83c369002a
@ -424,6 +424,7 @@ public class ConversationInfo {
|
||||
case (int) ConversationInfoProto.CREATION_TIMESTAMP:
|
||||
builder.setCreationTimestamp(protoInputStream.readLong(
|
||||
ConversationInfoProto.CREATION_TIMESTAMP));
|
||||
break;
|
||||
case (int) ConversationInfoProto.SHORTCUT_FLAGS:
|
||||
builder.setShortcutFlags(protoInputStream.readInt(
|
||||
ConversationInfoProto.SHORTCUT_FLAGS));
|
||||
|
@ -30,6 +30,8 @@ import android.app.people.ConversationStatus;
|
||||
import android.content.LocusId;
|
||||
import android.content.pm.ShortcutInfo;
|
||||
import android.net.Uri;
|
||||
import android.util.proto.ProtoInputStream;
|
||||
import android.util.proto.ProtoOutputStream;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@ -270,4 +272,58 @@ public final class ConversationInfoTest {
|
||||
assertTrue(conversationInfoFromBackup.isContactStarred());
|
||||
// ConversationStatus is a transient object and not persisted
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBuildFromProtoPayload() throws Exception {
|
||||
ConversationStatus cs = new ConversationStatus.Builder("id", ACTIVITY_ANNIVERSARY).build();
|
||||
ConversationStatus cs2 = new ConversationStatus.Builder("id2", ACTIVITY_GAME).build();
|
||||
|
||||
ConversationInfo conversationInfo = new ConversationInfo.Builder()
|
||||
.setShortcutId(SHORTCUT_ID)
|
||||
.setLocusId(LOCUS_ID)
|
||||
.setContactUri(CONTACT_URI)
|
||||
.setContactPhoneNumber(PHONE_NUMBER)
|
||||
.setNotificationChannelId(NOTIFICATION_CHANNEL_ID)
|
||||
.setParentNotificationChannelId(PARENT_NOTIFICATION_CHANNEL_ID)
|
||||
.setLastEventTimestamp(100L)
|
||||
.setCreationTimestamp(200L)
|
||||
.setShortcutFlags(ShortcutInfo.FLAG_LONG_LIVED
|
||||
| ShortcutInfo.FLAG_CACHED_NOTIFICATIONS)
|
||||
.setImportant(true)
|
||||
.setNotificationSilenced(true)
|
||||
.setBubbled(true)
|
||||
.setDemoted(true)
|
||||
.setPersonImportant(true)
|
||||
.setPersonBot(true)
|
||||
.setContactStarred(true)
|
||||
.addOrUpdateStatus(cs)
|
||||
.addOrUpdateStatus(cs2)
|
||||
.build();
|
||||
|
||||
final ProtoOutputStream protoOutputStream = new ProtoOutputStream();
|
||||
conversationInfo.writeToProto(protoOutputStream);
|
||||
ConversationInfo conversationInfoFromBackup =
|
||||
ConversationInfo.readFromProto(new ProtoInputStream(protoOutputStream.getBytes()));
|
||||
|
||||
assertEquals(SHORTCUT_ID, conversationInfoFromBackup.getShortcutId());
|
||||
assertEquals(LOCUS_ID, conversationInfoFromBackup.getLocusId());
|
||||
assertEquals(CONTACT_URI, conversationInfoFromBackup.getContactUri());
|
||||
assertEquals(PHONE_NUMBER, conversationInfoFromBackup.getContactPhoneNumber());
|
||||
assertEquals(
|
||||
NOTIFICATION_CHANNEL_ID, conversationInfoFromBackup.getNotificationChannelId());
|
||||
assertEquals(PARENT_NOTIFICATION_CHANNEL_ID,
|
||||
conversationInfoFromBackup.getParentNotificationChannelId());
|
||||
assertEquals(100L, conversationInfoFromBackup.getLastEventTimestamp());
|
||||
assertEquals(200L, conversationInfoFromBackup.getCreationTimestamp());
|
||||
assertTrue(conversationInfoFromBackup.isShortcutLongLived());
|
||||
assertTrue(conversationInfoFromBackup.isShortcutCachedForNotification());
|
||||
assertTrue(conversationInfoFromBackup.isImportant());
|
||||
assertTrue(conversationInfoFromBackup.isNotificationSilenced());
|
||||
assertTrue(conversationInfoFromBackup.isBubbled());
|
||||
assertTrue(conversationInfoFromBackup.isDemoted());
|
||||
assertTrue(conversationInfoFromBackup.isPersonImportant());
|
||||
assertTrue(conversationInfoFromBackup.isPersonBot());
|
||||
assertTrue(conversationInfoFromBackup.isContactStarred());
|
||||
// ConversationStatus is a transient object and not persisted
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user