Unified service and shortcut state summary on a11y settings page.

Bug: 210026562
Test: manual
Test: atest

Change-Id: I4d5ff6b10d6bfd2fe6b3de1849d00a9d084bf269
This commit is contained in:
Chun-Ku Lin
2023-05-15 18:12:55 +00:00
parent 53c0788cc9
commit b8084ecfcd
25 changed files with 839 additions and 189 deletions

View File

@@ -20,10 +20,12 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.provider.Settings;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import java.util.List;
@@ -54,5 +56,16 @@ public class LiveCaptionPreferenceController extends BasePreferenceController {
public void updateState(Preference preference) {
super.updateState(preference);
preference.setIntent(LIVE_CAPTION_INTENT);
boolean enabled = Settings.Secure.getInt(
mContext.getContentResolver(),
Settings.Secure.ODI_CAPTIONS_ENABLED, AccessibilityUtil.State.OFF)
== AccessibilityUtil.State.ON;
CharSequence serviceState = mContext.getText(enabled
? R.string.live_caption_enabled : R.string.live_caption_disabled);
preference.setSummary(
mContext.getString(
R.string.preference_summary_default_combination,
serviceState, mContext.getText(R.string.live_caption_summary)));
}
}