Merge "Add a field to BubbleInfo to indicate whether a bubble is important." into udc-dev

This commit is contained in:
Liran Binyamin
2023-05-09 18:02:52 +00:00
committed by Android (Google) Code Review
3 changed files with 16 additions and 5 deletions

View File

@@ -301,7 +301,8 @@ public class Bubble implements BubbleViewProvider {
getIcon(), getIcon(),
getUser().getIdentifier(), getUser().getIdentifier(),
getPackageName(), getPackageName(),
getTitle()); getTitle(),
isImportantConversation());
} }
@Override @Override

View File

@@ -30,8 +30,6 @@ import java.util.Objects;
*/ */
public class BubbleInfo implements Parcelable { public class BubbleInfo implements Parcelable {
// TODO(b/269671451): needs whether the bubble is an 'important person' or not
private String mKey; // Same key as the Notification private String mKey; // Same key as the Notification
private int mFlags; // Flags from BubbleMetadata private int mFlags; // Flags from BubbleMetadata
@Nullable @Nullable
@@ -47,9 +45,11 @@ public class BubbleInfo implements Parcelable {
private Icon mIcon; private Icon mIcon;
@Nullable @Nullable
private String mTitle; private String mTitle;
private boolean mIsImportantConversation;
public BubbleInfo(String key, int flags, @Nullable String shortcutId, @Nullable Icon icon, public BubbleInfo(String key, int flags, @Nullable String shortcutId, @Nullable Icon icon,
int userId, String packageName, @Nullable String title) { int userId, String packageName, @Nullable String title,
boolean isImportantConversation) {
mKey = key; mKey = key;
mFlags = flags; mFlags = flags;
mShortcutId = shortcutId; mShortcutId = shortcutId;
@@ -57,6 +57,7 @@ public class BubbleInfo implements Parcelable {
mUserId = userId; mUserId = userId;
mPackageName = packageName; mPackageName = packageName;
mTitle = title; mTitle = title;
mIsImportantConversation = isImportantConversation;
} }
private BubbleInfo(Parcel source) { private BubbleInfo(Parcel source) {
@@ -67,6 +68,7 @@ public class BubbleInfo implements Parcelable {
mUserId = source.readInt(); mUserId = source.readInt();
mPackageName = source.readString(); mPackageName = source.readString();
mTitle = source.readString(); mTitle = source.readString();
mIsImportantConversation = source.readBoolean();
} }
public String getKey() { public String getKey() {
@@ -100,6 +102,10 @@ public class BubbleInfo implements Parcelable {
return mTitle; return mTitle;
} }
public boolean isImportantConversation() {
return mIsImportantConversation;
}
/** /**
* Whether this bubble is currently being hidden from the stack. * Whether this bubble is currently being hidden from the stack.
*/ */
@@ -150,6 +156,7 @@ public class BubbleInfo implements Parcelable {
parcel.writeInt(mUserId); parcel.writeInt(mUserId);
parcel.writeString(mPackageName); parcel.writeString(mPackageName);
parcel.writeString(mTitle); parcel.writeString(mTitle);
parcel.writeBoolean(mIsImportantConversation);
} }
@NonNull @NonNull

View File

@@ -31,7 +31,8 @@ class BubbleInfoTest : ShellTestCase() {
@Test @Test
fun bubbleInfo() { fun bubbleInfo() {
val bubbleInfo = BubbleInfo("key", 0, "shortcut id", null, 6, "com.some.package", "title") val bubbleInfo =
BubbleInfo("key", 0, "shortcut id", null, 6, "com.some.package", "title", true)
val parcel = Parcel.obtain() val parcel = Parcel.obtain()
bubbleInfo.writeToParcel(parcel, PARCELABLE_WRITE_RETURN_VALUE) bubbleInfo.writeToParcel(parcel, PARCELABLE_WRITE_RETURN_VALUE)
parcel.setDataPosition(0) parcel.setDataPosition(0)
@@ -45,5 +46,7 @@ class BubbleInfoTest : ShellTestCase() {
assertThat(bubbleInfo.userId).isEqualTo(bubbleInfoFromParcel.userId) assertThat(bubbleInfo.userId).isEqualTo(bubbleInfoFromParcel.userId)
assertThat(bubbleInfo.packageName).isEqualTo(bubbleInfoFromParcel.packageName) assertThat(bubbleInfo.packageName).isEqualTo(bubbleInfoFromParcel.packageName)
assertThat(bubbleInfo.title).isEqualTo(bubbleInfoFromParcel.title) assertThat(bubbleInfo.title).isEqualTo(bubbleInfoFromParcel.title)
assertThat(bubbleInfo.isImportantConversation)
.isEqualTo(bubbleInfoFromParcel.isImportantConversation)
} }
} }