Commit 47d6b3c2 authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

Remove <L compatibility code from NotificationWrapperBuilder.

The cancel button is a workaround for <L behavior and is a no-op in L+,
see docs for
androidx.media.app.NotificationCompat.MediaStyle#setShowCancelButton()

Bug: none
Change-Id: I7474644bcfdbf7bb4a24f6838b393756f174d1ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2493482Reviewed-by: default avatarJustin DeWitt <dewittj@chromium.org>
Reviewed-by: default avatarMounir Lamouri <mlamouri@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822835}
parent 713710ff
...@@ -754,8 +754,7 @@ public class MediaNotificationController { ...@@ -754,8 +754,7 @@ public class MediaNotificationController {
// Only apply MediaStyle when NotificationInfo supports play/pause. // Only apply MediaStyle when NotificationInfo supports play/pause.
if (mMediaNotificationInfo.supportsPlayPause()) { if (mMediaNotificationInfo.supportsPlayPause()) {
builder.setMediaStyle(mMediaSession, computeCompactViewActionIndices(bigViewActions), builder.setMediaStyle(mMediaSession, computeCompactViewActionIndices(bigViewActions));
createPendingIntent(ACTION_CANCEL), true);
} }
} }
......
...@@ -104,8 +104,7 @@ public interface NotificationWrapperBuilder { ...@@ -104,8 +104,7 @@ public interface NotificationWrapperBuilder {
NotificationWrapperBuilder setStyle(Notification.BigTextStyle bigTextStyle); NotificationWrapperBuilder setStyle(Notification.BigTextStyle bigTextStyle);
NotificationWrapperBuilder setMediaStyle(MediaSessionCompat session, int[] actions, NotificationWrapperBuilder setMediaStyle(MediaSessionCompat session, int[] actions);
PendingIntent intent, boolean showCancelButton);
NotificationWrapperBuilder setCategory(String category); NotificationWrapperBuilder setCategory(String category);
......
...@@ -255,14 +255,11 @@ public class NotificationWrapperCompatBuilder implements NotificationWrapperBuil ...@@ -255,14 +255,11 @@ public class NotificationWrapperCompatBuilder implements NotificationWrapperBuil
} }
@Override @Override
public NotificationWrapperBuilder setMediaStyle(MediaSessionCompat session, int[] actions, public NotificationWrapperBuilder setMediaStyle(MediaSessionCompat session, int[] actions) {
PendingIntent intent, boolean showCancelButton) {
androidx.media.app.NotificationCompat.MediaStyle style = androidx.media.app.NotificationCompat.MediaStyle style =
new androidx.media.app.NotificationCompat.MediaStyle(); new androidx.media.app.NotificationCompat.MediaStyle();
style.setMediaSession(session.getSessionToken()); style.setMediaSession(session.getSessionToken());
style.setShowActionsInCompactView(actions); style.setShowActionsInCompactView(actions);
style.setCancelButtonIntent(intent);
style.setShowCancelButton(showCancelButton);
mBuilder.setStyle(style); mBuilder.setStyle(style);
return this; return this;
} }
......
...@@ -282,8 +282,7 @@ public class NotificationWrapperStandardBuilder implements NotificationWrapperBu ...@@ -282,8 +282,7 @@ public class NotificationWrapperStandardBuilder implements NotificationWrapperBu
} }
@Override @Override
public NotificationWrapperBuilder setMediaStyle(MediaSessionCompat session, int[] actions, public NotificationWrapperBuilder setMediaStyle(MediaSessionCompat session, int[] actions) {
PendingIntent intent, boolean showCancelButton) {
Notification.MediaStyle style = new Notification.MediaStyle(); Notification.MediaStyle style = new Notification.MediaStyle();
style.setMediaSession(((MediaSession) session.getMediaSession()).getSessionToken()); style.setMediaSession(((MediaSession) session.getMediaSession()).getSessionToken());
style.setShowActionsInCompactView(actions); style.setShowActionsInCompactView(actions);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment