Fixed startActivity bugs on Android 6.0 and below
This commit is contained in:
parent
885b1f1779
commit
1f4957a476
@ -78,9 +78,9 @@ public class Daedalus extends Application {
|
||||
|
||||
public static Configurations configurations;
|
||||
|
||||
public static String hostsPath;
|
||||
public static String dnsmasqPath;
|
||||
private static String configPath;
|
||||
public static String hostsPath = null;
|
||||
public static String dnsmasqPath = null;
|
||||
private static String configPath = null;
|
||||
|
||||
private static Daedalus instance = null;
|
||||
private static SharedPreferences prefs;
|
||||
@ -93,12 +93,14 @@ public class Daedalus extends Application {
|
||||
mHostsResolver = new Thread(new RulesResolver());
|
||||
mHostsResolver.start();
|
||||
|
||||
hostsPath = getExternalFilesDir(null).getPath() + "/hosts";
|
||||
dnsmasqPath = getExternalFilesDir(null).getPath() + "/dnsmasq/";
|
||||
configPath = getExternalFilesDir(null).getPath() + "/config.json";
|
||||
if (getExternalFilesDir(null) != null) {
|
||||
hostsPath = getExternalFilesDir(null).getPath() + "/hosts";
|
||||
dnsmasqPath = getExternalFilesDir(null).getPath() + "/dnsmasq/";
|
||||
configPath = getExternalFilesDir(null).getPath() + "/config.json";
|
||||
|
||||
File file = new File(dnsmasqPath);
|
||||
Log.d(TAG, "mkdir result: " + file.mkdirs());
|
||||
File file = new File(dnsmasqPath);
|
||||
Log.d(TAG, "mkdir result: " + file.mkdirs());
|
||||
}
|
||||
|
||||
initData();
|
||||
|
||||
@ -109,7 +111,11 @@ public class Daedalus extends Application {
|
||||
PreferenceManager.setDefaultValues(this, R.xml.perf_settings, false);
|
||||
prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
||||
configurations = Configurations.load(new File(configPath));
|
||||
if (configPath != null) {
|
||||
configurations = Configurations.load(new File(configPath));
|
||||
} else {
|
||||
configurations = new Configurations();
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T parseJson(Class<T> beanClass, JsonReader reader) throws JsonParseException {
|
||||
|
@ -26,6 +26,7 @@ public class BootBroadcastReceiver extends BroadcastReceiver {
|
||||
if (Daedalus.getPrefs().getBoolean("settings_boot", false)) {
|
||||
Intent vIntent = VpnService.prepare(context);
|
||||
if (vIntent != null) {
|
||||
vIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(vIntent);
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ public class StatusBarBroadcastReceiver extends BroadcastReceiver {
|
||||
}
|
||||
if (intent.getAction().equals(STATUS_BAR_BTN_SETTINGS_CLICK_ACTION)) {
|
||||
Intent settingsIntent = new Intent(context, MainActivity.class).putExtra(MainActivity.LAUNCH_FRAGMENT, MainActivity.FRAGMENT_SETTINGS);
|
||||
settingsIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
settingsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(settingsIntent);
|
||||
try {
|
||||
Object statusBarManager = context.getSystemService("statusbar");
|
||||
|
@ -173,7 +173,7 @@ public class DaedalusVpnService extends VpnService implements Runnable {
|
||||
try {
|
||||
Builder builder = new Builder();
|
||||
String format = null;
|
||||
for (String prefix : new String[]{"192.0.2", "198.51.100", "203.0.113", "10.0.0", "192.168.50"}) {
|
||||
for (String prefix : new String[]{"10.0.0", "192.0.2", "198.51.100", "203.0.113", "192.168.50"}) {
|
||||
try {
|
||||
builder.addAddress(prefix + ".1", 24);
|
||||
} catch (IllegalArgumentException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user