diff options
author | Robert Carr <racarr@google.com> | 2019-04-02 16:28:26 -0700 |
---|---|---|
committer | Robert Carr <racarr@google.com> | 2019-04-04 09:28:42 -0700 |
commit | 866455f07c21964af5c195709bc2081121965200 (patch) | |
tree | 42ebce28d4caf7803a9562742bd9013d5828880e /libs/gui/include | |
parent | 7b5d9813aacda610b262d6773f13a21ba8a75b98 (diff) | |
download | android_frameworks_native-866455f07c21964af5c195709bc2081121965200.tar.gz android_frameworks_native-866455f07c21964af5c195709bc2081121965200.tar.bz2 android_frameworks_native-866455f07c21964af5c195709bc2081121965200.zip |
SurfaceFlinger: Add exclusion list for captureLayers.
Among other use cases, WM needs to be able to omit the IME from Task Snapshots,
even while it is on-screen.
Bug: 126614127
Test: Transaction_test.cpp#CaptureLayerExclude,CaptureLayerExcludeTree
Change-Id: I055d99106c9ce2ed90d64eca06961d88cbd5e2d4
Diffstat (limited to 'libs/gui/include')
-rw-r--r-- | libs/gui/include/gui/ISurfaceComposer.h | 19 | ||||
-rw-r--r-- | libs/gui/include/gui/SurfaceComposerClient.h | 11 |
2 files changed, 21 insertions, 9 deletions
diff --git a/libs/gui/include/gui/ISurfaceComposer.h b/libs/gui/include/gui/ISurfaceComposer.h index fe85fdf69..14d92bf04 100644 --- a/libs/gui/include/gui/ISurfaceComposer.h +++ b/libs/gui/include/gui/ISurfaceComposer.h @@ -20,6 +20,7 @@ #include <stdint.h> #include <sys/types.h> +#include <binder/IBinder.h> #include <binder/IInterface.h> #include <gui/ITransactionCompletedListener.h> @@ -37,6 +38,7 @@ #include <utils/Vector.h> #include <optional> +#include <unordered_set> #include <vector> namespace android { @@ -243,6 +245,11 @@ public: sourceCrop, reqWidth, reqHeight, useIdentityTransform, rotation); } + template <class AA> + struct SpHash { + size_t operator()(const sp<AA>& k) const { return std::hash<AA*>()(k.get()); } + }; + /** * Capture a subtree of the layer hierarchy, potentially ignoring the root node. * @@ -250,10 +257,12 @@ public: * of the buffer. The caller should pick the data space and pixel format * that it can consume. */ - virtual status_t captureLayers(const sp<IBinder>& layerHandleBinder, - sp<GraphicBuffer>* outBuffer, const ui::Dataspace reqDataspace, - const ui::PixelFormat reqPixelFormat, const Rect& sourceCrop, - float frameScale = 1.0, bool childrenOnly = false) = 0; + virtual status_t captureLayers( + const sp<IBinder>& layerHandleBinder, sp<GraphicBuffer>* outBuffer, + const ui::Dataspace reqDataspace, const ui::PixelFormat reqPixelFormat, + const Rect& sourceCrop, + const std::unordered_set<sp<IBinder>, SpHash<IBinder>>& excludeHandles, + float frameScale = 1.0, bool childrenOnly = false) = 0; /** * Capture a subtree of the layer hierarchy into an sRGB buffer with RGBA_8888 pixel format, @@ -263,7 +272,7 @@ public: const Rect& sourceCrop, float frameScale = 1.0, bool childrenOnly = false) { return captureLayers(layerHandleBinder, outBuffer, ui::Dataspace::V0_SRGB, - ui::PixelFormat::RGBA_8888, sourceCrop, frameScale, childrenOnly); + ui::PixelFormat::RGBA_8888, sourceCrop, {}, frameScale, childrenOnly); } /* Clears the frame statistics for animations. diff --git a/libs/gui/include/gui/SurfaceComposerClient.h b/libs/gui/include/gui/SurfaceComposerClient.h index 593a5e7d8..f64fb61ec 100644 --- a/libs/gui/include/gui/SurfaceComposerClient.h +++ b/libs/gui/include/gui/SurfaceComposerClient.h @@ -37,6 +37,7 @@ #include <ui/PixelFormat.h> #include <gui/CpuConsumer.h> +#include <gui/ISurfaceComposer.h> #include <gui/ITransactionCompletedListener.h> #include <gui/LayerState.h> #include <gui/SurfaceControl.h> @@ -516,10 +517,12 @@ public: static status_t captureLayers(const sp<IBinder>& layerHandle, const ui::Dataspace reqDataSpace, const ui::PixelFormat reqPixelFormat, Rect sourceCrop, float frameScale, sp<GraphicBuffer>* outBuffer); - static status_t captureChildLayers(const sp<IBinder>& layerHandle, - const ui::Dataspace reqDataSpace, - const ui::PixelFormat reqPixelFormat, Rect sourceCrop, - float frameScale, sp<GraphicBuffer>* outBuffer); + static status_t captureChildLayers( + const sp<IBinder>& layerHandle, const ui::Dataspace reqDataSpace, + const ui::PixelFormat reqPixelFormat, Rect sourceCrop, + const std::unordered_set<sp<IBinder>, ISurfaceComposer::SpHash<IBinder>>& + excludeHandles, + float frameScale, sp<GraphicBuffer>* outBuffer); }; // --------------------------------------------------------------------------- |