Skip to content

Commit

Permalink
[Android] Use PendingIntentProvider for notification actions
Browse files Browse the repository at this point in the history
Chromium change:
https://chromium.googlesource.com/chromium/src.git/+/abc61e532741e260858eb99afef15fff30a63019

Use PendingIntentProvider for notification actions

The web notification settings button did not specify the required
mutability flags on Android S. This now changes the interface of
NotificationBuilderBase to use PendingIntentProvider instead of plain
PendingIntents so we can make sure that we always set the expected
flags.

Bug: 1163529
  • Loading branch information
samartnik authored and mariospr committed May 5, 2021
1 parent bd1916e commit e1ab78f
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.chromium.components.browser_ui.notifications.NotificationMetadata;
import org.chromium.components.browser_ui.notifications.NotificationWrapper;
import org.chromium.components.browser_ui.notifications.NotificationWrapperBuilder;
import org.chromium.components.browser_ui.notifications.PendingIntentProvider;

/**
* Builds a notification according to BraveAds spec.
Expand Down Expand Up @@ -189,7 +190,7 @@ private Bitmap getBraveIcon() {

@Override
public NotificationBuilderBase addButtonAction(@Nullable Bitmap iconBitmap,
@Nullable CharSequence title, @Nullable PendingIntent intent) {
@Nullable CharSequence title, PendingIntentProvider intent) {
return this;
}

Expand All @@ -200,13 +201,13 @@ public NotificationBuilderBase addButtonAction(@Nullable Bitmap iconBitmap,
*/
@Override
public NotificationBuilderBase addTextAction(@Nullable Bitmap iconBitmap,
@Nullable CharSequence title, @Nullable PendingIntent intent, String placeholder) {
@Nullable CharSequence title, PendingIntentProvider intent, String placeholder) {
return this;
}

@Override
public NotificationBuilderBase addSettingsAction(
int iconId, @Nullable CharSequence title, @Nullable PendingIntent intent) {
int iconId, @Nullable CharSequence title, PendingIntentProvider intent) {
return this;
}

Expand Down

0 comments on commit e1ab78f

Please sign in to comment.