From b9ccfe55aa74b7900862cacd8eb2a941e8dbc79a Mon Sep 17 00:00:00 2001 From: Christopher Tate Date: Thu, 23 Apr 2020 10:22:59 -0700 Subject: [PATCH] Make system-generated FGS notification PendingIntents immutable Bug: 153878498 Test: Test app from the indicated bug Change-Id: Ied48bdfa4e168dad7d829dbe21cc441dfde868ae (cherry picked from commit 0617b71cd317935669ef6bdd58e1e2cf517c87e1) --- services/core/java/com/android/server/am/ServiceRecord.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/am/ServiceRecord.java b/services/core/java/com/android/server/am/ServiceRecord.java index 4670d58ca63b3..274b0a83b5027 100644 --- a/services/core/java/com/android/server/am/ServiceRecord.java +++ b/services/core/java/com/android/server/am/ServiceRecord.java @@ -16,6 +16,9 @@ package com.android.server.am; +import static android.app.PendingIntent.FLAG_IMMUTABLE; +import static android.app.PendingIntent.FLAG_UPDATE_CURRENT; + import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME; @@ -864,7 +867,7 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN runningIntent.setData(Uri.fromParts("package", appInfo.packageName, null)); PendingIntent pi = PendingIntent.getActivityAsUser(ams.mContext, 0, - runningIntent, PendingIntent.FLAG_UPDATE_CURRENT, null, + runningIntent, FLAG_UPDATE_CURRENT | FLAG_IMMUTABLE, null, UserHandle.of(userId)); notiBuilder.setColor(ams.mContext.getColor( com.android.internal