summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2017-12-28 00:31:31 +0100
committerArne Schwabe <arne@rfc2549.org>2017-12-28 00:31:31 +0100
commit597e73a7dacd52145df8b86e53eba743755330a0 (patch)
tree2c4bfe8b90b544c9fec8147040a297d4904964ae
parent2b2dee6586048e62d066a3ea7b761649828b3aff (diff)
Minor fixes from crashes, fix lint issues
-rw-r--r--main/src/main/java/de/blinkt/openvpn/api/RemoteAction.java1
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java19
-rw-r--r--main/src/main/res/layout-v21/connection_fab.xml2
-rw-r--r--main/src/main/res/layout-v21/save_fab.xml4
-rw-r--r--main/src/main/res/layout-v21/share_fab.xml2
-rw-r--r--main/src/main/res/xml/general_settings.xml2
6 files changed, 21 insertions, 9 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/api/RemoteAction.java b/main/src/main/java/de/blinkt/openvpn/api/RemoteAction.java
index cac8efcb..5206d281 100644
--- a/main/src/main/java/de/blinkt/openvpn/api/RemoteAction.java
+++ b/main/src/main/java/de/blinkt/openvpn/api/RemoteAction.java
@@ -24,6 +24,7 @@ public class RemoteAction extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+
mExtAppDb = new ExternalAppDatabase(this);
}
diff --git a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
index a4b7b480..42199a8a 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
@@ -57,6 +57,8 @@ import de.blinkt.openvpn.core.VpnStatus.ByteCountListener;
import de.blinkt.openvpn.core.VpnStatus.StateListener;
import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_CONNECTED;
+import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_CONNECTING_NO_SERVER_REPLY_YET;
+import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_START;
import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_WAITING_FOR_USER_INPUT;
import static de.blinkt.openvpn.core.NetworkSpace.ipAddress;
@@ -253,6 +255,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
int notificationId = channel.hashCode();
mNotificationManager.notify(notificationId, notification);
+
startForeground(notificationId, notification);
if (lastChannel != null && !channel.equals(lastChannel)) {
@@ -467,6 +470,12 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
return START_REDELIVER_INTENT;
}
+ // Always show notification here to avoid problem with startForeground timeout
+ VpnStatus.logInfo(R.string.building_configration);
+ VpnStatus.updateStateString("VPN_GENERATE_CONFIG", "", R.string.building_configration, ConnectionStatus.LEVEL_START);
+ showNotification(VpnStatus.getLastCleanLogMessage(this),
+ VpnStatus.getLastCleanLogMessage(this), NOTIFICATION_CHANNEL_NEWSTATUS_ID, 0, ConnectionStatus.LEVEL_START);
+
if (intent != null && intent.hasExtra(getPackageName() + ".profileUUID")) {
String profileUUID = intent.getStringExtra(getPackageName() + ".profileUUID");
int profileVersion = intent.getIntExtra(getPackageName() + ".profileVersion", 0);
@@ -495,6 +504,12 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
mProfile.checkForRestart(this);
}
+ if (mProfile == null) {
+ stopSelf(startId);
+ return START_NOT_STICKY;
+ }
+
+
/* start the OpenVPN process itself in a background thread */
new Thread(new Runnable() {
@Override
@@ -519,10 +534,6 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
}
private void startOpenVPN() {
- VpnStatus.logInfo(R.string.building_configration);
- VpnStatus.updateStateString("VPN_GENERATE_CONFIG", "", R.string.building_configration, ConnectionStatus.LEVEL_START);
-
-
try {
mProfile.writeConfigFile(this);
} catch (IOException e) {
diff --git a/main/src/main/res/layout-v21/connection_fab.xml b/main/src/main/res/layout-v21/connection_fab.xml
index ea3964d9..e3e620d6 100644
--- a/main/src/main/res/layout-v21/connection_fab.xml
+++ b/main/src/main/res/layout-v21/connection_fab.xml
@@ -21,4 +21,4 @@
android:src="@android:drawable/ic_input_add"
android:stateListAnimator="@anim/fab_anim"
android:tint="@android:color/white"
- tools:showIn="@layout/connections" /> \ No newline at end of file
+ /> \ No newline at end of file
diff --git a/main/src/main/res/layout-v21/save_fab.xml b/main/src/main/res/layout-v21/save_fab.xml
index fbd583da..af7847e8 100644
--- a/main/src/main/res/layout-v21/save_fab.xml
+++ b/main/src/main/res/layout-v21/save_fab.xml
@@ -18,5 +18,5 @@
android:elevation="1dp"
android:src="@android:drawable/ic_menu_save"
android:stateListAnimator="@anim/fab_anim"
- android:tint="@android:color/white"
- tools:showIn="@layout/config_converter" /> \ No newline at end of file
+ android:tint="@android:color/white" />
+ <!--tools:showIn="@layout/config_converter" -->
diff --git a/main/src/main/res/layout-v21/share_fab.xml b/main/src/main/res/layout-v21/share_fab.xml
index 04049fe7..fb0d432f 100644
--- a/main/src/main/res/layout-v21/share_fab.xml
+++ b/main/src/main/res/layout-v21/share_fab.xml
@@ -19,4 +19,4 @@
android:src="@drawable/ic_menu_share"
android:stateListAnimator="@anim/fab_anim"
android:tint="@android:color/white"
- tools:showIn="@layout/viewconfig" /> \ No newline at end of file
+ /> \ No newline at end of file
diff --git a/main/src/main/res/xml/general_settings.xml b/main/src/main/res/xml/general_settings.xml
index 3b8ba4f5..250e2736 100644
--- a/main/src/main/res/xml/general_settings.xml
+++ b/main/src/main/res/xml/general_settings.xml
@@ -17,7 +17,7 @@
<CheckBoxPreference
android:defaultValue="false"
android:key="ovpn3"
- android:summaryOn="Use the C++ OpenVPN library"
+ android:summaryOn="Use the C++ OpenVPN library (experimental)"
android:summaryOff="Use OpenVPN 2.3"
android:title="OpenVPN 3 Core"/>