Loading core/java/android/service/notification/flags.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -14,7 +14,17 @@ flag { namespace: "systemui" description: "This flag controls the redacting of sensitive notifications from untrusted NotificationListenerServices" bug: "306271190" } flag { name: "redact_sensitive_notifications_big_text_style" is_exported: true namespace: "systemui" description: "This flag controls the redacting of BigTextStyle fields in sensitive notifications" bug: "335488909" metadata { purpose: PURPOSE_BUGFIX } } flag { Loading core/res/res/values/strings.xml +2 −4 Original line number Diff line number Diff line Loading @@ -6436,10 +6436,8 @@ ul.</string> <!-- Communal profile label on a screen. This can be used as a tab label for this profile in tabbed views and can be used to represent the profile in sharing surfaces, etc. [CHAR LIMIT=20] --> <string name="profile_label_communal">Communal</string> <!-- Notification message used when a notification's normal message contains sensitive information. --> <!-- TODO b/301960090: replace with redacted message string and action title, when/if UX provides one --> <!-- DO NOT TRANSLATE --> <string name="redacted_notification_message"></string> <!-- Notification message used when a notification's normal message contains sensitive information [CHAR_LIMIT=NOTIF_BODY] --> <string name="redacted_notification_message">Sensitive notification content hidden</string> <!-- Notification action title used instead of a notification's normal title sensitive [CHAR_LIMIT=NOTIF_BODY] --> <string name="redacted_notification_action_title"></string> Loading services/core/java/com/android/server/notification/NotificationManagerService.java +9 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,7 @@ import static android.os.UserHandle.USER_NULL; import static android.os.UserHandle.USER_SYSTEM; import static android.service.notification.Flags.callstyleCallbackApi; import static android.service.notification.Flags.redactSensitiveNotificationsFromUntrustedListeners; import static android.service.notification.Flags.redactSensitiveNotificationsBigTextStyle; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_ALERTING; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_CONVERSATIONS; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_ONGOING; Loading Loading @@ -11917,6 +11918,14 @@ public class NotificationManagerService extends SystemService { redactedText, System.currentTimeMillis(), empty)); redactedNotifBuilder.setStyle(messageStyle); } if (redactSensitiveNotificationsBigTextStyle() && oldNotif.isStyle(Notification.BigTextStyle.class)) { Notification.BigTextStyle bigTextStyle = new Notification.BigTextStyle(); bigTextStyle.bigText(mContext.getString(R.string.redacted_notification_message)); bigTextStyle.setBigContentTitle(""); bigTextStyle.setSummaryText(""); redactedNotifBuilder.setStyle(bigTextStyle); } Notification redacted = redactedNotifBuilder.build(); // Notification extras can't always be overridden by a builder (configured by a system Loading
core/java/android/service/notification/flags.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -14,7 +14,17 @@ flag { namespace: "systemui" description: "This flag controls the redacting of sensitive notifications from untrusted NotificationListenerServices" bug: "306271190" } flag { name: "redact_sensitive_notifications_big_text_style" is_exported: true namespace: "systemui" description: "This flag controls the redacting of BigTextStyle fields in sensitive notifications" bug: "335488909" metadata { purpose: PURPOSE_BUGFIX } } flag { Loading
core/res/res/values/strings.xml +2 −4 Original line number Diff line number Diff line Loading @@ -6436,10 +6436,8 @@ ul.</string> <!-- Communal profile label on a screen. This can be used as a tab label for this profile in tabbed views and can be used to represent the profile in sharing surfaces, etc. [CHAR LIMIT=20] --> <string name="profile_label_communal">Communal</string> <!-- Notification message used when a notification's normal message contains sensitive information. --> <!-- TODO b/301960090: replace with redacted message string and action title, when/if UX provides one --> <!-- DO NOT TRANSLATE --> <string name="redacted_notification_message"></string> <!-- Notification message used when a notification's normal message contains sensitive information [CHAR_LIMIT=NOTIF_BODY] --> <string name="redacted_notification_message">Sensitive notification content hidden</string> <!-- Notification action title used instead of a notification's normal title sensitive [CHAR_LIMIT=NOTIF_BODY] --> <string name="redacted_notification_action_title"></string> Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +9 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,7 @@ import static android.os.UserHandle.USER_NULL; import static android.os.UserHandle.USER_SYSTEM; import static android.service.notification.Flags.callstyleCallbackApi; import static android.service.notification.Flags.redactSensitiveNotificationsFromUntrustedListeners; import static android.service.notification.Flags.redactSensitiveNotificationsBigTextStyle; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_ALERTING; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_CONVERSATIONS; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_ONGOING; Loading Loading @@ -11917,6 +11918,14 @@ public class NotificationManagerService extends SystemService { redactedText, System.currentTimeMillis(), empty)); redactedNotifBuilder.setStyle(messageStyle); } if (redactSensitiveNotificationsBigTextStyle() && oldNotif.isStyle(Notification.BigTextStyle.class)) { Notification.BigTextStyle bigTextStyle = new Notification.BigTextStyle(); bigTextStyle.bigText(mContext.getString(R.string.redacted_notification_message)); bigTextStyle.setBigContentTitle(""); bigTextStyle.setSummaryText(""); redactedNotifBuilder.setStyle(bigTextStyle); } Notification redacted = redactedNotifBuilder.build(); // Notification extras can't always be overridden by a builder (configured by a system