mirror of https://github.com/M66B/NetGuard.git
Move hosts file to data folder
This commit is contained in:
parent
2ca17cd4a7
commit
e1127183e1
|
@ -180,7 +180,7 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
|
||||||
// Handle hosts
|
// Handle hosts
|
||||||
Preference pref_hosts = screen.findPreference("hosts");
|
Preference pref_hosts = screen.findPreference("hosts");
|
||||||
Preference pref_block_domains = screen.findPreference("use_hosts");
|
Preference pref_block_domains = screen.findPreference("use_hosts");
|
||||||
pref_block_domains.setEnabled(new File(getCacheDir(), "hosts.txt").exists());
|
pref_block_domains.setEnabled(new File(getFilesDir(), "hosts.txt").exists());
|
||||||
|
|
||||||
if (Util.isPlayStoreInstall(this)) {
|
if (Util.isPlayStoreInstall(this)) {
|
||||||
PreferenceCategory pref_backup = (PreferenceCategory) screen.findPreference("category_backup");
|
PreferenceCategory pref_backup = (PreferenceCategory) screen.findPreference("category_backup");
|
||||||
|
@ -615,7 +615,7 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
|
||||||
new AsyncTask<Object, Object, Throwable>() {
|
new AsyncTask<Object, Object, Throwable>() {
|
||||||
@Override
|
@Override
|
||||||
protected Throwable doInBackground(Object... objects) {
|
protected Throwable doInBackground(Object... objects) {
|
||||||
File hosts = new File(getCacheDir(), "hosts.txt");
|
File hosts = new File(getFilesDir(), "hosts.txt");
|
||||||
|
|
||||||
FileOutputStream out = null;
|
FileOutputStream out = null;
|
||||||
InputStream in = null;
|
InputStream in = null;
|
||||||
|
|
|
@ -726,7 +726,7 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
|
||||||
boolean use_hosts = prefs.getBoolean("use_hosts", false);
|
boolean use_hosts = prefs.getBoolean("use_hosts", false);
|
||||||
if (log || filter) {
|
if (log || filter) {
|
||||||
int prio = Integer.parseInt(prefs.getString("loglevel", Integer.toString(Log.INFO)));
|
int prio = Integer.parseInt(prefs.getString("loglevel", Integer.toString(Log.INFO)));
|
||||||
File hosts = new File(getCacheDir(), "hosts.txt");
|
File hosts = new File(getFilesDir(), "hosts.txt");
|
||||||
String hname = (use_hosts && hosts.exists() ? hosts.getAbsolutePath() : null);
|
String hname = (use_hosts && hosts.exists() ? hosts.getAbsolutePath() : null);
|
||||||
jni_start(vpn.getFd(), getAllowedUids(listAllowed), hname, log, filter, prio);
|
jni_start(vpn.getFd(), getAllowedUids(listAllowed), hname, log, filter, prio);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue