Properly detect hosts file
This commit is contained in:
parent
a3abb86daa
commit
5762ded601
@ -44,6 +44,7 @@ import java.util.concurrent.ExecutionException;
|
|||||||
public class MagiskManager extends Application {
|
public class MagiskManager extends Application {
|
||||||
|
|
||||||
public static final String MAGISK_DISABLE_FILE = "/cache/.disable_magisk";
|
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 TMP_FOLDER_PATH = "/dev/tmp";
|
||||||
public static final String MAGISK_PATH = "/magisk";
|
public static final String MAGISK_PATH = "/magisk";
|
||||||
public static final String INTENT_SECTION = "section";
|
public static final String INTENT_SECTION = "section";
|
||||||
@ -264,7 +265,7 @@ public class MagiskManager extends Application {
|
|||||||
.putBoolean("dark_theme", isDarkTheme)
|
.putBoolean("dark_theme", isDarkTheme)
|
||||||
.putBoolean("magiskhide", magiskHide)
|
.putBoolean("magiskhide", magiskHide)
|
||||||
.putBoolean("notification", updateNotification)
|
.putBoolean("notification", updateNotification)
|
||||||
.putBoolean("hosts", new File("/magisk/.core/hosts").exists())
|
.putBoolean("hosts", Utils.itemExist(shell, MAGISK_HOST_FILE))
|
||||||
.putBoolean("disable", Utils.itemExist(shell, MAGISK_DISABLE_FILE))
|
.putBoolean("disable", Utils.itemExist(shell, MAGISK_DISABLE_FILE))
|
||||||
.putBoolean("su_reauth", suReauth)
|
.putBoolean("su_reauth", suReauth)
|
||||||
.putString("su_request_timeout", String.valueOf(suRequestTimeout))
|
.putString("su_request_timeout", String.valueOf(suRequestTimeout))
|
||||||
|
@ -221,12 +221,12 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
|
|||||||
enabled = prefs.getBoolean("hosts", false);
|
enabled = prefs.getBoolean("hosts", false);
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
getShell().su_raw(
|
getShell().su_raw(
|
||||||
"cp -af /system/etc/hosts /magisk/.core/hosts",
|
"cp -af /system/etc/hosts " + MagiskManager.MAGISK_HOST_FILE,
|
||||||
"mount -o bind /magisk/.core/hosts /system/etc/hosts");
|
"mount -o bind " + MagiskManager.MAGISK_HOST_FILE + " /system/etc/hosts");
|
||||||
} else {
|
} else {
|
||||||
getShell().su_raw(
|
getShell().su_raw(
|
||||||
"umount -l /system/etc/hosts",
|
"umount -l /system/etc/hosts",
|
||||||
"rm -f /magisk/.core/hosts");
|
"rm -f " + MagiskManager.MAGISK_HOST_FILE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "su_access":
|
case "su_access":
|
||||||
|
Loading…
Reference in New Issue
Block a user