Skip to content

Commit 90be1b5

Browse files
author
Julia Reynolds
committed
Mark intents as immutable
Test: manual Fixes: 169792886 Fixes: 169793537 Fixes: 169793764 Change-Id: I8ae9efe732b468b8e13e264b0af8f81c596e2e89 (cherry picked from commit 11f2e28)
1 parent 1de7290 commit 90be1b5

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

services/core/java/com/android/server/notification/EventConditionProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ private void rescheduleAlarm(long now, long time) {
271271
new Intent(ACTION_EVALUATE)
272272
.addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
273273
.putExtra(EXTRA_TIME, time),
274-
PendingIntent.FLAG_UPDATE_CURRENT);
274+
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
275275
alarms.cancel(pendingIntent);
276276
if (time == 0 || time < now) {
277277
if (DEBUG) Slog.d(TAG, "Not scheduling evaluate: " + (time == 0 ? "no time specified"

services/core/java/com/android/server/notification/NotificationManagerService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5260,7 +5260,8 @@ private void createAutoGroupSummary(int userId, String pkg, String triggeringKey
52605260
Intent appIntent = getContext().getPackageManager().getLaunchIntentForPackage(pkg);
52615261
if (appIntent != null) {
52625262
summaryNotification.contentIntent = PendingIntent.getActivityAsUser(
5263-
getContext(), 0, appIntent, 0, null, UserHandle.of(userId));
5263+
getContext(), 0, appIntent, PendingIntent.FLAG_IMMUTABLE, null,
5264+
UserHandle.of(userId));
52645265
}
52655266
final StatusBarNotification summarySbn =
52665267
new StatusBarNotification(adjustedSbn.getPackageName(),
@@ -6880,7 +6881,7 @@ void scheduleTimeoutLocked(NotificationRecord record) {
68806881
.appendPath(record.getKey()).build())
68816882
.addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
68826883
.putExtra(EXTRA_KEY, record.getKey()),
6883-
PendingIntent.FLAG_UPDATE_CURRENT);
6884+
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
68846885
mAlarmManager.setExactAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP,
68856886
mSystemClock.elapsedRealtime() + record.getNotification().getTimeoutAfter(),
68866887
pi);

services/core/java/com/android/server/notification/ScheduleConditionProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ private void updateAlarm(long now, long time) {
223223
new Intent(ACTION_EVALUATE)
224224
.addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
225225
.putExtra(EXTRA_TIME, time),
226-
PendingIntent.FLAG_UPDATE_CURRENT);
226+
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
227227
alarms.cancel(pendingIntent);
228228
if (time > now) {
229229
if (DEBUG) Slog.d(TAG, String.format("Scheduling evaluate for %s, in %s, now=%s",

0 commit comments

Comments
 (0)