diff options
author | chaviw <chaviw@google.com> | 2019-04-30 16:45:12 -0700 |
---|---|---|
committer | chaviw <chaviw@google.com> | 2019-05-08 12:34:19 -0700 |
commit | 93df2ea991d6f9c5c64280ac9947e44653d61fbf (patch) | |
tree | 94f4cb874aef7b62f930988186ff2b98ef9e62c0 /libs/gui/include | |
parent | 9d41bd7c39725289c4e996654105eb76c13bd8d8 (diff) | |
download | android_frameworks_native-93df2ea991d6f9c5c64280ac9947e44653d61fbf.tar.gz android_frameworks_native-93df2ea991d6f9c5c64280ac9947e44653d61fbf.tar.bz2 android_frameworks_native-93df2ea991d6f9c5c64280ac9947e44653d61fbf.zip |
Added captureScreen function for displayId or layerStack
Previously, screencap shell command could accept a display id as an argument.
It would use the id to look up information about the display (displayToken,
orientation, colorMode) by making requests into SurfaceFlinger. Since those
requests only worked for physical display ids, screencap didn't work to capture
virtual displays.
Instead of adding new methods to look up display information for a virtual
display, this change just adds a new captureScreen function in SurfaceFlinger
that accepts a displayId or layerStack and handles getting the default info
for the requested display. This works for both physical and virtual displays.
Test: adb shell screencap -d <layerStack for virt display>
Fixes: 130974213
Change-Id: I24b7558c973a057414c6b4f81ab1d60152fff38d
Diffstat (limited to 'libs/gui/include')
-rw-r--r-- | libs/gui/include/gui/ISurfaceComposer.h | 4 | ||||
-rw-r--r-- | libs/gui/include/gui/SurfaceComposerClient.h | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/libs/gui/include/gui/ISurfaceComposer.h b/libs/gui/include/gui/ISurfaceComposer.h index e8c7a39ad..fd67754d0 100644 --- a/libs/gui/include/gui/ISurfaceComposer.h +++ b/libs/gui/include/gui/ISurfaceComposer.h @@ -247,6 +247,9 @@ public: useIdentityTransform, rotation); } + virtual status_t captureScreen(uint64_t displayOrLayerStack, ui::Dataspace* outDataspace, + sp<GraphicBuffer>* outBuffer) = 0; + template <class AA> struct SpHash { size_t operator()(const sp<AA>& k) const { return std::hash<AA*>()(k.get()); } @@ -473,6 +476,7 @@ public: GET_ALLOWED_DISPLAY_CONFIGS, GET_DISPLAY_BRIGHTNESS_SUPPORT, SET_DISPLAY_BRIGHTNESS, + CAPTURE_SCREEN_BY_ID, // Always append new enum to the end. }; diff --git a/libs/gui/include/gui/SurfaceComposerClient.h b/libs/gui/include/gui/SurfaceComposerClient.h index 9d344689d..a03883860 100644 --- a/libs/gui/include/gui/SurfaceComposerClient.h +++ b/libs/gui/include/gui/SurfaceComposerClient.h @@ -515,6 +515,8 @@ public: const ui::PixelFormat reqPixelFormat, Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, bool useIdentityTransform, uint32_t rotation, sp<GraphicBuffer>* outBuffer); + static status_t capture(uint64_t displayOrLayerStack, ui::Dataspace* outDataspace, + sp<GraphicBuffer>* outBuffer); static status_t captureLayers(const sp<IBinder>& layerHandle, const ui::Dataspace reqDataSpace, const ui::PixelFormat reqPixelFormat, Rect sourceCrop, float frameScale, sp<GraphicBuffer>* outBuffer); |