From 041a075262ef5fc886e46fd4eec3dd79ee2e60c0 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Fri, 15 Mar 2013 18:31:56 -0700 Subject: [PATCH] don't allow screenshots without the READ_FRAMEBUFFER permission the recent screenshot rework allowed the older screenshot interface to work without that permission Change-Id: I6c4743f4591c81106e3b823d55a055f7b4907de1 --- include/gui/ISurfaceComposer.h | 11 +++++++++-- services/surfaceflinger/SurfaceFlinger.cpp | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/gui/ISurfaceComposer.h b/include/gui/ISurfaceComposer.h index 08eddcb67..47f955282 100644 --- a/include/gui/ISurfaceComposer.h +++ b/include/gui/ISurfaceComposer.h @@ -103,16 +103,23 @@ public: uint32_t reqWidth, uint32_t reqHeight, uint32_t minLayerZ, uint32_t maxLayerZ) = 0; - /* triggers screen off and waits for it to complete */ + /* triggers screen off and waits for it to complete + * requires ACCESS_SURFACE_FLINGER permission. + */ virtual void blank(const sp& display) = 0; - /* triggers screen on and waits for it to complete */ + /* triggers screen on and waits for it to complete + * requires ACCESS_SURFACE_FLINGER permission. + */ virtual void unblank(const sp& display) = 0; /* returns information about a display * intended to be used to get information about built-in displays */ virtual status_t getDisplayInfo(const sp& display, DisplayInfo* info) = 0; + /* Capture the specified screen. requires READ_FRAME_BUFFER permission + * This function will fail if there is a secure window on screen. + */ virtual status_t captureScreen(const sp& display, const sp& producer, uint32_t reqWidth, uint32_t reqHeight, diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 1daadcce6..edf01f77d 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -2399,6 +2399,7 @@ status_t SurfaceFlinger::onTransact( { switch (code) { case CREATE_CONNECTION: + case CREATE_DISPLAY: case SET_TRANSACTION_STATE: case BOOT_FINISHED: case BLANK: @@ -2417,6 +2418,7 @@ status_t SurfaceFlinger::onTransact( break; } case CAPTURE_SCREEN: + case CAPTURE_SCREEN_DEPRECATED: { // codes that require permission check IPCThreadState* ipc = IPCThreadState::self();