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()
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
compileSdkVersion 31
buildToolsVersion "31.0.0"
defaultConfig {
applicationId "org.itxtech.daedalus"
minSdkVersion 21
targetSdkVersion 28
targetSdkVersion 31
versionCode 20
versionName "1.14.1"
@ -52,22 +52,22 @@ configurations {
dependencies {
//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.percentlayout:percentlayout:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha08'
implementation 'androidx.recyclerview:recyclerview:1.1.0-beta01'
implementation 'com.google.android.material:material:1.7.0-alpha01'
implementation 'androidx.recyclerview:recyclerview:1.3.0-alpha02'
//DNS
implementation 'org.pcap4j:pcap4j-core:1.7.6'
implementation 'org.pcap4j:pcap4j-packetfactory-static:1.7.6'
implementation 'org.minidns:minidns-client:0.3.4'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.okhttp3:okhttp:3.14.1'
implementation 'org.minidns:minidns-client:1.0.3'
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
//Analytics
googleReleaseImplementation 'com.google.firebase:firebase-core:17.0.1'
googleReleaseImplementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
googleReleaseImplementation 'com.google.firebase:firebase-core:21.0.0'
googleReleaseImplementation 'com.crashlytics.sdk.android:crashlytics:17.2.2'
}
apply plugin: 'com.google.gms.google-services'

View File

@ -18,7 +18,8 @@
android:theme="@style/AppTheme">
<service
android:name=".service.DaedalusVpnService"
android:permission="android.permission.BIND_VPN_SERVICE">
android:permission="android.permission.BIND_VPN_SERVICE"
android:exported="false">
<intent-filter>
<action android:name="android.net.VpnService"/>
</intent-filter>
@ -27,13 +28,15 @@
android:name=".service.DaedalusTileService"
android:label="@string/app_name"
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>
<action android:name="android.service.quicksettings.action.QS_TILE"/>
</intent-filter>
</service>
<receiver android:name=".receiver.BootBroadcastReceiver">
<receiver android:name=".receiver.BootBroadcastReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
@ -54,7 +57,8 @@
android:configChanges="keyboard|keyboardHidden|screenLayout|uiMode|orientation|screenSize|smallestScreenSize"
android:label="@string/app_name"
android:launchMode="singleTask"
android:theme="@style/AppTheme.NoActionBar.TransparentStatusBar">
android:theme="@style/AppTheme.NoActionBar.TransparentStatusBar"
android:exported="false">
<intent-filter>
<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) {
super.onActivityResult(request, result, data);
if (result == Activity.RESULT_OK) {
DaedalusVpnService.primaryServer = DNSServerHelper.getAddressById(DNSServerHelper.getPrimary());
DaedalusVpnService.secondaryServer = DNSServerHelper.getAddressById(DNSServerHelper.getSecondary());

View File

@ -171,7 +171,7 @@ public class DNSTestFragment extends ToolbarFragment {
.setQrFlag(false);
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();
if (response.answerSection.size() > 0) {
@ -284,7 +284,7 @@ public class DNSTestFragment extends ToolbarFragment {
}
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);
}
}

View File

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

View File

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