diff options
| author | Julia Reynolds <juliacr@google.com> | 2022-08-22 13:56:41 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2022-08-22 13:56:41 +0000 |
| commit | c8d7e101ca775f9d49eee1bb1aac8ce32e051e75 (patch) | |
| tree | 28aa61e6969b67f97013e48df878f86b69643fb8 /core/java/android | |
| parent | 7ae652e507f088dc5b64b13695b539f10b897f0a (diff) | |
| parent | f6d322577af7231c28d398096b3ca9b88260fa49 (diff) | |
Merge "Revert^2 "Fix binder error when an app has many channels"" into tm-qpr-dev
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); |
