Skip to content

Commit

Permalink
[121] Set context to trampoline so we can get its version via -v
Browse files Browse the repository at this point in the history
  • Loading branch information
Tasssadar committed Jun 27, 2014
1 parent f620fe5 commit 4afcbb7
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
4 changes: 2 additions & 2 deletions MultiROMMgr/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tassadar.multirommgr"
android:versionCode="120"
android:versionName="1.120" >
android:versionCode="121"
android:versionName="1.121" >

<uses-sdk
android:minSdkVersion="16"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ public boolean findMultiROMDir() {
m_path = out.get(0);
Log.d("MultiROM", "Found in path " + m_path);
if(Utils.isSELinuxEnforcing()) {
Utils.chcon(Utils.CHCON_EXECUTABLE, m_path + "multirom");
Utils.chcon(Utils.CHCON_EXECUTABLE, m_path + "busybox");
Utils.chcon(Utils.CHCON_EXECUTABLE, m_path + "kexec");
Utils.chcon(Utils.CHCON_EXECUTABLE,
m_path + "multirom",
m_path + "trampoline",
m_path + "busybox",
m_path + "kexec");
}
return true;
}
Expand Down
24 changes: 24 additions & 0 deletions MultiROMMgr/src/main/java/com/tassadar/multirommgr/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -503,4 +503,28 @@ public static boolean chcon(int type, String path) {
List<String> 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<String> out = Shell.SU.run(cmd);
return out != null && out.size() == 1 && out.get(0).equals("success");
}
}

0 comments on commit 4afcbb7

Please sign in to comment.