| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.app.people; |
| 18 |
|
| 19 |
import android.annotation.Nullable; |
| 20 |
import android.app.NotificationChannel; |
| 21 |
import android.app.NotificationChannelGroup; |
| 22 |
import android.content.pm.ShortcutInfo; |
| 23 |
import android.os.Parcel; |
| 24 |
import android.os.Parcelable; |
| 25 |
|
| 26 |
import java.util.ArrayList; |
| 27 |
import java.util.List; |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
public final class ConversationChannel implements Parcelable { |
| 36 |
|
| 37 |
private ShortcutInfo mShortcutInfo; |
| 38 |
private int mUid; |
| 39 |
private NotificationChannel mNotificationChannel; |
| 40 |
private NotificationChannelGroup mNotificationChannelGroup; |
| 41 |
private long mLastEventTimestamp; |
| 42 |
private boolean mHasActiveNotifications; |
| 43 |
private boolean mHasBirthdayToday; |
| 44 |
private List<ConversationStatus> mStatuses; |
| 45 |
|
| 46 |
public static final Creator<ConversationChannel> CREATOR = new Creator<ConversationChannel>() { |
| 47 |
@Override |
| 48 |
public ConversationChannel createFromParcel(Parcel in) { |
| 49 |
return new ConversationChannel(in); |
| 50 |
} |
| 51 |
|
| 52 |
@Override |
| 53 |
public ConversationChannel[] newArray(int size) { |
| 54 |
return new ConversationChannel[size]; |
| 55 |
} |
| 56 |
}; |
| 57 |
|
| 58 |
public ConversationChannel(ShortcutInfo shortcutInfo, int uid, |
| 59 |
NotificationChannel parentNotificationChannel, |
| 60 |
NotificationChannelGroup parentNotificationChannelGroup, long lastEventTimestamp, |
| 61 |
boolean hasActiveNotifications) { |
| 62 |
mShortcutInfo = shortcutInfo; |
| 63 |
mUid = uid; |
| 64 |
mNotificationChannel = parentNotificationChannel; |
| 65 |
mNotificationChannelGroup = parentNotificationChannelGroup; |
| 66 |
mLastEventTimestamp = lastEventTimestamp; |
| 67 |
mHasActiveNotifications = hasActiveNotifications; |
| 68 |
} |
| 69 |
|
| 70 |
public ConversationChannel(ShortcutInfo shortcutInfo, int uid, |
| 71 |
NotificationChannel parentNotificationChannel, |
| 72 |
NotificationChannelGroup parentNotificationChannelGroup, long lastEventTimestamp, |
| 73 |
boolean hasActiveNotifications, boolean hasBirthdayToday, |
| 74 |
List<ConversationStatus> statuses) { |
| 75 |
mShortcutInfo = shortcutInfo; |
| 76 |
mUid = uid; |
| 77 |
mNotificationChannel = parentNotificationChannel; |
| 78 |
mNotificationChannelGroup = parentNotificationChannelGroup; |
| 79 |
mLastEventTimestamp = lastEventTimestamp; |
| 80 |
mHasActiveNotifications = hasActiveNotifications; |
| 81 |
mHasBirthdayToday = hasBirthdayToday; |
| 82 |
mStatuses = statuses; |
| 83 |
} |
| 84 |
|
| 85 |
public ConversationChannel(Parcel in) { |
| 86 |
mShortcutInfo = in.readParcelable(ShortcutInfo.class.getClassLoader(), android.content.pm.ShortcutInfo.class); |
| 87 |
mUid = in.readInt(); |
| 88 |
mNotificationChannel = in.readParcelable(NotificationChannel.class.getClassLoader(), android.app.NotificationChannel.class); |
| 89 |
mNotificationChannelGroup = |
| 90 |
in.readParcelable(NotificationChannelGroup.class.getClassLoader(), android.app.NotificationChannelGroup.class); |
| 91 |
mLastEventTimestamp = in.readLong(); |
| 92 |
mHasActiveNotifications = in.readBoolean(); |
| 93 |
mHasBirthdayToday = in.readBoolean(); |
| 94 |
mStatuses = new ArrayList<>(); |
| 95 |
in.readParcelableList(mStatuses, ConversationStatus.class.getClassLoader(), android.app.people.ConversationStatus.class); |
| 96 |
} |
| 97 |
|
| 98 |
@Override |
| 99 |
public int describeContents() { |
| 100 |
return 0; |
| 101 |
} |
| 102 |
|
| 103 |
@Override |
| 104 |
public void writeToParcel(Parcel dest, int flags) { |
| 105 |
dest.writeParcelable(mShortcutInfo, flags); |
| 106 |
dest.writeInt(mUid); |
| 107 |
dest.writeParcelable(mNotificationChannel, flags); |
| 108 |
dest.writeParcelable(mNotificationChannelGroup, flags); |
| 109 |
dest.writeLong(mLastEventTimestamp); |
| 110 |
dest.writeBoolean(mHasActiveNotifications); |
| 111 |
dest.writeBoolean(mHasBirthdayToday); |
| 112 |
dest.writeParcelableList(mStatuses, flags); |
| 113 |
} |
| 114 |
|
| 115 |
public ShortcutInfo getShortcutInfo() { |
| 116 |
return mShortcutInfo; |
| 117 |
} |
| 118 |
|
| 119 |
public int getUid() { |
| 120 |
return mUid; |
| 121 |
} |
| 122 |
|
| 123 |
public NotificationChannel getNotificationChannel() { |
| 124 |
return mNotificationChannel; |
| 125 |
} |
| 126 |
|
| 127 |
public NotificationChannelGroup getNotificationChannelGroup() { |
| 128 |
return mNotificationChannelGroup; |
| 129 |
} |
| 130 |
|
| 131 |
public long getLastEventTimestamp() { |
| 132 |
return mLastEventTimestamp; |
| 133 |
} |
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
public boolean hasActiveNotifications() { |
| 140 |
return mHasActiveNotifications; |
| 141 |
} |
| 142 |
|
| 143 |
|
| 144 |
public boolean hasBirthdayToday() { |
| 145 |
return mHasBirthdayToday; |
| 146 |
} |
| 147 |
|
| 148 |
|
| 149 |
public @Nullable List<ConversationStatus> getStatuses() { |
| 150 |
return mStatuses; |
| 151 |
} |
| 152 |
|
| 153 |
@Override |
| 154 |
public String toString() { |
| 155 |
return "ConversationChannel{" + |
| 156 |
"mShortcutInfo=" + mShortcutInfo + |
| 157 |
", mUid=" + mUid + |
| 158 |
", mNotificationChannel=" + mNotificationChannel + |
| 159 |
", mNotificationChannelGroup=" + mNotificationChannelGroup + |
| 160 |
", mLastEventTimestamp=" + mLastEventTimestamp + |
| 161 |
", mHasActiveNotifications=" + mHasActiveNotifications + |
| 162 |
", mHasBirthdayToday=" + mHasBirthdayToday + |
| 163 |
", mStatuses=" + mStatuses + |
| 164 |
'}'; |
| 165 |
} |
| 166 |
} |