Run screenrecord command programmatically without root result file size is zero

345 Views Asked by At

I want to encapsulate screenrecord command by java code and invoke it in android application. Luckly I can start and kill the screenrecord process with root Process, and get a valid mp4 file.

I know that I can run screenrecord command under ADB without root, so I think I could do the same thing via java code which invoke a shell, but no luck, the command will produce a file but the file size is zero.

Am I doing something wrong?

1

There are 1 best solutions below

0
On

ADB has the privilege: AID_GRAPHICS, which normal application doesn't have.