Android: How can you get framebuffer (screenshot) on rooted device?

后端 未结 2 1939
星月不相逢
星月不相逢 2020-12-29 10:39

I tried :

process = Runtime.getRuntime().exec(\"su -c cat /dev/graphics/fb0 > /sdcard/frame.raw\");
process.waitFor();

but it doesn\'t w

相关标签:
2条回答
  • 2020-12-29 11:11

    The answer lies in replicating the way the device itself handles it:

    fb = open("/dev/graphics/fb0", O_RDONLY);

    check this

    0 讨论(0)
  • 2020-12-29 11:30

    Seems to me like your problem is this sign: >. You cannot redirect output using exec. What you need to do is grab the output stream of the process (which is the input stream for you) and store it to file;

    process = Runtime.getRuntime().exec("su -c cat /dev/graphics/fb0");
    InputStream is = process.getInputStream();
    ...
    
    0 讨论(0)
提交回复
热议问题