How can a system app read the entire logcat programmatically in CyanogenMod 11?

340 Views Asked by At

I'm writing an app to include in a custom CyanogenMod build that needs to access the full logcat. I've tried the following:

...getRuntime().exec("su -c logcat -c");

but not getting anything from the input stream. I also tried this answer, and su exited with code 0, but it goes through the whole permission thing every time I run the app (when it should only need to do it once), and the code after it (a regular exec("logcat"), without worrying about permissions, which previously was pulling up the app's logs successfully) is no longer working (not getting any content).

My app is in /system/app, which some comments I saw led me to believe could get me the READ_LOGS permission in an easier way somehow, but I don't know how and am having trouble finding out. (I did try just adding the permission to my manifest, which didn't change the log content I was getting.)

(Also possibly worth noting that I'm working on a Nexus 7.)

0

There are 0 best solutions below