summaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2021-02-19 17:17:47 +0100
committerArne Schwabe <arne@rfc2549.org>2021-02-19 17:17:47 +0100
commitc754ff2e49f1d4486de23cf45f1456601c36b4f1 (patch)
tree5d7f1c9eb8aecf1766a7e1fe26fe83326916e66d /main/src
parentd0ab42ab270fc1d0e27dbacd7722d48d70bfe456 (diff)
Add changes required for API 'S' (upcoming 31)
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/AndroidManifest.xml17
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java14
-rw-r--r--main/src/ui/AndroidManifest.xml6
3 files changed, 25 insertions, 12 deletions
diff --git a/main/src/main/AndroidManifest.xml b/main/src/main/AndroidManifest.xml
index e0f7154c..7ff33676 100644
--- a/main/src/main/AndroidManifest.xml
+++ b/main/src/main/AndroidManifest.xml
@@ -50,7 +50,9 @@
<service
android:name=".core.OpenVPNService"
+ android:exported="true"
android:permission="android.permission.BIND_VPN_SERVICE"
+ android:foregroundServiceType="connectedDevice"
android:process=":openvpn">
<intent-filter>
<action android:name="android.net.VpnService" />
@@ -59,7 +61,8 @@
<service
android:name=".api.ExternalOpenVPNService"
android:process=":openvpn"
- tools:ignore="ExportedService">
+ android:exported="true"
+ tools:ignore="ExportedService">
<intent-filter>
<action android:name="de.blinkt.openvpn.api.IOpenVPNAPIService" />
</intent-filter>
@@ -69,18 +72,21 @@
android:exported="false"
android:process=":openvpn" />
- <activity android:name=".api.GrantPermissionsActivity">
+ <activity android:name=".api.GrantPermissionsActivity"
+ android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
- <activity android:name=".api.ConfirmDialog">
+ <activity android:name=".api.ConfirmDialog"
+ android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
- <receiver android:name=".OnBootReceiver">
+ <receiver android:name=".OnBootReceiver"
+ android:exported="true">
<intent-filter android:priority="999">
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
@@ -95,7 +101,8 @@
android:label="@string/vpn_launch_title"
android:taskAffinity=".LaunchVPN"
android:theme="@style/blinkt.dialog"
- tools:ignore="ExportedActivity">
+ android:exported="true">
+
<intent-filter>
<action android:name="android.intent.action.MAIN" />
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 8cbed0ac..23940760 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
@@ -273,7 +273,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
nbuilder.setSmallIcon(icon);
if (status == LEVEL_WAITING_FOR_USER_INPUT) {
- PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);
+ PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE);
nbuilder.setContentIntent(pIntent);
} else {
nbuilder.setContentIntent(getGraphPendingIntent());
@@ -393,7 +393,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
private void addVpnActionsToNotification(Notification.Builder nbuilder) {
Intent disconnectVPN = new Intent(this, DisconnectVPN.class);
disconnectVPN.setAction(DISCONNECT_VPN);
- PendingIntent disconnectPendingIntent = PendingIntent.getActivity(this, 0, disconnectVPN, 0);
+ PendingIntent disconnectPendingIntent = PendingIntent.getActivity(this, 0, disconnectVPN, PendingIntent.FLAG_IMMUTABLE);
nbuilder.addAction(R.drawable.ic_menu_close_clear_cancel,
getString(R.string.cancel_connection), disconnectPendingIntent);
@@ -401,13 +401,13 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
Intent pauseVPN = new Intent(this, OpenVPNService.class);
if (mDeviceStateReceiver == null || !mDeviceStateReceiver.isUserPaused()) {
pauseVPN.setAction(PAUSE_VPN);
- PendingIntent pauseVPNPending = PendingIntent.getService(this, 0, pauseVPN, 0);
+ PendingIntent pauseVPNPending = PendingIntent.getService(this, 0, pauseVPN, PendingIntent.FLAG_IMMUTABLE);
nbuilder.addAction(R.drawable.ic_menu_pause,
getString(R.string.pauseVPN), pauseVPNPending);
} else {
pauseVPN.setAction(RESUME_VPN);
- PendingIntent resumeVPNPending = PendingIntent.getService(this, 0, pauseVPN, 0);
+ PendingIntent resumeVPNPending = PendingIntent.getService(this, 0, pauseVPN, PendingIntent.FLAG_IMMUTABLE);
nbuilder.addAction(R.drawable.ic_menu_play,
getString(R.string.resumevpn), resumeVPNPending);
}
@@ -419,7 +419,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
intent.putExtra("need", needed);
Bundle b = new Bundle();
b.putString("need", needed);
- PendingIntent pIntent = PendingIntent.getActivity(this, 12, intent, 0);
+ PendingIntent pIntent = PendingIntent.getActivity(this, 12, intent, PendingIntent.FLAG_IMMUTABLE);
return pIntent;
}
@@ -432,7 +432,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
intent.putExtra("PAGE", "graph");
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
- PendingIntent startLW = PendingIntent.getActivity(this, 0, intent, 0);
+ PendingIntent startLW = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE);
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
return startLW;
@@ -1317,7 +1317,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
// updateStateString trigger the notification of the VPN to be refreshed, save this intent
// to have that notification also this intent to be set
- PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);
+ PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE);
VpnStatus.updateStateString("USER_INPUT", "waiting for user input", reason, LEVEL_WAITING_FOR_USER_INPUT, intent);
nbuilder.setContentIntent(pIntent);
diff --git a/main/src/ui/AndroidManifest.xml b/main/src/ui/AndroidManifest.xml
index e2037b56..1fd0e5e5 100644
--- a/main/src/ui/AndroidManifest.xml
+++ b/main/src/ui/AndroidManifest.xml
@@ -18,6 +18,7 @@
android:banner="@mipmap/banner_tv"
tools:targetApi="lollipop">
<activity
+ android:exported="true"
android:name=".activities.MainActivity"
tools:ignore="ExportedActivity">
<intent-filter>
@@ -50,6 +51,7 @@
<activity android:name=".activities.FileSelect" />
<service
+ android:exported="true"
android:name=".OpenVPNTileService"
android:icon="@drawable/ic_quick"
android:label="@string/qs_title"
@@ -65,6 +67,7 @@
</service>
<activity
android:name=".activities.ConfigConverter"
+ android:exported="true"
android:excludeFromRecents="true"
android:label="Convert Config File"
android:taskAffinity=".ConfigConverter"
@@ -109,6 +112,7 @@
</intent-filter>
</activity> <!-- https://commonsware.com/blog/2019/03/27/death-external-storage-stay-away-files.html -->
<activity-alias
+ android:exported="true"
android:name=".activities.ConfigConverterFile"
android:enabled="@bool/supportFileScheme"
android:targetActivity=".activities.ConfigConverter">
@@ -130,6 +134,7 @@
</activity-alias>
<activity
+ android:exported="true"
android:name=".activities.CreateShortcuts"
android:excludeFromRecents="true"
android:label="@string/vpn_shortcut"
@@ -143,6 +148,7 @@
</activity>
<activity
+ android:exported="false"
android:name=".activities.OpenSSLSpeed"
android:label="@string/title_activity_open_sslspeed"
android:parentActivityName=".activities.MainActivity">