From ccff4fa545dc099bd7acedade38842789e5e9b78 Mon Sep 17 00:00:00 2001 From: Bernardo Rufino Date: Wed, 13 Apr 2022 17:00:46 +0100 Subject: [PATCH] Block trampolines for browsers w/ targetSdk >= T As agreed with Chrome team during S change for trampolines (go/notification-trampolines), we would enforce the restrictions even for browsers once they target T. Bug: 227752274 Test: Working on CTS Change-Id: I930cc87bd82e5266bab5fa3e50ef7a883ddb2078 --- .../notification/NotificationManagerService.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 16b5fb1e4d7a9..716120bccce0f 100755 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -459,6 +459,15 @@ public class NotificationManagerService extends SystemService { @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.R) private static final long NOTIFICATION_TRAMPOLINE_BLOCK = 167676448L; + /** + * Activity starts coming from broadcast receivers or services in response to notification and + * notification action clicks will be blocked for UX and performance reasons for previously + * exempt role holders (browser). + */ + @ChangeId + @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.S_V2) + private static final long NOTIFICATION_TRAMPOLINE_BLOCK_FOR_EXEMPT_ROLES = 227752274L; + /** * Whether a notification listeners can understand new, more specific, cancellation reasons. */ @@ -11540,7 +11549,8 @@ public class NotificationManagerService extends SystemService { private boolean blockTrampoline(int uid) { if (mRoleObserver != null && mRoleObserver.isUidExemptFromTrampolineRestrictions(uid)) { - return false; + return CompatChanges.isChangeEnabled(NOTIFICATION_TRAMPOLINE_BLOCK_FOR_EXEMPT_ROLES, + uid); } return CompatChanges.isChangeEnabled(NOTIFICATION_TRAMPOLINE_BLOCK, uid); }