From 3db548187dcd27ce2231b75d0dfd3f43b34c35e0 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Mon, 14 Dec 2020 10:04:39 +0100 Subject: [PATCH] Workaround for Android 8.0 NotificationChannel bug Fixes #1312 --- .../microg/gms/common/ForegroundServiceContext.java | 2 +- .../main/java/org/microg/gms/gcm/McsService.java | 13 ------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/play-services-base-core/src/main/java/org/microg/gms/common/ForegroundServiceContext.java b/play-services-base-core/src/main/java/org/microg/gms/common/ForegroundServiceContext.java index c0faf313..1387fb1b 100644 --- a/play-services-base-core/src/main/java/org/microg/gms/common/ForegroundServiceContext.java +++ b/play-services-base-core/src/main/java/org/microg/gms/common/ForegroundServiceContext.java @@ -50,7 +50,7 @@ public class ForegroundServiceContext extends ContextWrapper { NotificationChannel channel = new NotificationChannel("foreground-service", "Foreground Service", NotificationManager.IMPORTANCE_NONE); channel.setLockscreenVisibility(Notification.VISIBILITY_SECRET); channel.setShowBadge(false); - channel.setVibrationPattern(new long[0]); + channel.setVibrationPattern(new long[] {0}); context.getSystemService(NotificationManager.class).createNotificationChannel(channel); return new Notification.Builder(context, channel.getId()) .setOngoing(true) diff --git a/play-services-core/src/main/java/org/microg/gms/gcm/McsService.java b/play-services-core/src/main/java/org/microg/gms/gcm/McsService.java index 026c43fa..fab438c0 100644 --- a/play-services-core/src/main/java/org/microg/gms/gcm/McsService.java +++ b/play-services-core/src/main/java/org/microg/gms/gcm/McsService.java @@ -329,19 +329,6 @@ public class McsService extends Service implements Handler.Callback { return START_REDELIVER_INTENT; } - @RequiresApi(api = Build.VERSION_CODES.O) - private Notification buildForegroundNotification() { - NotificationChannel channel = new NotificationChannel("foreground-service", "Foreground Service", NotificationManager.IMPORTANCE_LOW); - channel.setLockscreenVisibility(Notification.VISIBILITY_SECRET); - channel.setShowBadge(false); - getSystemService(NotificationManager.class).createNotificationChannel(channel); - return new Notification.Builder(this, channel.getId()) - .setOngoing(true) - .setContentTitle("Running in background") - .setSmallIcon(android.R.drawable.stat_notify_sync) - .build(); - } - private void handleSendMessage(Intent intent) { String messageId = intent.getStringExtra(EXTRA_MESSAGE_ID); String collapseKey = intent.getStringExtra(EXTRA_COLLAPSE_KEY);