From a76b271f0e14325fa0ebb98e1cac0a15adfea1cb Mon Sep 17 00:00:00 2001 From: chaviw Date: Wed, 20 Sep 2017 12:02:26 -0700 Subject: 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 --- libs/gui/ISurfaceComposer.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'libs/gui/ISurfaceComposer.cpp') 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& layerHandleBinder, + const sp& producer, + ISurfaceComposer::Rotation rotation) { + Parcel data, reply; + data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); + data.writeStrongBinder(layerHandleBinder); + data.writeStrongBinder(IInterface::asBinder(producer)); + data.writeInt32(static_cast(rotation)); + remote()->transact(BnSurfaceComposer::CAPTURE_LAYERS, data, &reply); + return reply.readInt32(); + } + virtual bool authenticateSurfaceTexture( const sp& 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 layerHandleBinder = data.readStrongBinder(); + sp producer = + interface_cast(data.readStrongBinder()); + int32_t rotation = data.readInt32(); + + status_t res = captureLayers(layerHandleBinder, producer, + static_cast(rotation)); + reply->writeInt32(res); + return NO_ERROR; + } case AUTHENTICATE_SURFACE: { CHECK_INTERFACE(ISurfaceComposer, data, reply); sp bufferProducer = -- cgit v1.2.3-59-g8ed1b