Split the string resource id for non-generic accessibility preference.

- Keep the accessibility settings strings the same as in U.

Bug: 289425138
Test: manual
Test: atest
Change-Id: Iddbbfe627c93529d2421e153094a30628229c4bc
This commit is contained in:
Chun-Ku Lin
2023-08-01 23:54:08 +00:00
parent 524643a6c8
commit b65108ba1b
17 changed files with 81 additions and 452 deletions

View File

@@ -40,8 +40,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
import androidx.annotation.VisibleForTesting;
import com.android.settings.R;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.StringJoiner;
@@ -290,41 +288,6 @@ public final class AccessibilityUtil {
Settings.Secure.putString(context.getContentResolver(), targetKey, joiner.toString());
}
/**
* Returns the full status with a feature summary.
* For example, "$(feature on) / Shortcut on / Speak items on screen".
*
* @param context The current context.
* @param componentName The component name in Settings to query
* if the shortcut turned on.
* @param settingsSecureKey One of the key defined in
* {@link Settings.Secure}.
* @param featureOnTextId The string resource id representing the feature is turned on.
* @param featureOffTextId The string resource id representing the feature is turned off.
* @param featureSummaryId The string resource id of the feature summary.
*/
static CharSequence getFeatureFullStateSummary(
Context context, @NonNull ComponentName componentName,
String settingsSecureKey,
@StringRes int featureOnTextId, @StringRes int featureOffTextId,
@StringRes int featureSummaryId) {
boolean shortcutEnabled = getUserShortcutTypesFromSettings(context, componentName)
!= AccessibilityUtil.UserShortcutType.EMPTY;
boolean featureEnabled = Settings.Secure.getInt(context.getContentResolver(),
settingsSecureKey, AccessibilityUtil.State.OFF) == AccessibilityUtil.State.ON;
return context.getString(
R.string.accessibility_feature_full_state_summary,
featureEnabled
? context.getString(featureOnTextId)
: context.getString(featureOffTextId),
shortcutEnabled
? context.getString(R.string.accessibility_summary_shortcut_enabled)
: context.getString(R.string.generic_accessibility_feature_shortcut_off),
context.getString(featureSummaryId)
);
}
/**
* Returns if component name existed in one of {@code shortcutTypes} string in Settings.
*