summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2021-10-04 16:55:35 +0200
committerArne Schwabe <arne@rfc2549.org>2021-10-04 16:55:35 +0200
commite171dca738a8a46ae29d82512e9ff9b17d50b63f (patch)
tree0513dd595fb7c266365c73e375c326fe3a06e2ff /main
parentcf093699bdccb3975566f3e157e1c2ed3eb7f951 (diff)
Minor cleanups
Diffstat (limited to 'main')
-rw-r--r--main/src/main/java/de/blinkt/openvpn/api/ConfirmDialog.java1
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/LogFileHandler.java11
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/StatusListener.java5
-rw-r--r--main/src/skeleton/AndroidManifest.xml3
4 files changed, 16 insertions, 4 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/api/ConfirmDialog.java b/main/src/main/java/de/blinkt/openvpn/api/ConfirmDialog.java
index f07bfc87..3ae7ef4a 100644
--- a/main/src/main/java/de/blinkt/openvpn/api/ConfirmDialog.java
+++ b/main/src/main/java/de/blinkt/openvpn/api/ConfirmDialog.java
@@ -139,6 +139,7 @@ public class ConfirmDialog extends Activity implements
@Override
public void onBackPressed() {
+ super.onBackPressed();
setResult(RESULT_CANCELED);
finish();
}
diff --git a/main/src/main/java/de/blinkt/openvpn/core/LogFileHandler.java b/main/src/main/java/de/blinkt/openvpn/core/LogFileHandler.java
index c77e1c2f..3d2da517 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/LogFileHandler.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/LogFileHandler.java
@@ -127,14 +127,14 @@ class LogFileHandler extends Handler {
}
private void readLogCache(File cacheDir) {
+ FileInputStream log = null;
try {
File logfile = new File(cacheDir, LOGFILE_NAME);
-
if (!logfile.exists() || !logfile.canRead())
return;
- FileInputStream log = new FileInputStream(logfile);
+ log = new FileInputStream(logfile);
readCacheContents(log);
log.close();
@@ -148,6 +148,13 @@ class LogFileHandler extends Handler {
VpnStatus.readFileLog = true;
VpnStatus.readFileLock.notifyAll();
}
+ if (log != null) {
+ try {
+ log.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
}
}
diff --git a/main/src/main/java/de/blinkt/openvpn/core/StatusListener.java b/main/src/main/java/de/blinkt/openvpn/core/StatusListener.java
index 2a1166ce..13a88974 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/StatusListener.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/StatusListener.java
@@ -28,7 +28,7 @@ import java.io.IOException;
public class StatusListener implements VpnStatus.LogListener {
private File mCacheDir;
private Context mContext;
- private IStatusCallbacks mCallback = new IStatusCallbacks.Stub() {
+ private final IStatusCallbacks mCallback = new IStatusCallbacks.Stub() {
@Override
public void newLogItem(LogItem item) throws RemoteException {
VpnStatus.newLogItem(item);
@@ -50,7 +50,7 @@ public class StatusListener implements VpnStatus.LogListener {
VpnStatus.setConnectedVPNProfile(uuid);
}
};
- private ServiceConnection mConnection = new ServiceConnection() {
+ private final ServiceConnection mConnection = new ServiceConnection() {
@Override
@@ -76,6 +76,7 @@ public class StatusListener implements VpnStatus.LogListener {
len = fd.readShort();
}
fd.close();
+ pfd.close();
} else {
diff --git a/main/src/skeleton/AndroidManifest.xml b/main/src/skeleton/AndroidManifest.xml
index 054d61e7..02a91024 100644
--- a/main/src/skeleton/AndroidManifest.xml
+++ b/main/src/skeleton/AndroidManifest.xml
@@ -9,15 +9,18 @@
<application tools:ignore="AllowBackup,GoogleAppIndexingWarning">
<activity
+ android:exported="true"
android:name=".activities.NotImplemented"
tools:ignore="ExportedActivity" />
<activity-alias
+ android:exported="true"
android:name=".activities.LogWindow"
android:targetActivity=".activities.NotImplemented"
/>
<activity-alias
+ android:exported="true"
android:name=".activities.Req"
android:targetActivity=".activities.NotImplemented"
/>