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

后端 未结 2 1951
星月不相逢
星月不相逢 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: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();
    ...
    

提交回复
热议问题