diff options
author | cyBerta <cyberta@riseup.net> | 2024-02-03 00:11:25 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2024-02-03 00:11:25 +0100 |
commit | b3caf0f435c5a37dcccab73cf27d29ac31f38556 (patch) | |
tree | 8b08e1977b76874042b93fec36f7377213816037 /app/src/main/java/se/leap/bitmaskclient/eip | |
parent | 5bf3f807a4804c18b7dc88e07e4e34ecf0791713 (diff) |
fix foreground service permissions for Android API 34
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/eip')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java index f08371c6..8e15ca3e 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java @@ -16,6 +16,7 @@ */ package se.leap.bitmaskclient.eip; +import static android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED; import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_START_ALWAYS_ON_VPN; import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_START_BLOCKING_VPN; import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_STOP_BLOCKING_VPN; @@ -33,11 +34,11 @@ import android.os.ParcelFileDescriptor; import android.system.OsConstants; import android.util.Log; +import androidx.core.app.ServiceCompat; + import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.IOException; -import java.util.Observable; -import java.util.Observer; import de.blinkt.openvpn.core.ConnectionStatus; import de.blinkt.openvpn.core.VpnStatus; @@ -210,7 +211,7 @@ public class VoidVpnService extends VpnService implements PropertyChangeListener @Override public void onNotificationBuild(int notificationId, Notification notification) { - startForeground(notificationId, notification); + ServiceCompat.startForeground(this, notificationId, notification, FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED); } public void startWithForegroundNotification() { |