Skip to content

Instantly share code, notes, and snippets.

View arihantagarwal's full-sized avatar

Arihant Agarwal arihantagarwal

View GitHub Profile
String pname = getPackageName();
String[] CMDLINE_GRANTPERMS = { "su", "-c", null };
if (getPackageManager().checkPermission(android.Manifest.permission.READ_LOGS, pname) != 0) {
if (android.os.Build.VERSION.SDK_INT >= 16) {
try {
CMDLINE_GRANTPERMS[2] = String.format("pm grant %s android.permission.READ_LOGS", pname);
java.lang.Process p = Runtime.getRuntime().exec(CMDLINE_GRANTPERMS);
int res = p.waitFor();
Log.d(TAG, res);
if (res != 0)
@arihantagarwal
arihantagarwal / keybase.md
Created July 14, 2014 19:00
Keybase verification

Keybase proof

I hereby claim:

  • I am arihantagarwal on github.
  • I am arihant (https://keybase.io/arihant) on keybase.
  • I have a public key whose fingerprint is A600 1336 68AF 087D 4157 378E E80F 5D6C C566 43C4

To claim this, I am signing this object: