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
This commit is contained in:
Daniel Norman
2025-03-06 20:41:57 +00:00
parent fe36b334cf
commit 1a983ff386
2 changed files with 4 additions and 10 deletions

View File

@@ -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) {