From bc84aecc76b75fb8a4fa9df10f3cc84dbaf4a5d4 Mon Sep 17 00:00:00 2001 From: Kweku Adams Date: Tue, 23 Jan 2018 13:33:12 -0800 Subject: Fixing bugs in Notification proto dumping. Also changing method signatures to be more in line with our convention. Based on some of the changes I went through, it looks like: 1. We were only legitimately saving the very last NotificationRecord that was dumped. 2. We weren't dumping any NotificationChannels into NotificationChannelGroup protos. Bug: 65750824 Test: Android builds Change-Id: I8c1ef90cf69d8ea00a7bad0c67445741056e23ef --- core/java/android/app/NotificationChannel.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'core/java/android/app/NotificationChannel.java') diff --git a/core/java/android/app/NotificationChannel.java b/core/java/android/app/NotificationChannel.java index c06ad3f32cf4..30f2697c1b1f 100644 --- a/core/java/android/app/NotificationChannel.java +++ b/core/java/android/app/NotificationChannel.java @@ -32,8 +32,6 @@ import android.util.proto.ProtoOutputStream; import com.android.internal.util.Preconditions; -import com.android.internal.util.Preconditions; - import org.json.JSONException; import org.json.JSONObject; import org.xmlpull.v1.XmlPullParser; @@ -936,7 +934,9 @@ public final class NotificationChannel implements Parcelable { } /** @hide */ - public void toProto(ProtoOutputStream proto) { + public void writeToProto(ProtoOutputStream proto, long fieldId) { + final long token = proto.start(fieldId); + proto.write(NotificationChannelProto.ID, mId); proto.write(NotificationChannelProto.NAME, mName); proto.write(NotificationChannelProto.DESCRIPTION, mDesc); @@ -959,10 +959,10 @@ public final class NotificationChannel implements Parcelable { proto.write(NotificationChannelProto.IS_DELETED, mDeleted); proto.write(NotificationChannelProto.GROUP, mGroup); if (mAudioAttributes != null) { - long aToken = proto.start(NotificationChannelProto.AUDIO_ATTRIBUTES); - mAudioAttributes.toProto(proto); - proto.end(aToken); + mAudioAttributes.writeToProto(proto, NotificationChannelProto.AUDIO_ATTRIBUTES); } proto.write(NotificationChannelProto.IS_BLOCKABLE_SYSTEM, mBlockableSystem); + + proto.end(token); } } -- cgit v1.2.3