diff options
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/NotificationChannelGroup.java | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/core/java/android/app/NotificationChannelGroup.java b/core/java/android/app/NotificationChannelGroup.java index f97415ca20c8..1769993e0e07 100644 --- a/core/java/android/app/NotificationChannelGroup.java +++ b/core/java/android/app/NotificationChannelGroup.java @@ -20,6 +20,7 @@ import android.annotation.SystemApi; import android.annotation.TestApi; import android.compat.annotation.UnsupportedAppUsage; import android.content.Intent; +import android.content.pm.ParceledListSlice; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; @@ -66,7 +67,7 @@ public final class NotificationChannelGroup implements Parcelable { private CharSequence mName; private String mDescription; private boolean mBlocked; - private List<NotificationChannel> mChannels = new ArrayList<>(); + private ParceledListSlice<NotificationChannel> mChannels; // Bitwise representation of fields that have been changed by the user private int mUserLockedFields; @@ -100,7 +101,8 @@ public final class NotificationChannelGroup implements Parcelable { } else { mDescription = null; } - in.readParcelableList(mChannels, NotificationChannel.class.getClassLoader(), android.app.NotificationChannel.class); + mChannels = in.readParcelable( + NotificationChannelGroup.class.getClassLoader(), ParceledListSlice.class); mBlocked = in.readBoolean(); mUserLockedFields = in.readInt(); } @@ -127,7 +129,7 @@ public final class NotificationChannelGroup implements Parcelable { } else { dest.writeByte((byte) 0); } - dest.writeParcelableList(mChannels, flags); + dest.writeParcelable(mChannels, flags); dest.writeBoolean(mBlocked); dest.writeInt(mUserLockedFields); } @@ -157,7 +159,7 @@ public final class NotificationChannelGroup implements Parcelable { * Returns the list of channels that belong to this group */ public List<NotificationChannel> getChannels() { - return mChannels; + return mChannels == null ? new ArrayList<>() : mChannels.getList(); } /** @@ -191,15 +193,8 @@ public final class NotificationChannelGroup implements Parcelable { /** * @hide */ - public void addChannel(NotificationChannel channel) { - mChannels.add(channel); - } - - /** - * @hide - */ public void setChannels(List<NotificationChannel> channels) { - mChannels = channels; + mChannels = new ParceledListSlice<>(channels); } /** @@ -334,7 +329,7 @@ public final class NotificationChannelGroup implements Parcelable { proto.write(NotificationChannelGroupProto.NAME, mName.toString()); proto.write(NotificationChannelGroupProto.DESCRIPTION, mDescription); proto.write(NotificationChannelGroupProto.IS_BLOCKED, mBlocked); - for (NotificationChannel channel : mChannels) { + for (NotificationChannel channel : mChannels.getList()) { channel.dumpDebug(proto, NotificationChannelGroupProto.CHANNELS); } proto.end(token); |
