summaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/AndroidManifest.xml7
-rw-r--r--main/src/main/java/de/blinkt/openvpn/activities/MainActivity.java20
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/LogFileHandler.java1
3 files changed, 24 insertions, 4 deletions
diff --git a/main/src/main/AndroidManifest.xml b/main/src/main/AndroidManifest.xml
index 235f0924..2fb4629a 100644
--- a/main/src/main/AndroidManifest.xml
+++ b/main/src/main/AndroidManifest.xml
@@ -14,6 +14,7 @@
<!-- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+ <!-- <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" /> -->
<!-- <uses-permission android:name="com.android.vending.BILLING" /> -->
@@ -66,7 +67,7 @@
<service
android:name=".core.OpenVPNService"
- android:permission="android.permission.BIND_VPN_SERVICE">
+ android:permission="android.permission.BIND_VPN_SERVICE" >
<intent-filter>
<action android:name="android.net.VpnService" />
</intent-filter>
@@ -102,8 +103,8 @@
<activity
android:name=".activities.ConfigConverter"
- android:label="Convert Config File"
android:excludeFromRecents="true"
+ android:label="Convert Config File"
android:taskAffinity=".ConfigConverter"
android:uiOptions="splitActionBarWhenNarrow"
tools:ignore="ExportedActivity">
@@ -145,8 +146,8 @@
android:name=".LaunchVPN"
android:autoRemoveFromRecents="true"
android:excludeFromRecents="true"
- android:noHistory="true"
android:label="@string/vpn_launch_title"
+ android:noHistory="true"
android:taskAffinity=".LaunchVPN"
android:theme="@style/blinkt.dialog"
tools:ignore="ExportedActivity">
diff --git a/main/src/main/java/de/blinkt/openvpn/activities/MainActivity.java b/main/src/main/java/de/blinkt/openvpn/activities/MainActivity.java
index e04e5f21..8f1eca5b 100644
--- a/main/src/main/java/de/blinkt/openvpn/activities/MainActivity.java
+++ b/main/src/main/java/de/blinkt/openvpn/activities/MainActivity.java
@@ -8,9 +8,13 @@ package de.blinkt.openvpn.activities;
import android.annotation.TargetApi;
import android.app.ActionBar;
import android.app.Activity;
+import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
+import android.net.Uri;
import android.os.Build;
+import android.os.PowerManager;
+import android.provider.Settings;
import android.support.v4n.view.ViewPager;
import android.view.Menu;
import android.view.MenuItem;
@@ -67,8 +71,24 @@ public class MainActivity extends BaseActivity {
TabBarView tabs = (TabBarView) findViewById(R.id.sliding_tabs);
tabs.setViewPager(mPager);
+
+ // requestDozeDisable();
}
+ @TargetApi(Build.VERSION_CODES.M)
+ private void requestDozeDisable() {
+ Intent intent = new Intent();
+ String packageName = getPackageName();
+ PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
+ if (pm.isIgnoringBatteryOptimizations(packageName))
+ intent.setAction(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS);
+ else {
+ intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
+ intent.setData(Uri.parse("package:" + packageName));
+ }
+ startActivity(intent);
+ }
+
private static final String FEATURE_TELEVISION = "android.hardware.type.television";
private static final String FEATURE_LEANBACK = "android.software.leanback";
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 2ba16d39..77bb26dc 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/LogFileHandler.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/LogFileHandler.java
@@ -85,7 +85,6 @@ class LogFileHandler extends Handler {
}
}
-
private void writeLogItemToDisk(VpnStatus.LogItem li) throws IOException {
Parcel p = Parcel.obtain();
li.writeToParcel(p, 0);