summaryrefslogtreecommitdiff
path: root/libs/gui/SurfaceControl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/gui/SurfaceControl.cpp')
-rw-r--r--libs/gui/SurfaceControl.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp
index f6a2b8fed6..f5fb8acf44 100644
--- a/libs/gui/SurfaceControl.cpp
+++ b/libs/gui/SurfaceControl.cpp
@@ -166,5 +166,28 @@ sp<SurfaceComposerClient> SurfaceControl::getClient() const
return mClient;
}
+void SurfaceControl::writeToParcel(Parcel* parcel)
+{
+ parcel->writeStrongBinder(ISurfaceComposerClient::asBinder(mClient->getClient()));
+ parcel->writeStrongBinder(mHandle);
+ parcel->writeStrongBinder(IGraphicBufferProducer::asBinder(mGraphicBufferProducer));
+}
+
+sp<SurfaceControl> SurfaceControl::readFromParcel(Parcel* parcel)
+{
+ sp<IBinder> client = parcel->readStrongBinder();
+ sp<IBinder> handle = parcel->readStrongBinder();
+ if (client == nullptr || handle == nullptr)
+ {
+ ALOGE("Invalid parcel");
+ return nullptr;
+ }
+ sp<IBinder> gbp;
+ parcel->readNullableStrongBinder(&gbp);
+ return new SurfaceControl(new SurfaceComposerClient(
+ interface_cast<ISurfaceComposerClient>(client)),
+ handle.get(), interface_cast<IGraphicBufferProducer>(gbp));
+}
+
// ----------------------------------------------------------------------------
}; // namespace android