From 609fd8e2921a6c6a8238b7d469980d801bbcc79b Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Mon, 4 Oct 2021 16:54:02 +0200 Subject: Add Strictmode to remoteExample --- remoteExample/src/main/AndroidManifest.xml | 3 ++- .../openvpn/remote/RemoteExampleApplication.java | 29 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 remoteExample/src/main/java/de/blinkt/openvpn/remote/RemoteExampleApplication.java (limited to 'remoteExample') 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 @@ 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); + } +} -- cgit v1.2.3