Loading libs/gui/SurfaceComposerClient.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ #include <android-base/thread_annotations.h> #include <gui/LayerStatePermissions.h> #include <gui/ScreenCaptureResults.h> #include <private/gui/ComposerService.h> #include <private/gui/ComposerServiceAIDL.h> Loading Loading @@ -3138,11 +3139,19 @@ status_t ScreenshotClient::captureDisplay(DisplayId displayId, const gui::Captur } status_t ScreenshotClient::captureLayers(const LayerCaptureArgs& captureArgs, const sp<IScreenCaptureListener>& captureListener) { const sp<IScreenCaptureListener>& captureListener, bool sync) { sp<gui::ISurfaceComposer> s(ComposerServiceAIDL::getComposerService()); if (s == nullptr) return NO_INIT; binder::Status status = s->captureLayers(captureArgs, captureListener); binder::Status status; if (sync) { gui::ScreenCaptureResults captureResults; status = s->captureLayersSync(captureArgs, &captureResults); captureListener->onScreenCaptureCompleted(captureResults); } else { status = s->captureLayers(captureArgs, captureListener); } return statusTFromBinderStatus(status); } Loading libs/gui/aidl/android/gui/ISurfaceComposer.aidl +11 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import android.gui.LayerCaptureArgs; import android.gui.LayerDebugInfo; import android.gui.OverlayProperties; import android.gui.PullAtomData; import android.gui.ScreenCaptureResults; import android.gui.ARect; import android.gui.SchedulingPolicy; import android.gui.StalledTransactionInfo; Loading Loading @@ -242,6 +243,16 @@ interface ISurfaceComposer { oneway void captureDisplayById(long displayId, in CaptureArgs args, IScreenCaptureListener listener); /** * Capture a subtree of the layer hierarchy, potentially ignoring the root node. * This requires READ_FRAME_BUFFER permission. This function will fail if there * is a secure window on screen. This is a blocking call and will return the * ScreenCaptureResults, including the captured buffer. Because this is blocking, the * caller doesn't care about the fence and the binder thread in SurfaceFlinger will wait * on the fence to fire before returning the results. */ ScreenCaptureResults captureLayersSync(in LayerCaptureArgs args); /** * Capture a subtree of the layer hierarchy, potentially ignoring the root node. * This requires READ_FRAME_BUFFER permission. This function will fail if there Loading libs/gui/fuzzer/libgui_fuzzer_utils.h +2 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,8 @@ public: (int64_t, const gui::CaptureArgs&, const sp<IScreenCaptureListener>&), (override)); MOCK_METHOD(binder::Status, captureLayers, (const LayerCaptureArgs&, const sp<IScreenCaptureListener>&), (override)); MOCK_METHOD(binder::Status, captureLayersSync, (const LayerCaptureArgs&, gui::ScreenCaptureResults*), (override)); MOCK_METHOD(binder::Status, clearAnimationFrameStats, (), (override)); MOCK_METHOD(binder::Status, getAnimationFrameStats, (gui::FrameStats*), (override)); MOCK_METHOD(binder::Status, overrideHdrTypes, (const sp<IBinder>&, const std::vector<int32_t>&), Loading libs/gui/include/gui/SurfaceComposerClient.h +2 −1 Original line number Diff line number Diff line Loading @@ -849,7 +849,8 @@ public: static status_t captureDisplay(const DisplayCaptureArgs&, const sp<IScreenCaptureListener>&); static status_t captureDisplay(DisplayId, const gui::CaptureArgs&, const sp<IScreenCaptureListener>&); static status_t captureLayers(const LayerCaptureArgs&, const sp<IScreenCaptureListener>&); static status_t captureLayers(const LayerCaptureArgs&, const sp<IScreenCaptureListener>&, bool sync); [[deprecated]] static status_t captureDisplay(DisplayId id, const sp<IScreenCaptureListener>& listener) { Loading libs/gui/tests/Surface_test.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -791,6 +791,10 @@ public: return binder::Status::ok(); } binder::Status captureLayersSync(const LayerCaptureArgs&, ScreenCaptureResults*) override { return binder::Status::ok(); } binder::Status captureLayers(const LayerCaptureArgs&, const sp<IScreenCaptureListener>&) override { return binder::Status::ok(); Loading Loading
libs/gui/SurfaceComposerClient.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ #include <android-base/thread_annotations.h> #include <gui/LayerStatePermissions.h> #include <gui/ScreenCaptureResults.h> #include <private/gui/ComposerService.h> #include <private/gui/ComposerServiceAIDL.h> Loading Loading @@ -3138,11 +3139,19 @@ status_t ScreenshotClient::captureDisplay(DisplayId displayId, const gui::Captur } status_t ScreenshotClient::captureLayers(const LayerCaptureArgs& captureArgs, const sp<IScreenCaptureListener>& captureListener) { const sp<IScreenCaptureListener>& captureListener, bool sync) { sp<gui::ISurfaceComposer> s(ComposerServiceAIDL::getComposerService()); if (s == nullptr) return NO_INIT; binder::Status status = s->captureLayers(captureArgs, captureListener); binder::Status status; if (sync) { gui::ScreenCaptureResults captureResults; status = s->captureLayersSync(captureArgs, &captureResults); captureListener->onScreenCaptureCompleted(captureResults); } else { status = s->captureLayers(captureArgs, captureListener); } return statusTFromBinderStatus(status); } Loading
libs/gui/aidl/android/gui/ISurfaceComposer.aidl +11 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import android.gui.LayerCaptureArgs; import android.gui.LayerDebugInfo; import android.gui.OverlayProperties; import android.gui.PullAtomData; import android.gui.ScreenCaptureResults; import android.gui.ARect; import android.gui.SchedulingPolicy; import android.gui.StalledTransactionInfo; Loading Loading @@ -242,6 +243,16 @@ interface ISurfaceComposer { oneway void captureDisplayById(long displayId, in CaptureArgs args, IScreenCaptureListener listener); /** * Capture a subtree of the layer hierarchy, potentially ignoring the root node. * This requires READ_FRAME_BUFFER permission. This function will fail if there * is a secure window on screen. This is a blocking call and will return the * ScreenCaptureResults, including the captured buffer. Because this is blocking, the * caller doesn't care about the fence and the binder thread in SurfaceFlinger will wait * on the fence to fire before returning the results. */ ScreenCaptureResults captureLayersSync(in LayerCaptureArgs args); /** * Capture a subtree of the layer hierarchy, potentially ignoring the root node. * This requires READ_FRAME_BUFFER permission. This function will fail if there Loading
libs/gui/fuzzer/libgui_fuzzer_utils.h +2 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,8 @@ public: (int64_t, const gui::CaptureArgs&, const sp<IScreenCaptureListener>&), (override)); MOCK_METHOD(binder::Status, captureLayers, (const LayerCaptureArgs&, const sp<IScreenCaptureListener>&), (override)); MOCK_METHOD(binder::Status, captureLayersSync, (const LayerCaptureArgs&, gui::ScreenCaptureResults*), (override)); MOCK_METHOD(binder::Status, clearAnimationFrameStats, (), (override)); MOCK_METHOD(binder::Status, getAnimationFrameStats, (gui::FrameStats*), (override)); MOCK_METHOD(binder::Status, overrideHdrTypes, (const sp<IBinder>&, const std::vector<int32_t>&), Loading
libs/gui/include/gui/SurfaceComposerClient.h +2 −1 Original line number Diff line number Diff line Loading @@ -849,7 +849,8 @@ public: static status_t captureDisplay(const DisplayCaptureArgs&, const sp<IScreenCaptureListener>&); static status_t captureDisplay(DisplayId, const gui::CaptureArgs&, const sp<IScreenCaptureListener>&); static status_t captureLayers(const LayerCaptureArgs&, const sp<IScreenCaptureListener>&); static status_t captureLayers(const LayerCaptureArgs&, const sp<IScreenCaptureListener>&, bool sync); [[deprecated]] static status_t captureDisplay(DisplayId id, const sp<IScreenCaptureListener>& listener) { Loading
libs/gui/tests/Surface_test.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -791,6 +791,10 @@ public: return binder::Status::ok(); } binder::Status captureLayersSync(const LayerCaptureArgs&, ScreenCaptureResults*) override { return binder::Status::ok(); } binder::Status captureLayers(const LayerCaptureArgs&, const sp<IScreenCaptureListener>&) override { return binder::Status::ok(); Loading