| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.service.notification; |
| 18 |
|
| 19 |
import android.annotation.Nullable; |
| 20 |
import android.app.NotificationChannel; |
| 21 |
import android.content.pm.ShortcutInfo; |
| 22 |
import android.graphics.drawable.Drawable; |
| 23 |
import android.os.Parcel; |
| 24 |
import android.os.Parcelable; |
| 25 |
|
| 26 |
import java.util.Objects; |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
public final class ConversationChannelWrapper implements Parcelable { |
| 32 |
|
| 33 |
private NotificationChannel mNotificationChannel; |
| 34 |
private CharSequence mGroupLabel; |
| 35 |
private CharSequence mParentChannelLabel; |
| 36 |
private ShortcutInfo mShortcutInfo; |
| 37 |
private String mPkg; |
| 38 |
private int mUid; |
| 39 |
|
| 40 |
public ConversationChannelWrapper() {} |
| 41 |
|
| 42 |
protected ConversationChannelWrapper(Parcel in) { |
| 43 |
mNotificationChannel = in.readParcelable(NotificationChannel.class.getClassLoader(), android.app.NotificationChannel.class); |
| 44 |
mGroupLabel = in.readCharSequence(); |
| 45 |
mParentChannelLabel = in.readCharSequence(); |
| 46 |
mShortcutInfo = in.readParcelable(ShortcutInfo.class.getClassLoader(), android.content.pm.ShortcutInfo.class); |
| 47 |
mPkg = in.readStringNoHelper(); |
| 48 |
mUid = in.readInt(); |
| 49 |
} |
| 50 |
|
| 51 |
@Override |
| 52 |
public void writeToParcel(Parcel dest, int flags) { |
| 53 |
dest.writeParcelable(mNotificationChannel, flags); |
| 54 |
dest.writeCharSequence(mGroupLabel); |
| 55 |
dest.writeCharSequence(mParentChannelLabel); |
| 56 |
dest.writeParcelable(mShortcutInfo, flags); |
| 57 |
dest.writeStringNoHelper(mPkg); |
| 58 |
dest.writeInt(mUid); |
| 59 |
} |
| 60 |
|
| 61 |
@Override |
| 62 |
public int describeContents() { |
| 63 |
return 0; |
| 64 |
} |
| 65 |
|
| 66 |
public static final Creator<ConversationChannelWrapper> CREATOR = |
| 67 |
new Creator<ConversationChannelWrapper>() { |
| 68 |
@Override |
| 69 |
public ConversationChannelWrapper createFromParcel(Parcel in) { |
| 70 |
return new ConversationChannelWrapper(in); |
| 71 |
} |
| 72 |
|
| 73 |
@Override |
| 74 |
public ConversationChannelWrapper[] newArray(int size) { |
| 75 |
return new ConversationChannelWrapper[size]; |
| 76 |
} |
| 77 |
}; |
| 78 |
|
| 79 |
|
| 80 |
public NotificationChannel getNotificationChannel() { |
| 81 |
return mNotificationChannel; |
| 82 |
} |
| 83 |
|
| 84 |
public void setNotificationChannel( |
| 85 |
NotificationChannel notificationChannel) { |
| 86 |
mNotificationChannel = notificationChannel; |
| 87 |
} |
| 88 |
|
| 89 |
public CharSequence getGroupLabel() { |
| 90 |
return mGroupLabel; |
| 91 |
} |
| 92 |
|
| 93 |
public void setGroupLabel(CharSequence groupLabel) { |
| 94 |
mGroupLabel = groupLabel; |
| 95 |
} |
| 96 |
|
| 97 |
public CharSequence getParentChannelLabel() { |
| 98 |
return mParentChannelLabel; |
| 99 |
} |
| 100 |
|
| 101 |
public void setParentChannelLabel(CharSequence parentChannelLabel) { |
| 102 |
mParentChannelLabel = parentChannelLabel; |
| 103 |
} |
| 104 |
|
| 105 |
public ShortcutInfo getShortcutInfo() { |
| 106 |
return mShortcutInfo; |
| 107 |
} |
| 108 |
|
| 109 |
public void setShortcutInfo(ShortcutInfo shortcutInfo) { |
| 110 |
mShortcutInfo = shortcutInfo; |
| 111 |
} |
| 112 |
|
| 113 |
public String getPkg() { |
| 114 |
return mPkg; |
| 115 |
} |
| 116 |
|
| 117 |
public void setPkg(String pkg) { |
| 118 |
mPkg = pkg; |
| 119 |
} |
| 120 |
|
| 121 |
public int getUid() { |
| 122 |
return mUid; |
| 123 |
} |
| 124 |
|
| 125 |
public void setUid(int uid) { |
| 126 |
mUid = uid; |
| 127 |
} |
| 128 |
|
| 129 |
@Override |
| 130 |
public boolean equals(@Nullable Object o) { |
| 131 |
if (this == o) return true; |
| 132 |
if (o == null || getClass() != o.getClass()) return false; |
| 133 |
ConversationChannelWrapper that = (ConversationChannelWrapper) o; |
| 134 |
return Objects.equals(getNotificationChannel(), that.getNotificationChannel()) && |
| 135 |
Objects.equals(getGroupLabel(), that.getGroupLabel()) && |
| 136 |
Objects.equals(getParentChannelLabel(), that.getParentChannelLabel()) && |
| 137 |
Objects.equals(getShortcutInfo(), that.getShortcutInfo()) && |
| 138 |
Objects.equals(getPkg(), that.getPkg()) && |
| 139 |
getUid() == that.getUid(); |
| 140 |
} |
| 141 |
|
| 142 |
@Override |
| 143 |
public int hashCode() { |
| 144 |
return Objects.hash(getNotificationChannel(), getGroupLabel(), getParentChannelLabel(), |
| 145 |
getShortcutInfo(), getPkg(), getUid()); |
| 146 |
} |
| 147 |
} |