Use direct path

This commit is contained in:
topjohnwu 2017-11-09 00:03:37 +08:00
parent e171362e3e
commit 36025d6d9f
4 changed files with 17 additions and 7 deletions

View File

@ -218,12 +218,12 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
enabled = prefs.getBoolean(Const.Key.HOSTS, false);
if (enabled) {
Shell.su_raw(
"cp -af /system/etc/hosts " + Const.MAGISK_HOST_FILE,
"mount -o bind " + Const.MAGISK_HOST_FILE + " /system/etc/hosts");
"cp -af /system/etc/hosts " + Const.MAGISK_HOST_FILE(),
"mount -o bind " + Const.MAGISK_HOST_FILE() + " /system/etc/hosts");
} else {
Shell.su_raw(
"umount -l /system/etc/hosts",
"rm -f " + Const.MAGISK_HOST_FILE);
"rm -f " + Const.MAGISK_HOST_FILE());
}
break;
case Const.Key.ROOT_ACCESS:

View File

@ -112,7 +112,7 @@ public class SplashActivity extends Activity {
.putBoolean(Const.Key.DARK_THEME, mm.isDarkTheme)
.putBoolean(Const.Key.MAGISKHIDE, mm.magiskHide)
.putBoolean(Const.Key.UPDATE_NOTIFICATION, mm.updateNotification)
.putBoolean(Const.Key.HOSTS, Utils.itemExist(Const.MAGISK_HOST_FILE))
.putBoolean(Const.Key.HOSTS, Utils.itemExist(Const.MAGISK_HOST_FILE()))
.putBoolean(Const.Key.DISABLE, Utils.itemExist(Const.MAGISK_DISABLE_FILE))
.putBoolean(Const.Key.SU_REAUTH, mm.suReauth)
.putString(Const.Key.SU_REQUEST_TIMEOUT, String.valueOf(mm.suRequestTimeout))

View File

@ -11,7 +11,7 @@ import java.util.List;
public class LoadModules extends ParallelTask<Void, Void, Void> {
private List<String> getModList() {
String command = "ls -d " + Const.MAGISK_PATH + "/* | grep -v lost+found";
String command = "ls -d " + Const.MAGISK_PATH() + "/* | grep -v lost+found";
return Shell.su(command);
}

View File

@ -20,12 +20,22 @@ public class Const {
// Paths
public static final String MAGISK_DISABLE_FILE = "/cache/.disable_magisk";
public static final String MAGISK_HOST_FILE = "/magisk/.core/hosts";
public static final String TMP_FOLDER_PATH = "/dev/tmp";
public static final String MAGISK_PATH = "/magisk";
public static final String MAGISK_LOG = "/cache/magisk.log";
public static final String BUSYBOXPATH = "/dev/magisk/bin";
public static String MAGISK_PATH() {
if (Utils.itemExist("/dev/magisk/img")) {
return "/dev/magisk/img";
} else {
return "/magisk";
}
}
public static String MAGISK_HOST_FILE() {
return MAGISK_PATH() + "/.core/hosts";
}
/* A list of apps that should not be shown as hide-able */
public static final List<String> SN_BLACKLIST = Arrays.asList(
"android",