diff options
author | Prathmesh Prabhu <pprabhu@google.com> | 2016-03-10 15:23:34 -0800 |
---|---|---|
committer | Prathmesh Prabhu <pprabhu@google.com> | 2016-03-10 15:23:34 -0800 |
commit | bf89ae53c3d74365be4bf794283ca26f7d6d3fe1 (patch) | |
tree | d8f33880c4155822d914d12db692043a5316720c /cmds/screencap | |
parent | 58f1018c56a88e7864c7ff85f5b85129e790ffd2 (diff) |
screencap: Nix deprecated direct read of framebuffer.
screencap command had a fallback path that tried to read the framebuffer
directly. This is no longer supported (and is blocked by selinux
policy), so delete said path.
BUG:27598623
Change-Id: I1b002d4a68ad93f75b150029d01b5f0c500be56c
Diffstat (limited to 'cmds/screencap')
-rw-r--r-- | cmds/screencap/screencap.cpp | 48 |
1 files changed, 1 insertions, 47 deletions
diff --git a/cmds/screencap/screencap.cpp b/cmds/screencap/screencap.cpp index c469ae4a0961..7bf073b4b1a1 100644 --- a/cmds/screencap/screencap.cpp +++ b/cmds/screencap/screencap.cpp @@ -67,30 +67,6 @@ static SkColorType flinger2skia(PixelFormat f) } } -static status_t vinfoToPixelFormat(const fb_var_screeninfo& vinfo, - uint32_t* bytespp, uint32_t* f) -{ - - switch (vinfo.bits_per_pixel) { - case 16: - *f = PIXEL_FORMAT_RGB_565; - *bytespp = 2; - break; - case 24: - *f = PIXEL_FORMAT_RGB_888; - *bytespp = 3; - break; - case 32: - // TODO: do better decoding of vinfo here - *f = PIXEL_FORMAT_RGBX_8888; - *bytespp = 4; - break; - default: - return BAD_VALUE; - } - return NO_ERROR; -} - static status_t notifyMediaScanner(const char* fileName) { String8 cmd("am broadcast -a android.intent.action.MEDIA_SCANNER_SCAN_FILE -d file://"); String8 fileUrl("\""); @@ -147,7 +123,7 @@ int main(int argc, char** argv) png = true; } } - + if (fd == -1) { usage(pname); return 1; @@ -195,28 +171,6 @@ int main(int argc, char** argv) s = screenshot.getStride(); f = screenshot.getFormat(); size = screenshot.getSize(); - } else { - const char* fbpath = "/dev/graphics/fb0"; - int fb = open(fbpath, O_RDONLY); - if (fb >= 0) { - struct fb_var_screeninfo vinfo; - if (ioctl(fb, FBIOGET_VSCREENINFO, &vinfo) == 0) { - uint32_t bytespp; - if (vinfoToPixelFormat(vinfo, &bytespp, &f) == NO_ERROR) { - size_t offset = (vinfo.xoffset + vinfo.yoffset*vinfo.xres) * bytespp; - w = vinfo.xres; - h = vinfo.yres; - s = vinfo.xres; - size = w*h*bytespp; - mapsize = offset + size; - mapbase = mmap(0, mapsize, PROT_READ, MAP_PRIVATE, fb, 0); - if (mapbase != MAP_FAILED) { - base = (void const *)((char const *)mapbase + offset); - } - } - } - close(fb); - } } if (base != NULL) { |