From 4e0ee9a96613757d243e4aca837e5b5b13018052 Mon Sep 17 00:00:00 2001 From: PeratX <1215714524@qq.com> Date: Tue, 16 Jul 2019 19:30:24 +0800 Subject: [PATCH] api: now min sdk is 21, remove all TargetApi annotation --- .../org/itxtech/daedalus/fragment/RuleConfigFragment.java | 4 ---- .../java/org/itxtech/daedalus/provider/HttpsProvider.java | 3 --- .../main/java/org/itxtech/daedalus/provider/Provider.java | 5 +---- .../main/java/org/itxtech/daedalus/provider/TcpProvider.java | 3 --- .../main/java/org/itxtech/daedalus/provider/UdpProvider.java | 3 --- .../org/itxtech/daedalus/service/DaedalusVpnService.java | 3 --- .../java/org/itxtech/daedalus/widget/ClickPreference.java | 3 --- 7 files changed, 1 insertion(+), 23 deletions(-) diff --git a/app/src/main/java/org/itxtech/daedalus/fragment/RuleConfigFragment.java b/app/src/main/java/org/itxtech/daedalus/fragment/RuleConfigFragment.java index 883eddf..860c83c 100644 --- a/app/src/main/java/org/itxtech/daedalus/fragment/RuleConfigFragment.java +++ b/app/src/main/java/org/itxtech/daedalus/fragment/RuleConfigFragment.java @@ -1,11 +1,9 @@ package org.itxtech.daedalus.fragment; -import android.annotation.TargetApi; import android.app.Activity; import android.app.AlertDialog; import android.content.Intent; import android.net.Uri; -import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.Message; @@ -224,7 +222,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa return view; } - @TargetApi(Build.VERSION_CODES.KITKAT) private void performFileSearch() { Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); @@ -237,7 +234,6 @@ private void performFileSearch() { } @Override - @TargetApi(Build.VERSION_CODES.KITKAT) public void onActivityResult(int requestCode, int resultCode, Intent resultData) { if (requestCode == READ_REQUEST_CODE && resultCode == Activity.RESULT_OK) { if (resultData != null) { diff --git a/app/src/main/java/org/itxtech/daedalus/provider/HttpsProvider.java b/app/src/main/java/org/itxtech/daedalus/provider/HttpsProvider.java index b9b7a80..2acb812 100644 --- a/app/src/main/java/org/itxtech/daedalus/provider/HttpsProvider.java +++ b/app/src/main/java/org/itxtech/daedalus/provider/HttpsProvider.java @@ -1,7 +1,5 @@ package org.itxtech.daedalus.provider; -import android.annotation.TargetApi; -import android.os.Build; import android.os.ParcelFileDescriptor; import android.system.Os; import android.system.OsConstants; @@ -68,7 +66,6 @@ OkHttpClient getHttpClient(String accept) { .build(); } - @TargetApi(Build.VERSION_CODES.LOLLIPOP) public void process() { try { FileDescriptor[] pipes = Os.pipe(); diff --git a/app/src/main/java/org/itxtech/daedalus/provider/Provider.java b/app/src/main/java/org/itxtech/daedalus/provider/Provider.java index 4a9d681..3e623ef 100644 --- a/app/src/main/java/org/itxtech/daedalus/provider/Provider.java +++ b/app/src/main/java/org/itxtech/daedalus/provider/Provider.java @@ -1,7 +1,5 @@ package org.itxtech.daedalus.provider; -import android.annotation.TargetApi; -import android.os.Build; import android.os.ParcelFileDescriptor; import android.system.Os; import org.itxtech.daedalus.Daedalus; @@ -65,7 +63,6 @@ public final void shutdown() { running = false; } - @TargetApi(Build.VERSION_CODES.LOLLIPOP) public void stop() { try { if (mInterruptFd != null) { @@ -189,4 +186,4 @@ protected void readPacketFromDevice(FileInputStream inputStream, byte[] packet) } protected abstract void handleDnsRequest(byte[] packetData) throws DaedalusVpnService.VpnNetworkException; -} \ No newline at end of file +} diff --git a/app/src/main/java/org/itxtech/daedalus/provider/TcpProvider.java b/app/src/main/java/org/itxtech/daedalus/provider/TcpProvider.java index 202fca5..3768ea5 100644 --- a/app/src/main/java/org/itxtech/daedalus/provider/TcpProvider.java +++ b/app/src/main/java/org/itxtech/daedalus/provider/TcpProvider.java @@ -1,7 +1,5 @@ package org.itxtech.daedalus.provider; -import android.annotation.TargetApi; -import android.os.Build; import android.os.ParcelFileDescriptor; import android.system.ErrnoException; import android.system.Os; @@ -44,7 +42,6 @@ public TcpProvider(ParcelFileDescriptor descriptor, DaedalusVpnService service) super(descriptor, service); } - @TargetApi(Build.VERSION_CODES.LOLLIPOP) public void process() { try { FileDescriptor[] pipes = Os.pipe(); diff --git a/app/src/main/java/org/itxtech/daedalus/provider/UdpProvider.java b/app/src/main/java/org/itxtech/daedalus/provider/UdpProvider.java index cba4ed6..c51f5d3 100644 --- a/app/src/main/java/org/itxtech/daedalus/provider/UdpProvider.java +++ b/app/src/main/java/org/itxtech/daedalus/provider/UdpProvider.java @@ -1,7 +1,5 @@ package org.itxtech.daedalus.provider; -import android.annotation.TargetApi; -import android.os.Build; import android.os.ParcelFileDescriptor; import android.system.Os; import android.system.OsConstants; @@ -47,7 +45,6 @@ public UdpProvider(ParcelFileDescriptor descriptor, DaedalusVpnService service) super(descriptor, service); } - @TargetApi(Build.VERSION_CODES.LOLLIPOP) public void process() { try { FileDescriptor[] pipes = Os.pipe(); 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 62af8b8..7daf8f8 100644 --- a/app/src/main/java/org/itxtech/daedalus/service/DaedalusVpnService.java +++ b/app/src/main/java/org/itxtech/daedalus/service/DaedalusVpnService.java @@ -1,6 +1,5 @@ package org.itxtech.daedalus.service; -import android.annotation.TargetApi; import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; @@ -153,7 +152,6 @@ public void onDestroy() { stopThread(); } - @TargetApi(Build.VERSION_CODES.LOLLIPOP) private void stopThread() { Log.d(TAG, "stopThread"); activated = false; @@ -231,7 +229,6 @@ private InetAddress addDnsServer(Builder builder, String format, byte[] ipv6Temp return null; } - @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void run() { try { diff --git a/app/src/main/java/org/itxtech/daedalus/widget/ClickPreference.java b/app/src/main/java/org/itxtech/daedalus/widget/ClickPreference.java index 4553233..432bc04 100644 --- a/app/src/main/java/org/itxtech/daedalus/widget/ClickPreference.java +++ b/app/src/main/java/org/itxtech/daedalus/widget/ClickPreference.java @@ -1,8 +1,6 @@ package org.itxtech.daedalus.widget; -import android.annotation.TargetApi; import android.content.Context; -import android.os.Build; import android.preference.ListPreference; import android.util.AttributeSet; @@ -19,7 +17,6 @@ */ public class ClickPreference extends ListPreference { - @TargetApi(Build.VERSION_CODES.LOLLIPOP) public ClickPreference(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); }