diff options
| author | 2016-08-29 17:33:08 -0700 | |
|---|---|---|
| committer | 2016-08-29 23:23:39 -0700 | |
| commit | 529a103fde484a6512aaffd9ae063decb93765eb (patch) | |
| tree | 5bfe71c98d88516c6eebb37e6fb08bc02a83fe94 | |
| parent | 4db50cec13f5fb69e847d1106c78cb972bc62149 (diff) | |
Surface: Add parcel/unparceling for missing field.
Read/write new isSingleBuffered field in native code as well.
Currently just write 'no' unconditionally and discard on read.
Bug: 31162160
Change-Id: Icfb7a37fb37a41f6437fe08bcfad271474ba6983
| -rw-r--r-- | libs/gui/Surface.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp index dbf811462d..ab223ffd4b 100644 --- a/libs/gui/Surface.cpp +++ b/libs/gui/Surface.cpp @@ -1364,12 +1364,18 @@ status_t Surface::writeToParcel(Parcel* parcel, bool nameAlreadyWritten) const { status_t res = OK; - if (!nameAlreadyWritten) res = parcel->writeString16(name); + if (!nameAlreadyWritten) { + res = parcel->writeString16(name); + if (res != OK) return res; - if (res == OK) { - res = parcel->writeStrongBinder( - IGraphicBufferProducer::asBinder(graphicBufferProducer)); + /* isSingleBuffered defaults to no */ + res = parcel->writeInt32(0); + if (res != OK) return res; } + + res = parcel->writeStrongBinder( + IGraphicBufferProducer::asBinder(graphicBufferProducer)); + return res; } @@ -1380,13 +1386,20 @@ status_t Surface::readFromParcel(const Parcel* parcel) { status_t Surface::readFromParcel(const Parcel* parcel, bool nameAlreadyRead) { if (parcel == nullptr) return BAD_VALUE; + status_t res = OK; if (!nameAlreadyRead) { name = readMaybeEmptyString16(parcel); + // Discard this for now + int isSingleBuffered; + res = parcel->readInt32(&isSingleBuffered); + if (res != OK) { + return res; + } } sp<IBinder> binder; - status_t res = parcel->readStrongBinder(&binder); + res = parcel->readStrongBinder(&binder); if (res != OK) return res; graphicBufferProducer = interface_cast<IGraphicBufferProducer>(binder); |