diff --git a/app/build.gradle b/app/build.gradle index 0a59f11..e36e0d9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.itxtech.daedalus" minSdkVersion 21 targetSdkVersion 28 - versionCode 19 - versionName "1.14.0" + versionCode 20 + versionName "1.14.1" buildConfigField "String", "BUILD_TIME", "\"${System.currentTimeMillis()}\"" buildConfigField "String", "GIT_COMMIT", "\"${gitCommit}\"" diff --git a/app/src/main/java/org/itxtech/daedalus/service/DaedalusVpnService.java b/app/src/main/java/org/itxtech/daedalus/service/DaedalusVpnService.java index 7daf8f8..ccae93f 100644 --- a/app/src/main/java/org/itxtech/daedalus/service/DaedalusVpnService.java +++ b/app/src/main/java/org/itxtech/daedalus/service/DaedalusVpnService.java @@ -125,7 +125,6 @@ public class DaedalusVpnService extends VpnService implements Runnable { this.notification = builder; } - DNSServerHelper.buildCache(); Daedalus.initRuleResolver(); if (this.mThread == null) { @@ -232,6 +231,7 @@ public class DaedalusVpnService extends VpnService implements Runnable { @Override public void run() { try { + DNSServerHelper.buildCache(); Builder builder = new Builder() .setSession("Daedalus") .setConfigureIntent(PendingIntent.getActivity(this, 0, @@ -250,6 +250,7 @@ public class DaedalusVpnService extends VpnService implements Runnable { } else { builder.addAllowedApplication(app); } + Logger.debug("Added app to list: " + app); } catch (PackageManager.NameNotFoundException e) { Logger.error("Package Not Found:" + app); } diff --git a/app/src/main/java/org/itxtech/daedalus/util/server/DNSServerHelper.java b/app/src/main/java/org/itxtech/daedalus/util/server/DNSServerHelper.java index 09e9ac4..ce8b814 100644 --- a/app/src/main/java/org/itxtech/daedalus/util/server/DNSServerHelper.java +++ b/app/src/main/java/org/itxtech/daedalus/util/server/DNSServerHelper.java @@ -26,23 +26,24 @@ import java.util.List; * (at your option) any later version. */ public class DNSServerHelper { - private static HashMap portCache = null; - public static HashMap> domainCache = null; + private static HashMap portCache = new HashMap<>(); + public static HashMap> domainCache = new HashMap<>(); public static void clearCache() { - portCache = null; - domainCache = null; + portCache = new HashMap<>(); + domainCache = new HashMap<>(); } public static void buildCache() { domainCache = new HashMap<>(); + portCache = new HashMap<>(); + if (ProviderPicker.getDnsQueryMethod() >= ProviderPicker.DNS_QUERY_METHOD_HTTPS_IETF && !Daedalus.getPrefs().getBoolean("settings_dont_build_doh_cache", false)) { buildDomainCache(getAddressById(getPrimary())); buildDomainCache(getAddressById(getSecondary())); } - portCache = new HashMap<>(); for (DNSServer server : Daedalus.DNS_SERVERS) { portCache.put(server.getAddress(), server.getPort()); }