Various bug fixes on Android 4.x
This commit is contained in:
parent
7dcb8b2643
commit
0fd28c1e2b
@ -21,7 +21,7 @@ DNS server providers
|
||||
|
||||
Requirements
|
||||
-------------
|
||||
* Minimum Android version: 4.0.4 (API 15) - __*Basic VPN functions*__
|
||||
* Minimum Android version: 4.0.3 (API 15) - __*Basic VPN functions*__
|
||||
* Recommended Android version: >= 5.0 (API 21) - __*Full features*__
|
||||
* Best Android version: >= 7.1 (API 25) - __*Launcher shortcuts*__
|
||||
|
||||
|
@ -52,6 +52,7 @@ public class DaedalusVpnService extends VpnService implements Runnable {
|
||||
private long lastUpdate = 0;
|
||||
private boolean statisticQuery;
|
||||
private DnsProvider provider;
|
||||
private ParcelFileDescriptor descriptor;
|
||||
|
||||
private Thread mThread = null;
|
||||
|
||||
@ -121,14 +122,21 @@ public class DaedalusVpnService extends VpnService implements Runnable {
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
private void stopThread() {
|
||||
boolean shouldRefresh = false;
|
||||
try {
|
||||
if (this.descriptor != null) {
|
||||
this.descriptor.close();
|
||||
this.descriptor = null;
|
||||
}
|
||||
if (mThread != null) {
|
||||
running = false;
|
||||
shouldRefresh = true;
|
||||
provider.shutdown();
|
||||
mThread.interrupt();
|
||||
provider.stop();
|
||||
if (provider != null) {
|
||||
provider.shutdown();
|
||||
mThread.interrupt();
|
||||
provider.stop();
|
||||
} else {
|
||||
mThread.interrupt();
|
||||
}
|
||||
mThread = null;
|
||||
}
|
||||
if (notification != null) {
|
||||
NotificationManager notificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
@ -137,17 +145,18 @@ public class DaedalusVpnService extends VpnService implements Runnable {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d(TAG, e.toString());
|
||||
}
|
||||
stopSelf();
|
||||
} finally {
|
||||
stopSelf();
|
||||
|
||||
if (shouldRefresh && MainActivity.getInstance() != null && Daedalus.getInstance().isAppOnForeground()) {
|
||||
MainActivity.getInstance().startActivity(new Intent(getApplicationContext(), MainActivity.class).putExtra(MainActivity.LAUNCH_ACTION, MainActivity.LAUNCH_ACTION_AFTER_DEACTIVATE));
|
||||
} else if (shouldRefresh) {
|
||||
Daedalus.updateShortcut(getApplicationContext());
|
||||
}
|
||||
if (MainActivity.getInstance() != null && Daedalus.getInstance().isAppOnForeground()) {
|
||||
MainActivity.getInstance().startActivity(new Intent(getApplicationContext(), MainActivity.class).putExtra(MainActivity.LAUNCH_ACTION, MainActivity.LAUNCH_ACTION_AFTER_DEACTIVATE));
|
||||
} else {
|
||||
Daedalus.updateShortcut(getApplicationContext());
|
||||
}
|
||||
|
||||
HostsResolver.clean();
|
||||
DnsServerHelper.cleanPortCache();
|
||||
HostsResolver.clean();
|
||||
DnsServerHelper.cleanPortCache();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -190,7 +199,7 @@ public class DaedalusVpnService extends VpnService implements Runnable {
|
||||
.setBlocking(true);
|
||||
}
|
||||
|
||||
ParcelFileDescriptor descriptor = builder.establish();
|
||||
descriptor = builder.establish();
|
||||
|
||||
if (advanced) {
|
||||
if (Daedalus.getPrefs().getBoolean("settings_dns_over_tcp", false)) {
|
||||
|
@ -5,15 +5,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fab_add_server"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:src="@drawable/ic_note_add"
|
||||
android:tint="#FFFFFF"/>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/recyclerView_dns_servers"
|
||||
android:layout_width="match_parent"
|
||||
@ -23,4 +14,13 @@
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fab_add_server"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:src="@drawable/ic_note_add"
|
||||
android:tint="#FFFFFF"/>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
Loading…
Reference in New Issue
Block a user