From 0d8356610ea764f9e30ff946669c8a647e1184ca Mon Sep 17 00:00:00 2001 From: chenjean Date: Tue, 24 Dec 2024 09:30:23 +0800 Subject: [PATCH] feat(HCT): Notification disappear behavoir 1. When a user taps the notification body, it should function like clicking the "Open Settings" action button, taking them directly to the Settings page and the notification should disappear automatically. 2. To ensure the notification remains visible until the user interacts with it, we need to add the FLAG_NO_CLEAR flag. This will prevent the notification from being dismissed when the user uses the "Clear all" button in the notification shade. Bug: 385794406 Flag: com.android.graphics.hwui.flags.high_contrast_text_small_text_rect Test: manual Change-Id: Ie2cd17e744363b9834021ddef48ec5a59f19ec64 --- .../accessibility/HighContrastTextMigrationReceiver.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/accessibility/HighContrastTextMigrationReceiver.java b/src/com/android/settings/accessibility/HighContrastTextMigrationReceiver.java index ee3537bedd3..c808430dc61 100644 --- a/src/com/android/settings/accessibility/HighContrastTextMigrationReceiver.java +++ b/src/com/android/settings/accessibility/HighContrastTextMigrationReceiver.java @@ -123,7 +123,7 @@ public class HighContrastTextMigrationReceiver extends BroadcastReceiver { R.string.accessibility_toggle_high_text_contrast_preference_title)) .setContentText(context.getString( R.string.accessibility_notification_high_contrast_text_content)) - .setAutoCancel(true); + .setFlag(Notification.FLAG_NO_CLEAR, true); Intent settingsIntent = new Intent(Settings.ACTION_TEXT_READING_SETTINGS); settingsIntent.setPackage(context.getPackageName()); @@ -142,9 +142,11 @@ public class HighContrastTextMigrationReceiver extends BroadcastReceiver { settingsPendingIntent ).build(); - notificationBuilder.addAction(settingsAction); + notificationBuilder + .setContentIntent(settingsPendingIntent) + .addAction(settingsAction) + .setAutoCancel(true); } - NotificationManager notificationManager = context.getSystemService(NotificationManager.class); NotificationChannel notificationChannel = new NotificationChannel(