summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2021-10-04 16:54:02 +0200
committerArne Schwabe <arne@rfc2549.org>2021-10-04 16:54:02 +0200
commit609fd8e2921a6c6a8238b7d469980d801bbcc79b (patch)
treeb231de2645368b2382da511fa4a83fdbe1cc7049
parentbcb6673af60694ce92f6ff2ce0a84c3352c3ad3b (diff)
Add Strictmode to remoteExample
-rw-r--r--remoteExample/src/main/AndroidManifest.xml3
-rw-r--r--remoteExample/src/main/java/de/blinkt/openvpn/remote/RemoteExampleApplication.java29
2 files changed, 31 insertions, 1 deletions
diff --git a/remoteExample/src/main/AndroidManifest.xml b/remoteExample/src/main/AndroidManifest.xml
index 2dce4ae9..8ba7ec79 100644
--- a/remoteExample/src/main/AndroidManifest.xml
+++ b/remoteExample/src/main/AndroidManifest.xml
@@ -11,7 +11,8 @@
<uses-permission android:name="android.permission.INTERNET" />
<application
- android:allowBackup="true"
+ android:name=".RemoteExampleApplication"
+ android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
diff --git a/remoteExample/src/main/java/de/blinkt/openvpn/remote/RemoteExampleApplication.java b/remoteExample/src/main/java/de/blinkt/openvpn/remote/RemoteExampleApplication.java
new file mode 100644
index 00000000..e3c6e5f5
--- /dev/null
+++ b/remoteExample/src/main/java/de/blinkt/openvpn/remote/RemoteExampleApplication.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2012-2021 Arne Schwabe
+ * Distributed under the GNU GPL v2 with additional terms. For full terms see the file doc/LICENSE.txt
+ */
+
+package de.blinkt.openvpn.remote;
+
+import android.app.Application;
+import android.os.Build;
+import android.os.StrictMode;
+
+public class RemoteExampleApplication extends Application {
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ if (BuildConfig.BUILD_TYPE.equals("debug"))
+ enableStrictModes();
+
+ }
+ private void enableStrictModes() {
+ StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder()
+ .detectAll()
+ .penaltyLog();
+ //builder.penaltyDeath();
+
+ StrictMode.VmPolicy policy = builder.build();
+ StrictMode.setVmPolicy(policy);
+ }
+}