diff options
Diffstat (limited to 'android/os/PersistableBundle.java')
-rw-r--r-- | android/os/PersistableBundle.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/android/os/PersistableBundle.java b/android/os/PersistableBundle.java index 3ed5b174..40eceb8a 100644 --- a/android/os/PersistableBundle.java +++ b/android/os/PersistableBundle.java @@ -18,6 +18,7 @@ package android.os; import android.annotation.Nullable; import android.util.ArrayMap; +import android.util.proto.ProtoOutputStream; import com.android.internal.util.XmlUtils; @@ -321,4 +322,21 @@ public final class PersistableBundle extends BaseBundle implements Cloneable, Pa } return mMap.toString(); } + + /** @hide */ + public void writeToProto(ProtoOutputStream proto, long fieldId) { + final long token = proto.start(fieldId); + + if (mParcelledData != null) { + if (isEmptyParcel()) { + proto.write(PersistableBundleProto.PARCELLED_DATA_SIZE, 0); + } else { + proto.write(PersistableBundleProto.PARCELLED_DATA_SIZE, mParcelledData.dataSize()); + } + } else { + proto.write(PersistableBundleProto.MAP_DATA, mMap.toString()); + } + + proto.end(token); + } } |