summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2022-12-23 14:58:00 +0100
committercyBerta <cyberta@riseup.net>2022-12-23 14:58:00 +0100
commit8e72429bacfacd39eabe59f43174fb761fcab5d1 (patch)
tree6fbf6b0557b201a52389c5a4f621e72d9772f137 /app
parent55ae2ebafdd40ce5e5f0d239eedc2a1220c85a8a (diff)
try to fix potential RemoteServiceException: Bad notification for startForeground
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java2
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/VpnNotificationManager.java14
2 files changed, 9 insertions, 7 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 b5d4a353..fbfa2a1d 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java
@@ -203,7 +203,7 @@ public class VoidVpnService extends VpnService implements Observer, VpnNotificat
blockingMessage,
blockingMessage,
eipStatus.getLevel(),
- this
+ null
);
} else {
stopForeground(true);
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/VpnNotificationManager.java b/app/src/main/java/se/leap/bitmaskclient/eip/VpnNotificationManager.java
index 03ce6adc..b4d11f26 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/VpnNotificationManager.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/VpnNotificationManager.java
@@ -128,7 +128,7 @@ public class VpnNotificationManager {
public void buildOpenVpnNotification(String profileName, boolean isObfuscated, String msg,
String tickerText, ConnectionStatus status, long when,
- String notificationChannelNewstatusId, VpnServiceCallback vpnServiceCallback) {
+ String channelId, VpnServiceCallback vpnServiceCallback) {
String cancelString;
CharSequence bigmessage = null;
String bridgeIcon = new String(Character.toChars(0x1f309));
@@ -183,7 +183,7 @@ public class VpnNotificationManager {
bigmessage,
tickerText,
status,
- notificationChannelNewstatusId,
+ channelId,
PRIORITY_DEFAULT,
when,
contentIntent,
@@ -245,9 +245,9 @@ public class VpnNotificationManager {
}
private void buildVpnNotification(String title, String message, CharSequence bigMessage, String tickerText,
- ConnectionStatus status, String notificationChannelNewstatusId, int priority,
+ ConnectionStatus status, String channelId, int priority,
long when, PendingIntent contentIntent, NotificationCompat.Action notificationAction, VpnServiceCallback vpnServiceCallback) {
- NotificationCompat.Builder nCompatBuilder = new NotificationCompat.Builder(context, notificationChannelNewstatusId);
+ NotificationCompat.Builder nCompatBuilder = new NotificationCompat.Builder(context, channelId);
int icon = getIconByConnectionStatus(status);
nCompatBuilder.setStyle(new NotificationCompat.BigTextStyle().
@@ -271,11 +271,13 @@ public class VpnNotificationManager {
}
Notification notification = nCompatBuilder.build();
- int notificationId = notificationChannelNewstatusId.hashCode();
+ int notificationId = channelId.hashCode();
- compatNotificationManager.notify(notificationId, notification);
if (vpnServiceCallback != null) {
vpnServiceCallback.onNotificationBuild(notificationId, notification);
+ } else {
+ compatNotificationManager.notify(notificationId, notification);
+
}
}