Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Ads notification crash on Android S (uplift to 1.31.x) #10808

Merged
merged 1 commit into from
Nov 2, 2021
Merged
Show file tree
Hide file tree
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 @@ -84,11 +84,8 @@ public static void showOnboardingNotification() {
public static PendingIntentProvider getDeepLinkIntent(Context context) {
Intent intent = new Intent(context, BraveOnboardingNotification.class);
intent.setAction(DEEP_LINK);
return new PendingIntentProvider(
PendingIntent.getBroadcast(context, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT
| IntentUtils.getPendingIntentMutabilityFlag(true)),
0, 0);
return PendingIntentProvider.getBroadcast(
context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT, true);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ public static PendingIntent getDismissIntent(Context context, int notification_i
intent.setAction(CANCEL_NOTIFICATION);
intent.putExtra(NOTIFICATION_ID_EXTRA, notification_id);

return PendingIntent.getBroadcast(context, notification_id, intent,
0 | IntentUtils.getPendingIntentMutabilityFlag(true));
return PendingIntent.getBroadcast(
context, notification_id, intent, IntentUtils.getPendingIntentMutabilityFlag(true));
}

private boolean hasAskedAt1122() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import androidx.core.app.NotificationCompat;

import org.chromium.base.IntentUtils;
import org.chromium.base.Log;
import org.chromium.base.ThreadUtils;
import org.chromium.chrome.R;
Expand Down Expand Up @@ -63,7 +64,8 @@ public static void fireNotificationIfNecessary(Context context) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(URL));
intent.putExtra(BravePreferenceKeys.BRAVE_UPDATE_EXTRA_PARAM, true);
intent.setPackage(context.getPackageName());
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
PendingIntent pendingIntent = PendingIntent.getActivity(
context, 0, intent, IntentUtils.getPendingIntentMutabilityFlag(true));

mBuilder.setContentIntent(pendingIntent);
mBuilder.setAutoCancel(true);
Expand Down