I am developing an app for taking screenshots with root access. I am using this call to take screenshot:
"/system/bin/screencap -p " + getFilesDir() + "screen.png"
However it creates this screenshot in root context and I can't access it with my app even if I chmod 777 and chown user_id:user_id. SELinux still says that this access is denied because scontext is u:r:untrusted_app:s0
while tcontext is u:object_r:app_data_file:s0
. I have tried calling su
with --context u:r:untrusted_app:s0
but it didn't help.
Any idea on how to perform correct screen capture call which will save it to app internal storage and then allow access for app?