add abi helper function

This commit is contained in:
Max Lv
2013-12-01 10:49:33 +08:00
parent af6fcf0ed4
commit aae95df436
5 changed files with 25 additions and 28 deletions
@@ -800,7 +800,7 @@ class Shadowsocks
def reset() {
crash_recovery()
copyAssets(Utils.getABI)
copyAssets(System.getABI)
Utils.runCommand("chmod 755 /data/data/com.github.shadowsocks/iptables\n"
+ "chmod 755 /data/data/com.github.shadowsocks/redsocks\n"
+ "chmod 755 /data/data/com.github.shadowsocks/pdnsd\n"
@@ -282,31 +282,6 @@ object Utils {
false
}
/**
* Get the ABI of the device
* @return The ABI of the device, or ARM_ABI if not found
*/
def getABI: String = {
val prop = getSystemProperty(ABI_PROP)
prop match {
case abi if abi.toLowerCase.contains(ARM_ABI) => ARM_ABI
case abi if abi.toLowerCase.contains(X86_ABI) => X86_ABI
case _ => ARM_ABI
}
}
/**
* Returns a SystemProperty
*
* @param propName The Property to retrieve
* @return The Property, or NULL if not found
*/
def getSystemProperty(propName: String): String = {
val p: Process = Runtime.getRuntime.exec("getprop " + propName)
val lines = scala.io.Source.fromInputStream(p.getInputStream).getLines()
if (lines.hasNext) lines.next() else null
}
/**
* Check the system's iptables
* Default to use the app's iptables