Snap for 8179594 from 461b94a675 to tm-release
Change-Id: If955599933c5eb5f79b88a8b5322a29b2624acee
This commit is contained in:
@@ -1974,7 +1974,7 @@
|
|||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="com.android.settings.title"
|
android:name="com.android.settings.title"
|
||||||
android:resource="@string/accessibility_text_reading_options_title" />
|
android:resource="@string/accessibility_text_reading_options_suggestion_title" />
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="com.android.settings.icon_tintable"
|
android:name="com.android.settings.icon_tintable"
|
||||||
android:value="true" />
|
android:value="true" />
|
||||||
|
|||||||
@@ -5229,7 +5229,9 @@
|
|||||||
<!-- Title for the footer text to explain what accessibility service does. [CHAR LIMIT=35] -->
|
<!-- Title for the footer text to explain what accessibility service does. [CHAR LIMIT=35] -->
|
||||||
<string name="accessibility_introduction_title">About <xliff:g id="service" example="Select to Speak">%1$s</xliff:g></string>
|
<string name="accessibility_introduction_title">About <xliff:g id="service" example="Select to Speak">%1$s</xliff:g></string>
|
||||||
<!-- Title for the accessibility preference to adjust the display size, font size, bold text, and high contrast text features. [CHAR LIMIT=NONE] -->
|
<!-- Title for the accessibility preference to adjust the display size, font size, bold text, and high contrast text features. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_text_reading_options_title">Text and reading options</string>
|
<string name="accessibility_text_reading_options_title">Display size and text</string>
|
||||||
|
<!-- Title for the entry of the text reading options. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="accessibility_text_reading_options_suggestion_title">Change how text displays</string>
|
||||||
<!-- Subject for the mail content of the accessibility text reading preview. [CHAR LIMIT=NONE] -->
|
<!-- Subject for the mail content of the accessibility text reading preview. [CHAR LIMIT=NONE] -->
|
||||||
<string name="accessibility_text_reading_preview_mail_subject">Email: Plans for time machine, v2</string>
|
<string name="accessibility_text_reading_preview_mail_subject">Email: Plans for time machine, v2</string>
|
||||||
<!-- Message for the mail content of the accessibility text reading preview. [CHAR LIMIT=NONE] -->
|
<!-- Message for the mail content of the accessibility text reading preview. [CHAR LIMIT=NONE] -->
|
||||||
|
|||||||
@@ -234,6 +234,9 @@ public class AccessibilityDetailsSettingsFragment extends InstrumentedFragment {
|
|||||||
final String htmlDescription = info.loadHtmlDescription(getActivity().getPackageManager());
|
final String htmlDescription = info.loadHtmlDescription(getActivity().getPackageManager());
|
||||||
extras.putString(AccessibilitySettings.EXTRA_HTML_DESCRIPTION, htmlDescription);
|
extras.putString(AccessibilitySettings.EXTRA_HTML_DESCRIPTION, htmlDescription);
|
||||||
|
|
||||||
|
final CharSequence intro = info.loadIntro(getActivity().getPackageManager());
|
||||||
|
extras.putCharSequence(AccessibilitySettings.EXTRA_INTRO, intro);
|
||||||
|
|
||||||
// We will log nonA11yTool status from PolicyWarningUIController; others none.
|
// We will log nonA11yTool status from PolicyWarningUIController; others none.
|
||||||
extras.putLong(AccessibilitySettings.EXTRA_TIME_FOR_LOGGING,
|
extras.putLong(AccessibilitySettings.EXTRA_TIME_FOR_LOGGING,
|
||||||
getActivity().getIntent().getLongExtra(
|
getActivity().getIntent().getLongExtra(
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ public class AccessibilitySettings extends DashboardFragment {
|
|||||||
static final String EXTRA_TITLE_RES = "title_res";
|
static final String EXTRA_TITLE_RES = "title_res";
|
||||||
static final String EXTRA_RESOLVE_INFO = "resolve_info";
|
static final String EXTRA_RESOLVE_INFO = "resolve_info";
|
||||||
static final String EXTRA_SUMMARY = "summary";
|
static final String EXTRA_SUMMARY = "summary";
|
||||||
|
static final String EXTRA_INTRO = "intro";
|
||||||
static final String EXTRA_SETTINGS_TITLE = "settings_title";
|
static final String EXTRA_SETTINGS_TITLE = "settings_title";
|
||||||
static final String EXTRA_COMPONENT_NAME = "component_name";
|
static final String EXTRA_COMPONENT_NAME = "component_name";
|
||||||
static final String EXTRA_SETTINGS_COMPONENT_NAME = "settings_component_name";
|
static final String EXTRA_SETTINGS_COMPONENT_NAME = "settings_component_name";
|
||||||
@@ -570,14 +571,15 @@ public class AccessibilitySettings extends DashboardFragment {
|
|||||||
|
|
||||||
final String prefKey = preference.getKey();
|
final String prefKey = preference.getKey();
|
||||||
final int imageRes = info.getAnimatedImageRes();
|
final int imageRes = info.getAnimatedImageRes();
|
||||||
|
final CharSequence intro = info.loadIntro(mPm);
|
||||||
final CharSequence description = getServiceDescription(mContext, info,
|
final CharSequence description = getServiceDescription(mContext, info,
|
||||||
serviceEnabled);
|
serviceEnabled);
|
||||||
final String htmlDescription = info.loadHtmlDescription(mPm);
|
final String htmlDescription = info.loadHtmlDescription(mPm);
|
||||||
final String settingsClassName = info.getSettingsActivityName();
|
final String settingsClassName = info.getSettingsActivityName();
|
||||||
final String tileServiceClassName = info.getTileServiceClassName();
|
final String tileServiceClassName = info.getTileServiceClassName();
|
||||||
|
|
||||||
putBasicExtras(preference, prefKey, title, description, imageRes, htmlDescription,
|
putBasicExtras(preference, prefKey, title, intro, description, imageRes,
|
||||||
componentName);
|
htmlDescription, componentName);
|
||||||
putServiceExtras(preference, resolveInfo, serviceEnabled);
|
putServiceExtras(preference, resolveInfo, serviceEnabled);
|
||||||
putSettingsExtras(preference, packageName, settingsClassName);
|
putSettingsExtras(preference, packageName, settingsClassName);
|
||||||
putTileServiceExtras(preference, packageName, tileServiceClassName);
|
putTileServiceExtras(preference, packageName, tileServiceClassName);
|
||||||
@@ -630,14 +632,15 @@ public class AccessibilitySettings extends DashboardFragment {
|
|||||||
setRestrictedPreferenceEnabled(preference, permittedServices, serviceEnabled);
|
setRestrictedPreferenceEnabled(preference, permittedServices, serviceEnabled);
|
||||||
|
|
||||||
final String prefKey = preference.getKey();
|
final String prefKey = preference.getKey();
|
||||||
|
final CharSequence intro = info.loadIntro(mPm);
|
||||||
final String description = info.loadDescription(mPm);
|
final String description = info.loadDescription(mPm);
|
||||||
final int imageRes = info.getAnimatedImageRes();
|
final int imageRes = info.getAnimatedImageRes();
|
||||||
final String htmlDescription = info.loadHtmlDescription(mPm);
|
final String htmlDescription = info.loadHtmlDescription(mPm);
|
||||||
final String settingsClassName = info.getSettingsActivityName();
|
final String settingsClassName = info.getSettingsActivityName();
|
||||||
final String tileServiceClassName = info.getTileServiceClassName();
|
final String tileServiceClassName = info.getTileServiceClassName();
|
||||||
|
|
||||||
putBasicExtras(preference, prefKey, title, description, imageRes, htmlDescription,
|
putBasicExtras(preference, prefKey, title, intro, description, imageRes,
|
||||||
componentName);
|
htmlDescription, componentName);
|
||||||
putSettingsExtras(preference, componentName.getPackageName(), settingsClassName);
|
putSettingsExtras(preference, componentName.getPackageName(), settingsClassName);
|
||||||
putTileServiceExtras(preference, componentName.getPackageName(),
|
putTileServiceExtras(preference, componentName.getPackageName(),
|
||||||
tileServiceClassName);
|
tileServiceClassName);
|
||||||
@@ -722,11 +725,12 @@ public class AccessibilitySettings extends DashboardFragment {
|
|||||||
|
|
||||||
/** Puts the basic extras into {@link RestrictedPreference}'s getExtras(). */
|
/** Puts the basic extras into {@link RestrictedPreference}'s getExtras(). */
|
||||||
private void putBasicExtras(RestrictedPreference preference, String prefKey,
|
private void putBasicExtras(RestrictedPreference preference, String prefKey,
|
||||||
CharSequence title, CharSequence summary, int imageRes, String htmlDescription,
|
CharSequence title, CharSequence intro, CharSequence summary, int imageRes,
|
||||||
ComponentName componentName) {
|
String htmlDescription, ComponentName componentName) {
|
||||||
final Bundle extras = preference.getExtras();
|
final Bundle extras = preference.getExtras();
|
||||||
extras.putString(EXTRA_PREFERENCE_KEY, prefKey);
|
extras.putString(EXTRA_PREFERENCE_KEY, prefKey);
|
||||||
extras.putCharSequence(EXTRA_TITLE, title);
|
extras.putCharSequence(EXTRA_TITLE, title);
|
||||||
|
extras.putCharSequence(EXTRA_INTRO, intro);
|
||||||
extras.putCharSequence(EXTRA_SUMMARY, summary);
|
extras.putCharSequence(EXTRA_SUMMARY, summary);
|
||||||
extras.putParcelable(EXTRA_COMPONENT_NAME, componentName);
|
extras.putParcelable(EXTRA_COMPONENT_NAME, componentName);
|
||||||
extras.putInt(EXTRA_ANIMATED_IMAGE_RES, imageRes);
|
extras.putInt(EXTRA_ANIMATED_IMAGE_RES, imageRes);
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ import com.android.settings.widget.SettingsMainSwitchPreference;
|
|||||||
import com.android.settingslib.accessibility.AccessibilityUtils;
|
import com.android.settingslib.accessibility.AccessibilityUtils;
|
||||||
import com.android.settingslib.widget.IllustrationPreference;
|
import com.android.settingslib.widget.IllustrationPreference;
|
||||||
import com.android.settingslib.widget.OnMainSwitchChangeListener;
|
import com.android.settingslib.widget.OnMainSwitchChangeListener;
|
||||||
|
import com.android.settingslib.widget.TopIntroPreference;
|
||||||
|
|
||||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||||
|
|
||||||
@@ -92,8 +93,10 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
|||||||
protected Uri mImageUri;
|
protected Uri mImageUri;
|
||||||
private CharSequence mDescription;
|
private CharSequence mDescription;
|
||||||
protected CharSequence mHtmlDescription;
|
protected CharSequence mHtmlDescription;
|
||||||
|
protected CharSequence mTopIntroTitle;
|
||||||
|
|
||||||
private static final String DRAWABLE_FOLDER = "drawable";
|
private static final String DRAWABLE_FOLDER = "drawable";
|
||||||
|
protected static final String KEY_TOP_INTRO_PREFERENCE = "top_intro";
|
||||||
protected static final String KEY_USE_SERVICE_PREFERENCE = "use_service";
|
protected static final String KEY_USE_SERVICE_PREFERENCE = "use_service";
|
||||||
public static final String KEY_GENERAL_CATEGORY = "general_categories";
|
public static final String KEY_GENERAL_CATEGORY = "general_categories";
|
||||||
protected static final String KEY_HTML_DESCRIPTION_PREFERENCE = "html_description";
|
protected static final String KEY_HTML_DESCRIPTION_PREFERENCE = "html_description";
|
||||||
@@ -182,6 +185,7 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
|||||||
// Need to be called as early as possible. Protected variables will be assigned here.
|
// Need to be called as early as possible. Protected variables will be assigned here.
|
||||||
onProcessArguments(getArguments());
|
onProcessArguments(getArguments());
|
||||||
|
|
||||||
|
initTopIntroPreference();
|
||||||
initAnimatedImagePreference();
|
initAnimatedImagePreference();
|
||||||
initToggleServiceSwitchPreference();
|
initToggleServiceSwitchPreference();
|
||||||
initGeneralCategory();
|
initGeneralCategory();
|
||||||
@@ -388,11 +392,17 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
|||||||
mHtmlDescription = arguments.getCharSequence(
|
mHtmlDescription = arguments.getCharSequence(
|
||||||
AccessibilitySettings.EXTRA_HTML_DESCRIPTION);
|
AccessibilitySettings.EXTRA_HTML_DESCRIPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Intro.
|
||||||
|
if (arguments.containsKey(AccessibilitySettings.EXTRA_INTRO)) {
|
||||||
|
mTopIntroTitle = arguments.getCharSequence(AccessibilitySettings.EXTRA_INTRO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Customizes the order by preference key. */
|
/** Customizes the order by preference key. */
|
||||||
protected List<String> getPreferenceOrderList() {
|
protected List<String> getPreferenceOrderList() {
|
||||||
final List<String> lists = new ArrayList<>();
|
final List<String> lists = new ArrayList<>();
|
||||||
|
lists.add(KEY_TOP_INTRO_PREFERENCE);
|
||||||
lists.add(KEY_ANIMATED_IMAGE);
|
lists.add(KEY_ANIMATED_IMAGE);
|
||||||
lists.add(KEY_USE_SERVICE_PREFERENCE);
|
lists.add(KEY_USE_SERVICE_PREFERENCE);
|
||||||
lists.add(KEY_GENERAL_CATEGORY);
|
lists.add(KEY_GENERAL_CATEGORY);
|
||||||
@@ -461,6 +471,17 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
|||||||
getPreferenceScreen().addPreference(illustrationPreference);
|
getPreferenceScreen().addPreference(illustrationPreference);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
void initTopIntroPreference() {
|
||||||
|
if (TextUtils.isEmpty(mTopIntroTitle)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final TopIntroPreference topIntroPreference = new TopIntroPreference(getPrefContext());
|
||||||
|
topIntroPreference.setKey(KEY_TOP_INTRO_PREFERENCE);
|
||||||
|
topIntroPreference.setTitle(mTopIntroTitle);
|
||||||
|
getPreferenceScreen().addPreference(topIntroPreference);
|
||||||
|
}
|
||||||
|
|
||||||
private void initToggleServiceSwitchPreference() {
|
private void initToggleServiceSwitchPreference() {
|
||||||
mToggleServiceSwitchPreference = new SettingsMainSwitchPreference(getPrefContext());
|
mToggleServiceSwitchPreference = new SettingsMainSwitchPreference(getPrefContext());
|
||||||
mToggleServiceSwitchPreference.setKey(KEY_USE_SERVICE_PREFERENCE);
|
mToggleServiceSwitchPreference.setKey(KEY_USE_SERVICE_PREFERENCE);
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ import com.android.settings.R;
|
|||||||
import com.android.settings.accessibility.AccessibilityDialogUtils.DialogType;
|
import com.android.settings.accessibility.AccessibilityDialogUtils.DialogType;
|
||||||
import com.android.settings.accessibility.AccessibilityUtil.UserShortcutType;
|
import com.android.settings.accessibility.AccessibilityUtil.UserShortcutType;
|
||||||
import com.android.settings.testutils.shadow.ShadowFragment;
|
import com.android.settings.testutils.shadow.ShadowFragment;
|
||||||
|
import com.android.settingslib.widget.TopIntroPreference;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -81,6 +82,7 @@ public class ToggleFeaturePreferenceFragmentTest {
|
|||||||
private static final String PLACEHOLDER_DIALOG_TITLE = "title";
|
private static final String PLACEHOLDER_DIALOG_TITLE = "title";
|
||||||
private static final String DEFAULT_SUMMARY = "default summary";
|
private static final String DEFAULT_SUMMARY = "default summary";
|
||||||
private static final String DEFAULT_DESCRIPTION = "default description";
|
private static final String DEFAULT_DESCRIPTION = "default description";
|
||||||
|
private static final String DEFAULT_TOP_INTRO = "default top intro";
|
||||||
|
|
||||||
private static final String SOFTWARE_SHORTCUT_KEY =
|
private static final String SOFTWARE_SHORTCUT_KEY =
|
||||||
Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS;
|
Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS;
|
||||||
@@ -293,6 +295,23 @@ public class ToggleFeaturePreferenceFragmentTest {
|
|||||||
assertThat(getLatestPopupWindow().isShowing()).isTrue();
|
assertThat(getLatestPopupWindow().isShowing()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void initTopIntroPreference_hasTopIntroTitle_shouldSetAsExpectedValue() {
|
||||||
|
mFragment.mTopIntroTitle = DEFAULT_TOP_INTRO;
|
||||||
|
mFragment.initTopIntroPreference();
|
||||||
|
|
||||||
|
TopIntroPreference topIntroPreference =
|
||||||
|
(TopIntroPreference) mFragment.getPreferenceScreen().getPreference(/* index= */ 0);
|
||||||
|
assertThat(topIntroPreference.getTitle().toString()).isEqualTo(DEFAULT_TOP_INTRO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void initTopIntroPreference_topIntroTitleIsNull_shouldNotAdded() {
|
||||||
|
mFragment.initTopIntroPreference();
|
||||||
|
|
||||||
|
assertThat(mFragment.getPreferenceScreen().getPreferenceCount()).isEqualTo(0);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createFooterPreference_shouldSetAsExpectedValue() {
|
public void createFooterPreference_shouldSetAsExpectedValue() {
|
||||||
mFragment.createFooterPreference(mFragment.getPreferenceScreen(),
|
mFragment.createFooterPreference(mFragment.getPreferenceScreen(),
|
||||||
|
|||||||
Reference in New Issue
Block a user