From 1a983ff386ae3f28f129d801f5661955ec7a2289 Mon Sep 17 00:00:00 2001 From: Daniel Norman Date: Thu, 6 Mar 2025 20:41:57 +0000 Subject: [PATCH] fix(hct): Hardcode the names of Outline text and HCT in our notif. This should help prevent localization issues caused by capitalization of this templated string, since these feature names should not be capitalized unless they are at the beginning of the sentence. The 'Settings' app name should always be capitalized since it's the proper name of an app, so that remains templated. Bug: 399358129 Test: atest HighContrastTextMigrationReceiverTest; (this test asserts against a hardcoded version of the entire string) Flag: com.android.graphics.hwui.flags.high_contrast_text_small_text_rect Change-Id: Iaaa2ac10a56c1e4f7e5a8fd0d1c8eaf8b0293a27 --- res/values/strings.xml | 4 ++-- .../HighContrastTextMigrationReceiver.java | 10 ++-------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 16d3964991c..cb96df25601 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -5541,8 +5541,8 @@ Change text color to black or white. Maximizes contrast with the background. Improve text contrast - - %1$s has replaced %2$s. You can turn it on in %3$s. + + Outline text has replaced high contrast text. You can turn it on in %1$s. Go to %1$s diff --git a/src/com/android/settings/accessibility/HighContrastTextMigrationReceiver.java b/src/com/android/settings/accessibility/HighContrastTextMigrationReceiver.java index b883c80b29e..7c0357efe33 100644 --- a/src/com/android/settings/accessibility/HighContrastTextMigrationReceiver.java +++ b/src/com/android/settings/accessibility/HighContrastTextMigrationReceiver.java @@ -43,7 +43,6 @@ import com.google.common.annotations.VisibleForTesting; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import java.util.Locale; /** * Handling smooth migration to the new high contrast text appearance @@ -134,15 +133,10 @@ public class HighContrastTextMigrationReceiver extends BroadcastReceiver { } private String getNotificationContentText(Context context) { - final String newName = context.getString( - R.string.accessibility_toggle_maximize_text_contrast_preference_title); - final String oldName = context.getString( - R.string.accessibility_toggle_high_text_contrast_preference_title) - .toLowerCase(Locale.getDefault()); final String settingsAppName = context.getString(R.string.settings_label); return context.getString( - R.string.accessibility_notification_high_contrast_text_body, - newName, oldName, settingsAppName); + R.string.accessibility_notification_high_contrast_text_body_message, + settingsAppName); } private void showNotification(Context context) {