From 4afcbb74630a1ce0c59e6ec4fc74b6abdd895159 Mon Sep 17 00:00:00 2001 From: Vojtech Bocek Date: Fri, 27 Jun 2014 22:12:07 +0200 Subject: [PATCH] [121] Set context to trampoline so we can get its version via -v --- MultiROMMgr/src/main/AndroidManifest.xml | 4 ++-- .../com/tassadar/multirommgr/MultiROM.java | 8 ++++--- .../java/com/tassadar/multirommgr/Utils.java | 24 +++++++++++++++++++ 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/MultiROMMgr/src/main/AndroidManifest.xml b/MultiROMMgr/src/main/AndroidManifest.xml index 2ede6b1..8c24bf6 100644 --- a/MultiROMMgr/src/main/AndroidManifest.xml +++ b/MultiROMMgr/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="121" + android:versionName="1.121" > out = Shell.SU.run("chcon %s \'%s\' && echo 'success'", ctx, path); return out != null && out.size() == 1 && out.get(0).equals("success"); } + + public static boolean chcon(int type, String... paths) { + String ctx; + switch(type) { + case CHCON_ORIGINAL: + ctx = "u:object_r:app_data_file:s0"; + break; + case CHCON_EXECUTABLE: + case CHCON_BLOCK_ACCESS: + ctx = "u:object_r:system_file:s0"; + break; + default: + return false; + } + + String cmd = ""; + for(int i = 0; i < paths.length; ++i) { + cmd += String.format("chcon %s \'%s\' && ", ctx, paths[i]); + } + cmd += "echo \'success\'"; + + List out = Shell.SU.run(cmd); + return out != null && out.size() == 1 && out.get(0).equals("success"); + } }