diff options
author | 2017-09-20 12:02:26 -0700 | |
---|---|---|
committer | 2017-10-26 17:39:24 -0700 | |
commit | a76b271f0e14325fa0ebb98e1cac0a15adfea1cb (patch) | |
tree | e13158ef19eed46d32d6a0984da3fe1645206fe6 /libs/gui/ISurfaceComposer.cpp | |
parent | cd8ad33289b74243e21a776a5a9170c845d990c4 (diff) |
Add captureLayers function to capture a layer and its children.
The captureLayers function gets a root layer as its argument.
It will capture the content for that layer and its descendants. The
capture will set the root layer's transform back to (0, 0).
Test: Transaction_test ScreenCaptureTest
Change-Id: I84fb66a65cd91434cddc99506b1924cf9f950935
Diffstat (limited to 'libs/gui/ISurfaceComposer.cpp')
-rw-r--r-- | libs/gui/ISurfaceComposer.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp index 96771257c1..973302c226 100644 --- a/libs/gui/ISurfaceComposer.cpp +++ b/libs/gui/ISurfaceComposer.cpp @@ -122,6 +122,18 @@ public: return reply.readInt32(); } + virtual status_t captureLayers(const sp<IBinder>& layerHandleBinder, + const sp<IGraphicBufferProducer>& producer, + ISurfaceComposer::Rotation rotation) { + Parcel data, reply; + data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); + data.writeStrongBinder(layerHandleBinder); + data.writeStrongBinder(IInterface::asBinder(producer)); + data.writeInt32(static_cast<int32_t>(rotation)); + remote()->transact(BnSurfaceComposer::CAPTURE_LAYERS, data, &reply); + return reply.readInt32(); + } + virtual bool authenticateSurfaceTexture( const sp<IGraphicBufferProducer>& bufferProducer) const { @@ -588,6 +600,18 @@ status_t BnSurfaceComposer::onTransact( reply->writeInt32(res); return NO_ERROR; } + case CAPTURE_LAYERS: { + CHECK_INTERFACE(ISurfaceComposer, data, reply); + sp<IBinder> layerHandleBinder = data.readStrongBinder(); + sp<IGraphicBufferProducer> producer = + interface_cast<IGraphicBufferProducer>(data.readStrongBinder()); + int32_t rotation = data.readInt32(); + + status_t res = captureLayers(layerHandleBinder, producer, + static_cast<ISurfaceComposer::Rotation>(rotation)); + reply->writeInt32(res); + return NO_ERROR; + } case AUTHENTICATE_SURFACE: { CHECK_INTERFACE(ISurfaceComposer, data, reply); sp<IGraphicBufferProducer> bufferProducer = |