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
This commit is contained in:
Andrei Lazar 2018-08-14 13:47:02 +03:00
Родитель 736db71698
Коммит ebcbb5d03f
4 изменённых файлов: 19 добавлений и 3 удалений

Просмотреть файл

@ -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();

Просмотреть файл

@ -97,7 +97,11 @@ public final class NotificationHelper implements BundleEventListener {
/**
* Mozilla Location Services notification channel.
*/
DOWNLOAD
DOWNLOAD,
/**
* Media notification channel
*/
MEDIA
}
private final Map<Channel, String> mDefinedNotificationChannels = new HashMap<Channel, String>() {{
@ -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: {

Просмотреть файл

@ -897,4 +897,5 @@ Picture-in-picture mini window -->
<!-- Notification channels names -->
<!ENTITY default_notification_channel "&brandShortName;">
<!ENTITY mls_notification_channel "&vendorShortName; Location Service">
<!ENTITY download_notification_channel "Downloads">
<!ENTITY download_notification_channel "Downloads">
<!ENTITY media_notification_channel "Media playback">

Просмотреть файл

@ -650,5 +650,6 @@
<string name="default_notification_channel">&default_notification_channel;</string>
<string name="mls_notification_channel">&mls_notification_channel;</string>
<string name="media_notification_channel">&media_notification_channel;</string>
<string name="download_notification_channel">&download_notification_channel;</string>
</resources>