migrate to api31

This commit is contained in:
PeratX 2022-05-23 11:47:15 +08:00
parent 7232206618
commit 59ee8eb461
6 changed files with 29 additions and 24 deletions

View File

@ -4,12 +4,12 @@ apply plugin: 'io.fabric'
def gitCommit = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim() def gitCommit = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
android { android {
compileSdkVersion 28 compileSdkVersion 31
buildToolsVersion "28.0.3" buildToolsVersion "31.0.0"
defaultConfig { defaultConfig {
applicationId "org.itxtech.daedalus" applicationId "org.itxtech.daedalus"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 28 targetSdkVersion 31
versionCode 20 versionCode 20
versionName "1.14.1" versionName "1.14.1"
@ -52,22 +52,22 @@ configurations {
dependencies { dependencies {
//Support //Support
implementation 'androidx.appcompat:appcompat:1.1.0-rc01' implementation 'androidx.appcompat:appcompat:1.6.0-alpha04'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.percentlayout:percentlayout:1.0.0' implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha08' implementation 'com.google.android.material:material:1.7.0-alpha01'
implementation 'androidx.recyclerview:recyclerview:1.1.0-beta01' implementation 'androidx.recyclerview:recyclerview:1.3.0-alpha02'
//DNS //DNS
implementation 'org.pcap4j:pcap4j-core:1.7.6' implementation 'org.pcap4j:pcap4j-core:1.7.6'
implementation 'org.pcap4j:pcap4j-packetfactory-static:1.7.6' implementation 'org.pcap4j:pcap4j-packetfactory-static:1.7.6'
implementation 'org.minidns:minidns-client:0.3.4' implementation 'org.minidns:minidns-client:1.0.3'
implementation 'com.google.code.gson:gson:2.8.5' implementation 'com.google.code.gson:gson:2.9.0'
implementation 'com.squareup.okhttp3:okhttp:3.14.1' implementation 'com.squareup.okhttp3:okhttp:4.9.3'
//Analytics //Analytics
googleReleaseImplementation 'com.google.firebase:firebase-core:17.0.1' googleReleaseImplementation 'com.google.firebase:firebase-core:21.0.0'
googleReleaseImplementation 'com.crashlytics.sdk.android:crashlytics:2.10.1' googleReleaseImplementation 'com.crashlytics.sdk.android:crashlytics:17.2.2'
} }
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'

View File

@ -18,7 +18,8 @@
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<service <service
android:name=".service.DaedalusVpnService" android:name=".service.DaedalusVpnService"
android:permission="android.permission.BIND_VPN_SERVICE"> android:permission="android.permission.BIND_VPN_SERVICE"
android:exported="false">
<intent-filter> <intent-filter>
<action android:name="android.net.VpnService"/> <action android:name="android.net.VpnService"/>
</intent-filter> </intent-filter>
@ -27,13 +28,15 @@
android:name=".service.DaedalusTileService" android:name=".service.DaedalusTileService"
android:label="@string/app_name" android:label="@string/app_name"
android:icon="@drawable/ic_security" android:icon="@drawable/ic_security"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"> android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
android:exported="false">
<intent-filter> <intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE"/> <action android:name="android.service.quicksettings.action.QS_TILE"/>
</intent-filter> </intent-filter>
</service> </service>
<receiver android:name=".receiver.BootBroadcastReceiver"> <receiver android:name=".receiver.BootBroadcastReceiver"
android:exported="false">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/> <action android:name="android.intent.action.BOOT_COMPLETED"/>
@ -54,7 +57,8 @@
android:configChanges="keyboard|keyboardHidden|screenLayout|uiMode|orientation|screenSize|smallestScreenSize" android:configChanges="keyboard|keyboardHidden|screenLayout|uiMode|orientation|screenSize|smallestScreenSize"
android:label="@string/app_name" android:label="@string/app_name"
android:launchMode="singleTask" android:launchMode="singleTask"
android:theme="@style/AppTheme.NoActionBar.TransparentStatusBar"> android:theme="@style/AppTheme.NoActionBar.TransparentStatusBar"
android:exported="false">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>

View File

@ -175,6 +175,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
} }
public void onActivityResult(int request, int result, Intent data) { public void onActivityResult(int request, int result, Intent data) {
super.onActivityResult(request, result, data);
if (result == Activity.RESULT_OK) { if (result == Activity.RESULT_OK) {
DaedalusVpnService.primaryServer = DNSServerHelper.getAddressById(DNSServerHelper.getPrimary()); DaedalusVpnService.primaryServer = DNSServerHelper.getAddressById(DNSServerHelper.getPrimary());
DaedalusVpnService.secondaryServer = DNSServerHelper.getAddressById(DNSServerHelper.getSecondary()); DaedalusVpnService.secondaryServer = DNSServerHelper.getAddressById(DNSServerHelper.getSecondary());

View File

@ -171,7 +171,7 @@ public class DNSTestFragment extends ToolbarFragment {
.setQrFlag(false); .setQrFlag(false);
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
DnsMessage response = dnsQuery.query(message.build(), InetAddress.getByName(server.getAddress()), server.getPort()); DnsMessage response = dnsQuery.queryDns(message.build(), InetAddress.getByName(server.getAddress()), server.getPort());
long endTime = System.currentTimeMillis(); long endTime = System.currentTimeMillis();
if (response.answerSection.size() > 0) { if (response.answerSection.size() > 0) {
@ -284,7 +284,7 @@ public class DNSTestFragment extends ToolbarFragment {
} }
private class DnsQuery extends NetworkDataSource { private class DnsQuery extends NetworkDataSource {
public DnsMessage query(DnsMessage message, InetAddress address, int port) throws IOException { public DnsMessage queryDns(DnsMessage message, InetAddress address, int port) throws IOException {
return queryUdp(message, address, port); return queryUdp(message, address, port);
} }
} }

View File

@ -129,7 +129,7 @@ public class RuleResolver implements Runnable {
dataIO.close(); dataIO.close();
stream.close(); stream.close();
Logger.info("Loaded " + String.valueOf(count) + " rules"); Logger.info("Loaded " + count + " rules");
} }
} }
} else if (mode == MODE_DNSMASQ) { } else if (mode == MODE_DNSMASQ) {
@ -147,7 +147,7 @@ public class RuleResolver implements Runnable {
data = strLine.split("/"); data = strLine.split("/");
if (data.length == 3 && data[0].equals("address=")) { if (data.length == 3 && data[0].equals("address=")) {
if (data[1].startsWith(".")) { if (data[1].startsWith(".")) {
data[1] = data[1].substring(1, data[1].length()); data[1] = data[1].substring(1);
} }
if (strLine.contains(":")) {//IPv6 if (strLine.contains(":")) {//IPv6
rulesAAAA.put(data[1], data[2]); rulesAAAA.put(data[1], data[2]);
@ -162,7 +162,7 @@ public class RuleResolver implements Runnable {
dataIO.close(); dataIO.close();
stream.close(); stream.close();
Logger.info("Loaded " + String.valueOf(count) + " rules"); Logger.info("Loaded " + count + " rules");
} }
} }
} }

View File

@ -2,22 +2,22 @@
buildscript { buildscript {
repositories { repositories {
jcenter() mavenCentral()
google() google()
maven { maven {
url 'https://maven.fabric.io/public' url 'https://maven.fabric.io/public'
} }
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.4.2' classpath 'com.android.tools.build:gradle:7.0.4'
classpath 'com.google.gms:google-services:4.3.0' classpath 'com.google.gms:google-services:4.3.10'
classpath 'io.fabric.tools:gradle:1.28.1' classpath 'io.fabric.tools:gradle:1.28.1'
} }
} }
allprojects { allprojects {
repositories { repositories {
jcenter() mavenCentral()
google() google()
} }
} }