summaryrefslogtreecommitdiff
path: root/libs/gui/SurfaceControl.cpp
diff options
context:
space:
mode:
author Jorim Jaggi <jjaggi@google.com> 2017-11-30 14:19:23 +0100
committer Jorim Jaggi <jjaggi@google.com> 2017-12-05 14:50:42 +0100
commitf3cf4bcfa2c558f03e178f7044d3cb12fa0e73ed (patch)
tree7acae449c6f8d846088e0d5bbeee27c45d7776c4 /libs/gui/SurfaceControl.cpp
parenta391ebe98e953a1209e1ba75baca4c8e46b69ae9 (diff)
Make SurfaceControl parcelable (2/2)
Bug: 69145041 Test: Send SurfaceControl over binder Change-Id: I47aa4a4bb39fab3ed4d1d30d4e472de7cbc5ca38
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