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
This commit is contained in:
chenjean
2024-12-24 09:30:23 +08:00
committed by Jean Chen
parent 49d8ff965d
commit 0d8356610e

View File

@@ -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(