summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2013-08-13 15:55:43 -0700
committer Mathias Agopian <mathias@google.com> 2013-08-13 15:58:38 -0700
commit5ff5a84e4829bad9eb44cc9a32d8579ca089051b (patch)
tree5064e430ccee3c0c7978abcc20590e5ab029d01b
parent6f23562e0c112bc5c6159c745d8af755cc530d77 (diff)
allow "system" screenshots even when the secure flag is set
we need too allow this case so that things like the rotation animation can work. with this change we only permit these screenshot if the destination is SurfaceFlinger itself. Bug: 10235036 Change-Id: I66fea5391e52b0d7f17f25827572b236f2d9eb71
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 4a84e5a530..b76cde773f 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2662,6 +2662,18 @@ status_t SurfaceFlinger::captureScreen(const sp<IBinder>& display,
if (CC_UNLIKELY(producer == 0))
return BAD_VALUE;
+ // if we have secure windows on this display, never allow the screen capture
+ // unless the producer interface is local (i.e.: we can take a screenshot for
+ // ourselves).
+ if (!producer->asBinder()->localBinder()) {
+ Mutex::Autolock _l(mStateLock);
+ sp<const DisplayDevice> hw(getDisplayDevice(display));
+ if (hw->getSecureLayerVisible()) {
+ ALOGW("FB is protected: PERMISSION_DENIED");
+ return PERMISSION_DENIED;
+ }
+ }
+
class MessageCaptureScreen : public MessageBase {
SurfaceFlinger* flinger;
sp<IBinder> display;
@@ -2786,12 +2798,6 @@ status_t SurfaceFlinger::captureScreenImplLocked(
const uint32_t hw_w = hw->getWidth();
const uint32_t hw_h = hw->getHeight();
- // if we have secure windows on this display, never allow the screen capture
- if (hw->getSecureLayerVisible()) {
- ALOGW("FB is protected: PERMISSION_DENIED");
- return PERMISSION_DENIED;
- }
-
if ((reqWidth > hw_w) || (reqHeight > hw_h)) {
ALOGE("size mismatch (%d, %d) > (%d, %d)",
reqWidth, reqHeight, hw_w, hw_h);