Commit a0125a06 authored by Wenyu Fu's avatar Wenyu Fu Committed by Chromium LUCI CQ

Add FLAG_IMMUTABLE to PendingIntent in FRE

The PendingIntent created by FRE is not expected to be changed after
creation.

Bug: 1164088
Change-Id: I8330329bb7f340c6375a82db23f11e2880894abd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2617120Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Commit-Queue: Wenyu Fu <wenyufu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841331}
parent 0cf084ad
...@@ -9,6 +9,7 @@ import android.app.PendingIntent; ...@@ -9,6 +9,7 @@ import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.SystemClock; import android.os.SystemClock;
import android.text.TextUtils; import android.text.TextUtils;
...@@ -142,6 +143,9 @@ public class FreIntentCreator { ...@@ -142,6 +143,9 @@ public class FreIntentCreator {
Intent intentToLaunchAfterFreComplete, boolean requiresBroadcast) { Intent intentToLaunchAfterFreComplete, boolean requiresBroadcast) {
final PendingIntent pendingIntent; final PendingIntent pendingIntent;
int pendingIntentFlags = PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT; int pendingIntentFlags = PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
pendingIntentFlags |= PendingIntent.FLAG_IMMUTABLE;
}
if (requiresBroadcast) { if (requiresBroadcast) {
pendingIntent = PendingIntent.getBroadcast( pendingIntent = PendingIntent.getBroadcast(
context, 0, intentToLaunchAfterFreComplete, pendingIntentFlags); context, 0, intentToLaunchAfterFreComplete, pendingIntentFlags);
......
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