Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

For #7468 - Don't set notification style on Huawei devices on lollipop #7514

Merged
merged 1 commit into from
Jun 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.app.Notification
import android.app.PendingIntent
import android.content.Context
import android.graphics.Bitmap
import android.os.Build
import android.support.v4.media.session.MediaSessionCompat
import androidx.annotation.DrawableRes
import androidx.core.app.NotificationCompat
Expand All @@ -21,6 +22,7 @@ import mozilla.components.feature.media.ext.nonPrivateIcon
import mozilla.components.feature.media.ext.nonPrivateUrl
import mozilla.components.feature.media.service.AbstractMediaService
import mozilla.components.support.base.ids.SharedIdsHelper
import java.util.Locale

/**
* Helper to display a notification for web content playing media.
Expand Down Expand Up @@ -55,7 +57,15 @@ internal class MediaNotification(
style.setShowActionsInCompactView(0)
}

builder.setStyle(style)
// There is a known OEM crash with Huawei Devices on lollipop with setting a style
// see https://github.com/mozilla-mobile/android-components/issues/7468 and
// https://issuetracker.google.com/issues/37078372
val huaweiOnLollipop =
Build.MANUFACTURER.toLowerCase(Locale.getDefault()).contains("huawei") &&
Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1
if (!huaweiOnLollipop) {
builder.setStyle(style)
}

if (!state.isMediaStateForCustomTab()) {
// We only set a content intent if this media notification is not for an "external app"
Expand Down