Loading libs/gui/ISurfaceComposer.cpp +19 −11 Original line number Diff line number Diff line Loading @@ -123,11 +123,11 @@ public: return remote()->transact(BnSurfaceComposer::CAPTURE_DISPLAY, data, &reply); } status_t captureDisplay(uint64_t displayOrLayerStack, status_t captureDisplay(DisplayId displayId, const sp<IScreenCaptureListener>& captureListener) override { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); SAFE_PARCEL(data.writeUint64, displayOrLayerStack); SAFE_PARCEL(data.writeUint64, displayId.value); SAFE_PARCEL(data.writeStrongBinder, IInterface::asBinder(captureListener)); return remote()->transact(BnSurfaceComposer::CAPTURE_DISPLAY_BY_ID, data, &reply); Loading Loading @@ -281,9 +281,14 @@ public: NO_ERROR) { std::vector<uint64_t> rawIds; if (reply.readUint64Vector(&rawIds) == NO_ERROR) { std::vector<PhysicalDisplayId> displayIds(rawIds.size()); std::transform(rawIds.begin(), rawIds.end(), displayIds.begin(), [](uint64_t rawId) { return PhysicalDisplayId(rawId); }); std::vector<PhysicalDisplayId> displayIds; displayIds.reserve(rawIds.size()); for (const uint64_t rawId : rawIds) { if (const auto id = DisplayId::fromValue<PhysicalDisplayId>(rawId)) { displayIds.push_back(*id); } } return displayIds; } } Loading Loading @@ -1296,12 +1301,15 @@ status_t BnSurfaceComposer::onTransact( } case CAPTURE_DISPLAY_BY_ID: { CHECK_INTERFACE(ISurfaceComposer, data, reply); uint64_t displayOrLayerStack = 0; uint64_t value; SAFE_PARCEL(data.readUint64, &value); const auto id = DisplayId::fromValue(value); if (!id) return BAD_VALUE; sp<IScreenCaptureListener> captureListener; SAFE_PARCEL(data.readUint64, &displayOrLayerStack); SAFE_PARCEL(data.readStrongBinder, &captureListener); return captureDisplay(displayOrLayerStack, captureListener); return captureDisplay(*id, captureListener); } case CAPTURE_LAYERS: { CHECK_INTERFACE(ISurfaceComposer, data, reply); Loading Loading @@ -1368,9 +1376,9 @@ status_t BnSurfaceComposer::onTransact( } case GET_PHYSICAL_DISPLAY_TOKEN: { CHECK_INTERFACE(ISurfaceComposer, data, reply); PhysicalDisplayId displayId(data.readUint64()); sp<IBinder> display = getPhysicalDisplayToken(displayId); reply->writeStrongBinder(display); const auto id = DisplayId::fromValue<PhysicalDisplayId>(data.readUint64()); if (!id) return BAD_VALUE; reply->writeStrongBinder(getPhysicalDisplayToken(*id)); return NO_ERROR; } case GET_DISPLAY_STATE: { Loading libs/gui/SurfaceComposerClient.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -2114,12 +2114,12 @@ status_t ScreenshotClient::captureDisplay(const DisplayCaptureArgs& captureArgs, return s->captureDisplay(captureArgs, captureListener); } status_t ScreenshotClient::captureDisplay(uint64_t displayOrLayerStack, status_t ScreenshotClient::captureDisplay(DisplayId displayId, const sp<IScreenCaptureListener>& captureListener) { sp<ISurfaceComposer> s(ComposerService::getComposerService()); if (s == nullptr) return NO_INIT; return s->captureDisplay(displayOrLayerStack, captureListener); return s->captureDisplay(displayId, captureListener); } status_t ScreenshotClient::captureLayers(const LayerCaptureArgs& captureArgs, Loading libs/gui/include/gui/ISurfaceComposer.h +9 −11 Original line number Diff line number Diff line Loading @@ -114,6 +114,11 @@ public: using EventRegistrationFlags = Flags<EventRegistration>; template <typename T> struct SpHash { size_t operator()(const sp<T>& k) const { return std::hash<T*>()(k.get()); } }; /* * Create a connection with SurfaceFlinger. */ Loading Loading @@ -237,24 +242,17 @@ public: * The subregion can be optionally rotated. It will also be scaled to * match the size of the output buffer. */ virtual status_t captureDisplay(const DisplayCaptureArgs& args, const sp<IScreenCaptureListener>& captureListener) = 0; virtual status_t captureDisplay(const DisplayCaptureArgs&, const sp<IScreenCaptureListener>&) = 0; virtual status_t captureDisplay(uint64_t displayOrLayerStack, const sp<IScreenCaptureListener>& captureListener) = 0; template <class AA> struct SpHash { size_t operator()(const sp<AA>& k) const { return std::hash<AA*>()(k.get()); } }; virtual status_t captureDisplay(DisplayId, const sp<IScreenCaptureListener>&) = 0; /** * 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 */ virtual status_t captureLayers(const LayerCaptureArgs& args, const sp<IScreenCaptureListener>& captureListener) = 0; virtual status_t captureLayers(const LayerCaptureArgs&, const sp<IScreenCaptureListener>&) = 0; /* Clears the frame statistics for animations. * Loading libs/gui/include/gui/SurfaceComposerClient.h +3 −6 Original line number Diff line number Diff line Loading @@ -610,12 +610,9 @@ private: class ScreenshotClient { public: static status_t captureDisplay(const DisplayCaptureArgs& captureArgs, const sp<IScreenCaptureListener>& captureListener); static status_t captureDisplay(uint64_t displayOrLayerStack, const sp<IScreenCaptureListener>& captureListener); static status_t captureLayers(const LayerCaptureArgs& captureArgs, const sp<IScreenCaptureListener>& captureListener); static status_t captureDisplay(const DisplayCaptureArgs&, const sp<IScreenCaptureListener>&); static status_t captureDisplay(DisplayId, const sp<IScreenCaptureListener>&); static status_t captureLayers(const LayerCaptureArgs&, const sp<IScreenCaptureListener>&); }; // --------------------------------------------------------------------------- Loading libs/gui/tests/Surface_test.cpp +7 −9 Original line number Diff line number Diff line Loading @@ -752,21 +752,19 @@ public: } status_t setActiveColorMode(const sp<IBinder>& /*display*/, ColorMode /*colorMode*/) override { return NO_ERROR; } status_t captureDisplay(const DisplayCaptureArgs& /* captureArgs */, const sp<IScreenCaptureListener>& /* captureListener */) override { return NO_ERROR; } void setAutoLowLatencyMode(const sp<IBinder>& /*display*/, bool /*on*/) override {} void setGameContentType(const sp<IBinder>& /*display*/, bool /*on*/) override {} status_t captureDisplay(uint64_t /*displayOrLayerStack*/, const sp<IScreenCaptureListener>& /* captureListener */) override { status_t captureDisplay(const DisplayCaptureArgs&, const sp<IScreenCaptureListener>&) override { return NO_ERROR; } virtual status_t captureLayers( const LayerCaptureArgs& /* captureArgs */, const sp<IScreenCaptureListener>& /* captureListener */) override { status_t captureDisplay(DisplayId, const sp<IScreenCaptureListener>&) override { return NO_ERROR; } status_t captureLayers(const LayerCaptureArgs&, const sp<IScreenCaptureListener>&) override { return NO_ERROR; } status_t clearAnimationFrameStats() override { return NO_ERROR; } status_t getAnimationFrameStats(FrameStats* /*outStats*/) const override { return NO_ERROR; Loading Loading
libs/gui/ISurfaceComposer.cpp +19 −11 Original line number Diff line number Diff line Loading @@ -123,11 +123,11 @@ public: return remote()->transact(BnSurfaceComposer::CAPTURE_DISPLAY, data, &reply); } status_t captureDisplay(uint64_t displayOrLayerStack, status_t captureDisplay(DisplayId displayId, const sp<IScreenCaptureListener>& captureListener) override { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); SAFE_PARCEL(data.writeUint64, displayOrLayerStack); SAFE_PARCEL(data.writeUint64, displayId.value); SAFE_PARCEL(data.writeStrongBinder, IInterface::asBinder(captureListener)); return remote()->transact(BnSurfaceComposer::CAPTURE_DISPLAY_BY_ID, data, &reply); Loading Loading @@ -281,9 +281,14 @@ public: NO_ERROR) { std::vector<uint64_t> rawIds; if (reply.readUint64Vector(&rawIds) == NO_ERROR) { std::vector<PhysicalDisplayId> displayIds(rawIds.size()); std::transform(rawIds.begin(), rawIds.end(), displayIds.begin(), [](uint64_t rawId) { return PhysicalDisplayId(rawId); }); std::vector<PhysicalDisplayId> displayIds; displayIds.reserve(rawIds.size()); for (const uint64_t rawId : rawIds) { if (const auto id = DisplayId::fromValue<PhysicalDisplayId>(rawId)) { displayIds.push_back(*id); } } return displayIds; } } Loading Loading @@ -1296,12 +1301,15 @@ status_t BnSurfaceComposer::onTransact( } case CAPTURE_DISPLAY_BY_ID: { CHECK_INTERFACE(ISurfaceComposer, data, reply); uint64_t displayOrLayerStack = 0; uint64_t value; SAFE_PARCEL(data.readUint64, &value); const auto id = DisplayId::fromValue(value); if (!id) return BAD_VALUE; sp<IScreenCaptureListener> captureListener; SAFE_PARCEL(data.readUint64, &displayOrLayerStack); SAFE_PARCEL(data.readStrongBinder, &captureListener); return captureDisplay(displayOrLayerStack, captureListener); return captureDisplay(*id, captureListener); } case CAPTURE_LAYERS: { CHECK_INTERFACE(ISurfaceComposer, data, reply); Loading Loading @@ -1368,9 +1376,9 @@ status_t BnSurfaceComposer::onTransact( } case GET_PHYSICAL_DISPLAY_TOKEN: { CHECK_INTERFACE(ISurfaceComposer, data, reply); PhysicalDisplayId displayId(data.readUint64()); sp<IBinder> display = getPhysicalDisplayToken(displayId); reply->writeStrongBinder(display); const auto id = DisplayId::fromValue<PhysicalDisplayId>(data.readUint64()); if (!id) return BAD_VALUE; reply->writeStrongBinder(getPhysicalDisplayToken(*id)); return NO_ERROR; } case GET_DISPLAY_STATE: { Loading
libs/gui/SurfaceComposerClient.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -2114,12 +2114,12 @@ status_t ScreenshotClient::captureDisplay(const DisplayCaptureArgs& captureArgs, return s->captureDisplay(captureArgs, captureListener); } status_t ScreenshotClient::captureDisplay(uint64_t displayOrLayerStack, status_t ScreenshotClient::captureDisplay(DisplayId displayId, const sp<IScreenCaptureListener>& captureListener) { sp<ISurfaceComposer> s(ComposerService::getComposerService()); if (s == nullptr) return NO_INIT; return s->captureDisplay(displayOrLayerStack, captureListener); return s->captureDisplay(displayId, captureListener); } status_t ScreenshotClient::captureLayers(const LayerCaptureArgs& captureArgs, Loading
libs/gui/include/gui/ISurfaceComposer.h +9 −11 Original line number Diff line number Diff line Loading @@ -114,6 +114,11 @@ public: using EventRegistrationFlags = Flags<EventRegistration>; template <typename T> struct SpHash { size_t operator()(const sp<T>& k) const { return std::hash<T*>()(k.get()); } }; /* * Create a connection with SurfaceFlinger. */ Loading Loading @@ -237,24 +242,17 @@ public: * The subregion can be optionally rotated. It will also be scaled to * match the size of the output buffer. */ virtual status_t captureDisplay(const DisplayCaptureArgs& args, const sp<IScreenCaptureListener>& captureListener) = 0; virtual status_t captureDisplay(const DisplayCaptureArgs&, const sp<IScreenCaptureListener>&) = 0; virtual status_t captureDisplay(uint64_t displayOrLayerStack, const sp<IScreenCaptureListener>& captureListener) = 0; template <class AA> struct SpHash { size_t operator()(const sp<AA>& k) const { return std::hash<AA*>()(k.get()); } }; virtual status_t captureDisplay(DisplayId, const sp<IScreenCaptureListener>&) = 0; /** * 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 */ virtual status_t captureLayers(const LayerCaptureArgs& args, const sp<IScreenCaptureListener>& captureListener) = 0; virtual status_t captureLayers(const LayerCaptureArgs&, const sp<IScreenCaptureListener>&) = 0; /* Clears the frame statistics for animations. * Loading
libs/gui/include/gui/SurfaceComposerClient.h +3 −6 Original line number Diff line number Diff line Loading @@ -610,12 +610,9 @@ private: class ScreenshotClient { public: static status_t captureDisplay(const DisplayCaptureArgs& captureArgs, const sp<IScreenCaptureListener>& captureListener); static status_t captureDisplay(uint64_t displayOrLayerStack, const sp<IScreenCaptureListener>& captureListener); static status_t captureLayers(const LayerCaptureArgs& captureArgs, const sp<IScreenCaptureListener>& captureListener); static status_t captureDisplay(const DisplayCaptureArgs&, const sp<IScreenCaptureListener>&); static status_t captureDisplay(DisplayId, const sp<IScreenCaptureListener>&); static status_t captureLayers(const LayerCaptureArgs&, const sp<IScreenCaptureListener>&); }; // --------------------------------------------------------------------------- Loading
libs/gui/tests/Surface_test.cpp +7 −9 Original line number Diff line number Diff line Loading @@ -752,21 +752,19 @@ public: } status_t setActiveColorMode(const sp<IBinder>& /*display*/, ColorMode /*colorMode*/) override { return NO_ERROR; } status_t captureDisplay(const DisplayCaptureArgs& /* captureArgs */, const sp<IScreenCaptureListener>& /* captureListener */) override { return NO_ERROR; } void setAutoLowLatencyMode(const sp<IBinder>& /*display*/, bool /*on*/) override {} void setGameContentType(const sp<IBinder>& /*display*/, bool /*on*/) override {} status_t captureDisplay(uint64_t /*displayOrLayerStack*/, const sp<IScreenCaptureListener>& /* captureListener */) override { status_t captureDisplay(const DisplayCaptureArgs&, const sp<IScreenCaptureListener>&) override { return NO_ERROR; } virtual status_t captureLayers( const LayerCaptureArgs& /* captureArgs */, const sp<IScreenCaptureListener>& /* captureListener */) override { status_t captureDisplay(DisplayId, const sp<IScreenCaptureListener>&) override { return NO_ERROR; } status_t captureLayers(const LayerCaptureArgs&, const sp<IScreenCaptureListener>&) override { return NO_ERROR; } status_t clearAnimationFrameStats() override { return NO_ERROR; } status_t getAnimationFrameStats(FrameStats* /*outStats*/) const override { return NO_ERROR; Loading