Mark intents as immutable

Test: manual
Fixes: 169792886
Fixes: 169793537
Fixes: 169793764
Change-Id: I8ae9efe732b468b8e13e264b0af8f81c596e2e89
(cherry picked from commit 11f2e28846)
This commit is contained in:
Julia Reynolds
2020-10-02 15:36:50 -04:00
parent 1de72903d4
commit 90be1b5d2c
3 changed files with 5 additions and 4 deletions

View File

@@ -271,7 +271,7 @@ public class EventConditionProvider extends SystemConditionProviderService {
new Intent(ACTION_EVALUATE)
.addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
.putExtra(EXTRA_TIME, time),
PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
alarms.cancel(pendingIntent);
if (time == 0 || time < now) {
if (DEBUG) Slog.d(TAG, "Not scheduling evaluate: " + (time == 0 ? "no time specified"

View File

@@ -5260,7 +5260,8 @@ public class NotificationManagerService extends SystemService {
Intent appIntent = getContext().getPackageManager().getLaunchIntentForPackage(pkg);
if (appIntent != null) {
summaryNotification.contentIntent = PendingIntent.getActivityAsUser(
getContext(), 0, appIntent, 0, null, UserHandle.of(userId));
getContext(), 0, appIntent, PendingIntent.FLAG_IMMUTABLE, null,
UserHandle.of(userId));
}
final StatusBarNotification summarySbn =
new StatusBarNotification(adjustedSbn.getPackageName(),
@@ -6880,7 +6881,7 @@ public class NotificationManagerService extends SystemService {
.appendPath(record.getKey()).build())
.addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
.putExtra(EXTRA_KEY, record.getKey()),
PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
mAlarmManager.setExactAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP,
mSystemClock.elapsedRealtime() + record.getNotification().getTimeoutAfter(),
pi);

View File

@@ -223,7 +223,7 @@ public class ScheduleConditionProvider extends SystemConditionProviderService {
new Intent(ACTION_EVALUATE)
.addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
.putExtra(EXTRA_TIME, time),
PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
alarms.cancel(pendingIntent);
if (time > now) {
if (DEBUG) Slog.d(TAG, String.format("Scheduling evaluate for %s, in %s, now=%s",