From ebcbb5d03fc560ad73f3e065b38736d39aee86ea Mon Sep 17 00:00:00 2001 From: Andrei Lazar Date: Tue, 14 Aug 2018 13:47:02 +0300 Subject: [PATCH] Bug 1477700 Android media notification appears swiped down after video starts r=JanH Created a dedicated channel for media notifications. MozReview-Commit-ID: JKFVPNRu2WO --HG-- extra : rebase_source : f9df42ecae1467c337c0d4bdbd5c5582e47c582c --- .../gecko/media/GeckoMediaControlAgent.java | 2 +- .../gecko/notifications/NotificationHelper.java | 16 +++++++++++++++- .../base/locales/en-US/android_strings.dtd | 3 ++- mobile/android/base/strings.xml.in | 1 + 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/mobile/android/base/java/org/mozilla/gecko/media/GeckoMediaControlAgent.java b/mobile/android/base/java/org/mozilla/gecko/media/GeckoMediaControlAgent.java index a18c76e3bbc7..e91eef0aeb5f 100644 --- a/mobile/android/base/java/org/mozilla/gecko/media/GeckoMediaControlAgent.java +++ b/mobile/android/base/java/org/mozilla/gecko/media/GeckoMediaControlAgent.java @@ -418,7 +418,7 @@ public class GeckoMediaControlAgent { if (!AppConstants.Versions.preO) { notificationBuilder.setChannelId(NotificationHelper.getInstance(mContext) - .getNotificationChannel(NotificationHelper.Channel.DEFAULT).getId()); + .getNotificationChannel(NotificationHelper.Channel.MEDIA).getId()); } return notificationBuilder.build(); diff --git a/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationHelper.java b/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationHelper.java index 36f1124c0c7f..dfce85802d2c 100644 --- a/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationHelper.java +++ b/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationHelper.java @@ -97,7 +97,11 @@ public final class NotificationHelper implements BundleEventListener { /** * Mozilla Location Services notification channel. */ - DOWNLOAD + DOWNLOAD, + /** + * Media notification channel + */ + MEDIA } private final Map mDefinedNotificationChannels = new HashMap() {{ @@ -109,6 +113,10 @@ public final class NotificationHelper implements BundleEventListener { final String DOWNLOAD_NOTIFICATION_TAG = "download-notification-channel"; put(Channel.DOWNLOAD, DOWNLOAD_NOTIFICATION_TAG); + + + final String MEDIA_CHANNEL_TAG = "media-notification-channel"; + put(Channel.MEDIA, MEDIA_CHANNEL_TAG); }}; // Holds a list of notifications that should be cleared if the Fennec Activity is shut down. @@ -176,6 +184,12 @@ public final class NotificationHelper implements BundleEventListener { } break; + case MEDIA: { + channel = new NotificationChannel(mDefinedNotificationChannels.get(definedChannel), + mContext.getString(R.string.media_notification_channel), NotificationManager.IMPORTANCE_LOW); + } + break; + case DEFAULT: default: { diff --git a/mobile/android/base/locales/en-US/android_strings.dtd b/mobile/android/base/locales/en-US/android_strings.dtd index 5bc2c7bf9a6a..0b8f59ab77bb 100644 --- a/mobile/android/base/locales/en-US/android_strings.dtd +++ b/mobile/android/base/locales/en-US/android_strings.dtd @@ -897,4 +897,5 @@ Picture-in-picture mini window --> - \ No newline at end of file + + \ No newline at end of file diff --git a/mobile/android/base/strings.xml.in b/mobile/android/base/strings.xml.in index b4f7b53e26cc..153f7d18103f 100644 --- a/mobile/android/base/strings.xml.in +++ b/mobile/android/base/strings.xml.in @@ -650,5 +650,6 @@ &default_notification_channel; &mls_notification_channel; + &media_notification_channel; &download_notification_channel;