diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0b4b7057fd5..4df054df23e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5335,8 +5335,8 @@
Swipe up from the bottom of the screen with 3 fingers.\n\nTo switch between features, swipe up with 3 fingers and hold.
Customize accessibility button
-
- Learn more
+
+ Learn more about %1$s
Hold volume keys
diff --git a/src/com/android/settings/accessibility/AccessibilityFooterPreference.java b/src/com/android/settings/accessibility/AccessibilityFooterPreference.java
index d68538e38cb..67b78273e3b 100644
--- a/src/com/android/settings/accessibility/AccessibilityFooterPreference.java
+++ b/src/com/android/settings/accessibility/AccessibilityFooterPreference.java
@@ -17,29 +17,19 @@
package com.android.settings.accessibility;
import android.content.Context;
-import android.content.Intent;
-import android.text.SpannableStringBuilder;
-import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.util.AttributeSet;
-import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.preference.PreferenceViewHolder;
-import com.android.settings.R;
-import com.android.settings.utils.AnnotationSpan;
-import com.android.settingslib.HelpUtils;
import com.android.settingslib.widget.FooterPreference;
/**
- * A custom preference acting as footer of a page. It has a field for icon and text. It is added
- * to screen as the last preference and groups of icon and text content in accessibility-focusable
- * {@link android.view.accessibility.AccessibilityNodeInfo} for TalkBack to use.
+ * A custom preference acting as footer of a page. Disables the movement method by default.
*/
public final class AccessibilityFooterPreference extends FooterPreference {
- private CharSequence mIconContentDescription;
private boolean mLinkEnabled;
public AccessibilityFooterPreference(Context context, AttributeSet attrs) {
@@ -65,33 +55,6 @@ public final class AccessibilityFooterPreference extends FooterPreference {
} else {
title.setMovementMethod(/* movement= */ null);
}
-
- final LinearLayout infoFrame = holder.itemView.findViewById(R.id.icon_frame);
- if (!TextUtils.isEmpty(mIconContentDescription)) {
- // Groups related content.
- infoFrame.setContentDescription(mIconContentDescription);
- title.setFocusable(false);
- } else {
- infoFrame.setContentDescription(null);
- title.setFocusable(true);
- }
- }
-
- /**
- * Sets the content description of the icon.
- */
- public void setIconContentDescription(CharSequence iconContentDescription) {
- if (!TextUtils.equals(iconContentDescription, mIconContentDescription)) {
- mIconContentDescription = iconContentDescription;
- notifyChanged();
- }
- }
-
- /**
- * Gets the content description of the icon.
- */
- public CharSequence getIconContentDescription() {
- return mIconContentDescription;
}
/**
@@ -110,23 +73,4 @@ public final class AccessibilityFooterPreference extends FooterPreference {
public boolean isLinkEnabled() {
return mLinkEnabled;
}
-
- /**
- * Appends {@link AnnotationSpan} with learn more link apart from the other text.
- *
- * @param helpLinkRes The Help Uri Resource key
- */
- public void appendHelpLink(int helpLinkRes) {
- final SpannableStringBuilder sb = new SpannableStringBuilder();
- sb.append(getTitle()).append("\n\n").append(getLearnMoreLink(getContext(), helpLinkRes));
- setTitle(sb);
- }
-
- private CharSequence getLearnMoreLink(Context context, int helpLinkRes) {
- final Intent helpIntent = HelpUtils.getHelpIntent(
- context, context.getString(helpLinkRes), context.getClass().getName());
- final AnnotationSpan.LinkInfo linkInfo = new AnnotationSpan.LinkInfo(
- context, AnnotationSpan.LinkInfo.DEFAULT_ANNOTATION, helpIntent);
- return AnnotationSpan.linkify(context.getText(R.string.footer_learn_more), linkInfo);
- }
}
diff --git a/src/com/android/settings/accessibility/AccessibilityFooterPreferenceController.java b/src/com/android/settings/accessibility/AccessibilityFooterPreferenceController.java
index 9fe4b3ab804..e3422e43fbd 100644
--- a/src/com/android/settings/accessibility/AccessibilityFooterPreferenceController.java
+++ b/src/com/android/settings/accessibility/AccessibilityFooterPreferenceController.java
@@ -17,11 +17,13 @@
package com.android.settings.accessibility;
import android.content.Context;
+import android.content.Intent;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
+import com.android.settingslib.HelpUtils;
/**
* Base class for accessibility preference footer.
@@ -59,13 +61,24 @@ public abstract class AccessibilityFooterPreferenceController extends BasePrefer
protected abstract String getLabelName();
private void updateFooterPreferences(AccessibilityFooterPreference footerPreference) {
- final String iconContentDescription = mContext.getString(
- R.string.accessibility_introduction_title, getLabelName());
- footerPreference.setIconContentDescription(iconContentDescription);
+ final StringBuffer sb = new StringBuffer();
+ sb.append(mContext.getString(
+ R.string.accessibility_introduction_title, getLabelName()))
+ .append("\n\n")
+ .append(footerPreference.getTitle());
+ footerPreference.setContentDescription(sb);
if (getHelpResource() != 0) {
- footerPreference.appendHelpLink(getHelpResource());
- footerPreference.setLinkEnabled(true);
+ footerPreference.setLearnMoreAction(view -> {
+ final Intent helpIntent = HelpUtils.getHelpIntent(
+ mContext, mContext.getString(getHelpResource()),
+ mContext.getClass().getName());
+ view.startActivityForResult(helpIntent, 0);
+ });
+
+ final String learnMoreContentDescription = mContext.getString(
+ R.string.footer_learn_more_content_description, getLabelName());
+ footerPreference.setLearnMoreContentDescription(learnMoreContentDescription);
}
}
}
diff --git a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
index 4b1725ffe63..7c189436b60 100644
--- a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
@@ -55,6 +55,7 @@ import com.android.settings.accessibility.AccessibilityUtil.UserShortcutType;
import com.android.settings.utils.LocaleUtils;
import com.android.settings.widget.SettingsMainSwitchBar;
import com.android.settings.widget.SettingsMainSwitchPreference;
+import com.android.settingslib.HelpUtils;
import com.android.settingslib.accessibility.AccessibilityUtils;
import com.android.settingslib.widget.OnMainSwitchChangeListener;
@@ -520,14 +521,25 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
new AccessibilityFooterPreference(screen.getContext());
htmlFooterPreference.setKey(KEY_HTML_DESCRIPTION_PREFERENCE);
htmlFooterPreference.setSummary(htmlDescription);
+ htmlFooterPreference.setContentDescription(
+ generateFooterContentDescription(htmlDescription));
+
// Only framework tools support help link
if (getHelpResource() != 0) {
- htmlFooterPreference.appendHelpLink(getHelpResource());
+ htmlFooterPreference.setLearnMoreAction(view -> {
+ final Intent helpIntent = HelpUtils.getHelpIntent(
+ getContext(), getContext().getString(getHelpResource()),
+ getContext().getClass().getName());
+ view.startActivityForResult(helpIntent, 0);
+ });
+
+ final String learnMoreContentDescription = getPrefContext().getString(
+ R.string.footer_learn_more_content_description, mPackageName);
+ htmlFooterPreference.setLearnMoreContentDescription(learnMoreContentDescription);
htmlFooterPreference.setLinkEnabled(true);
} else {
htmlFooterPreference.setLinkEnabled(false);
}
- htmlFooterPreference.setIconContentDescription(iconContentDescription);
screen.addPreference(htmlFooterPreference);
}
@@ -559,14 +571,33 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
final AccessibilityFooterPreference footerPreference =
new AccessibilityFooterPreference(screen.getContext());
footerPreference.setSummary(summary);
- footerPreference.setIconContentDescription(iconContentDescription);
+ footerPreference.setContentDescription(
+ generateFooterContentDescription(summary));
+
+ // Only framework tools support help link
if (getHelpResource() != 0) {
- footerPreference.appendHelpLink(getHelpResource());
- footerPreference.setLinkEnabled(true);
+ footerPreference.setLearnMoreAction(view -> {
+ final Intent helpIntent = HelpUtils.getHelpIntent(
+ getContext(), getContext().getString(getHelpResource()),
+ getContext().getClass().getName());
+ view.startActivityForResult(helpIntent, 0);
+ });
+
+ final String learnMoreContentDescription = getPrefContext().getString(
+ R.string.footer_learn_more_content_description, mPackageName);
+ footerPreference.setLearnMoreContentDescription(learnMoreContentDescription);
}
screen.addPreference(footerPreference);
}
+ private CharSequence generateFooterContentDescription(CharSequence footerContent) {
+ final StringBuffer sb = new StringBuffer();
+ sb.append(getPrefContext().getString(
+ R.string.accessibility_introduction_title, mPackageName))
+ .append("\n\n")
+ .append(footerContent);
+ return sb;
+ }
@VisibleForTesting
void setupEditShortcutDialog(Dialog dialog) {
final View dialogSoftwareView = dialog.findViewById(R.id.software_shortcut);
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilityButtonFooterPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilityButtonFooterPreferenceControllerTest.java
deleted file mode 100644
index 2640c813810..00000000000
--- a/tests/robotests/src/com/android/settings/accessibility/AccessibilityButtonFooterPreferenceControllerTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.accessibility;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.content.Context;
-
-import androidx.preference.PreferenceManager;
-import androidx.preference.PreferenceScreen;
-import androidx.test.core.app.ApplicationProvider;
-
-import com.android.settings.R;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
-
-/** Tests for {@link AccessibilityButtonFooterPreferenceController}. */
-@RunWith(RobolectricTestRunner.class)
-public class AccessibilityButtonFooterPreferenceControllerTest {
-
- private static final String TEST_KEY = "test_key";
- private static final String TEST_TITLE = "test_title";
- private final Context mContext = ApplicationProvider.getApplicationContext();
- private PreferenceScreen mScreen;
- private AccessibilityButtonFooterPreferenceController mController;
-
- @Before
- public void setUp() {
- final PreferenceManager preferenceManager = new PreferenceManager(mContext);
- mScreen = preferenceManager.createPreferenceScreen(mContext);
- final AccessibilityFooterPreference footerPreference =
- new AccessibilityFooterPreference(mContext);
- footerPreference.setKey(TEST_KEY);
- footerPreference.setTitle(TEST_TITLE);
- mScreen.addPreference(footerPreference);
- mController = new AccessibilityButtonFooterPreferenceController(mContext, TEST_KEY);
- }
-
- @Test
- public void onPreferenceChange_shouldSetCorrectIconContentDescription() {
- mController.displayPreference(mScreen);
-
- final AccessibilityFooterPreference footerPreference = mScreen.findPreference(TEST_KEY);
- final String packageName = mContext.getString(R.string.accessibility_button_title);
- final String iconContentDescription = mContext.getString(
- R.string.accessibility_introduction_title,
- packageName);
- assertThat(footerPreference.getIconContentDescription()).isEqualTo(iconContentDescription);
- }
-}
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilityControlTimeoutFooterPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilityControlTimeoutFooterPreferenceControllerTest.java
deleted file mode 100644
index 23e479be539..00000000000
--- a/tests/robotests/src/com/android/settings/accessibility/AccessibilityControlTimeoutFooterPreferenceControllerTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.accessibility;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.content.Context;
-
-import androidx.preference.PreferenceManager;
-import androidx.preference.PreferenceScreen;
-import androidx.test.core.app.ApplicationProvider;
-
-import com.android.settings.R;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
-
-/** Tests for {@link AccessibilityControlTimeoutFooterPreferenceController}. */
-@RunWith(RobolectricTestRunner.class)
-public class AccessibilityControlTimeoutFooterPreferenceControllerTest {
-
- private static final String TEST_KEY = "test_key";
- private static final String TEST_TITLE = "test_title";
- private final Context mContext = ApplicationProvider.getApplicationContext();
- private PreferenceScreen mScreen;
- private AccessibilityControlTimeoutFooterPreferenceController mController;
-
- @Before
- public void setUp() {
- final PreferenceManager preferenceManager = new PreferenceManager(mContext);
- mScreen = preferenceManager.createPreferenceScreen(mContext);
- final AccessibilityFooterPreference footerPreference =
- new AccessibilityFooterPreference(mContext);
- footerPreference.setKey(TEST_KEY);
- footerPreference.setTitle(TEST_TITLE);
- mScreen.addPreference(footerPreference);
- mController = new AccessibilityControlTimeoutFooterPreferenceController(mContext, TEST_KEY);
- }
-
- @Test
- public void onPreferenceChange_shouldSetCorrectIconContentDescription() {
- mController.displayPreference(mScreen);
-
- final AccessibilityFooterPreference footerPreference =
- mScreen.findPreference(TEST_KEY);
- final String packageName =
- mContext.getString(R.string.accessibility_setting_item_control_timeout_title);
- final String iconContentDescription = mContext.getString(
- R.string.accessibility_introduction_title,
- packageName);
- assertThat(footerPreference.getIconContentDescription()).isEqualTo(iconContentDescription);
- }
-}
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilityFooterPreferenceTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilityFooterPreferenceTest.java
index b8f97c7a3ea..14c56e84726 100644
--- a/tests/robotests/src/com/android/settings/accessibility/AccessibilityFooterPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilityFooterPreferenceTest.java
@@ -19,13 +19,12 @@ package com.android.settings.accessibility;
import static com.google.common.truth.Truth.assertThat;
import android.content.Context;
+import android.text.method.MovementMethod;
import android.view.LayoutInflater;
import android.view.View;
-import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.preference.PreferenceViewHolder;
-import androidx.test.core.app.ApplicationProvider;
import com.android.settings.R;
@@ -39,10 +38,6 @@ import org.robolectric.RuntimeEnvironment;
@RunWith(RobolectricTestRunner.class)
public final class AccessibilityFooterPreferenceTest {
- private static final String DEFAULT_SUMMARY = "default summary";
- private static final String DEFAULT_DESCRIPTION = "default description";
-
- private Context mContext = ApplicationProvider.getApplicationContext();
private AccessibilityFooterPreference mAccessibilityFooterPreference;
private PreferenceViewHolder mPreferenceViewHolder;
@@ -58,41 +53,22 @@ public final class AccessibilityFooterPreferenceTest {
}
@Test
- public void onBindViewHolder_initTextConfig_parseTextAndFocusable() {
- mAccessibilityFooterPreference.setSummary(DEFAULT_SUMMARY);
+ public void onBindViewHolder_LinkDisabledByDefault_notReturnLinkMovement() {
+ mAccessibilityFooterPreference.onBindViewHolder(mPreferenceViewHolder);
+
+ final TextView summaryView = (TextView) mPreferenceViewHolder.findViewById(
+ android.R.id.title);
+ assertThat(summaryView.getMovementMethod()).isNull();
+ }
+
+ @Test
+ public void onBindViewHolder_setLinkEnabled_returnLinkMovement() {
+ mAccessibilityFooterPreference.setLinkEnabled(true);
mAccessibilityFooterPreference.onBindViewHolder(mPreferenceViewHolder);
final TextView summaryView = (TextView) mPreferenceViewHolder.findViewById(
android.R.id.title);
- assertThat(summaryView.getText().toString()).isEqualTo(DEFAULT_SUMMARY);
- assertThat(summaryView.isFocusable()).isEqualTo(true);
- }
-
- @Test
- public void onBindViewHolder_initTextConfigAndAccessibleIcon_groupContentForAccessible() {
- mAccessibilityFooterPreference.setSummary(DEFAULT_SUMMARY);
- mAccessibilityFooterPreference.setIconContentDescription(DEFAULT_DESCRIPTION);
-
- mAccessibilityFooterPreference.onBindViewHolder(mPreferenceViewHolder);
-
- final TextView summaryView = (TextView) mPreferenceViewHolder.findViewById(
- android.R.id.title);
- assertThat(summaryView.getText().toString()).isEqualTo(DEFAULT_SUMMARY);
- assertThat(summaryView.isFocusable()).isEqualTo(false);
- final LinearLayout infoFrame = (LinearLayout) mPreferenceViewHolder.findViewById(
- R.id.icon_frame);
- assertThat(infoFrame.getContentDescription()).isEqualTo(DEFAULT_DESCRIPTION);
- assertThat(infoFrame.isFocusable()).isEqualTo(false);
- }
-
- @Test
- public void appendHelpLink_timeoutHelpUri_updateSummary() {
- mAccessibilityFooterPreference.setSummary(DEFAULT_SUMMARY);
-
- mAccessibilityFooterPreference.appendHelpLink(R.string.help_url_timeout);
-
- final String title = mAccessibilityFooterPreference.getTitle().toString();
- assertThat(title.contains(mContext.getString(R.string.footer_learn_more))).isTrue();
+ assertThat(summaryView.getMovementMethod()).isInstanceOf(MovementMethod.class);
}
}
diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptionFooterPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptionFooterPreferenceControllerTest.java
deleted file mode 100644
index e5f67c5f308..00000000000
--- a/tests/robotests/src/com/android/settings/accessibility/CaptionFooterPreferenceControllerTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.accessibility;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.content.Context;
-
-import androidx.preference.PreferenceManager;
-import androidx.preference.PreferenceScreen;
-import androidx.test.core.app.ApplicationProvider;
-
-import com.android.settings.R;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
-
-/** Tests for {@link CaptionFooterPreferenceController}. */
-@RunWith(RobolectricTestRunner.class)
-public class CaptionFooterPreferenceControllerTest {
-
- private static final String TEST_KEY = "test_key";
- private static final String TEST_TITLE = "test_title";
- private final Context mContext = ApplicationProvider.getApplicationContext();
- private PreferenceScreen mScreen;
- private CaptionFooterPreferenceController mController;
-
- @Before
- public void setUp() {
- final PreferenceManager preferenceManager = new PreferenceManager(mContext);
- mScreen = preferenceManager.createPreferenceScreen(mContext);
- final AccessibilityFooterPreference footerPreference =
- new AccessibilityFooterPreference(mContext);
- footerPreference.setKey(TEST_KEY);
- footerPreference.setTitle(TEST_TITLE);
- mScreen.addPreference(footerPreference);
- mController = new CaptionFooterPreferenceController(mContext, TEST_KEY);
- }
-
- @Test
- public void onPreferenceChange_shouldSetCorrectIconContentDescription() {
- mController.displayPreference(mScreen);
-
- final AccessibilityFooterPreference footerPreference = mScreen.findPreference(TEST_KEY);
- final String packageName = mContext.getString(R.string.accessibility_captioning_title);
- final String iconContentDescription = mContext.getString(
- R.string.accessibility_introduction_title,
- packageName);
- assertThat(footerPreference.getIconContentDescription()).isEqualTo(iconContentDescription);
- }
-}
diff --git a/tests/robotests/src/com/android/settings/accessibility/ToggleAutoclickFooterPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/ToggleAutoclickFooterPreferenceControllerTest.java
deleted file mode 100644
index 2be4752b4f5..00000000000
--- a/tests/robotests/src/com/android/settings/accessibility/ToggleAutoclickFooterPreferenceControllerTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.accessibility;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.content.Context;
-
-import androidx.preference.PreferenceManager;
-import androidx.preference.PreferenceScreen;
-import androidx.test.core.app.ApplicationProvider;
-
-import com.android.settings.R;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
-
-/** Tests for {@link ToggleAutoclickFooterPreferenceController}. */
-@RunWith(RobolectricTestRunner.class)
-public class ToggleAutoclickFooterPreferenceControllerTest {
-
- private static final String TEST_KEY = "test_key";
- private static final String TEST_TITLE = "test_title";
- private final Context mContext = ApplicationProvider.getApplicationContext();
- private PreferenceScreen mScreen;
- private ToggleAutoclickFooterPreferenceController mController;
-
- @Before
- public void setUp() {
- final PreferenceManager preferenceManager = new PreferenceManager(mContext);
- mScreen = preferenceManager.createPreferenceScreen(mContext);
- final AccessibilityFooterPreference footerPreference =
- new AccessibilityFooterPreference(mContext);
- footerPreference.setKey(TEST_KEY);
- footerPreference.setTitle(TEST_TITLE);
- mScreen.addPreference(footerPreference);
- mController = new ToggleAutoclickFooterPreferenceController(mContext, TEST_KEY);
- }
-
- @Test
- public void onPreferenceChange_shouldSetCorrectIconContentDescription() {
- mController.displayPreference(mScreen);
-
- final AccessibilityFooterPreference footerPreference = mScreen.findPreference(TEST_KEY);
- final String packageName = mContext.getString(
- R.string.accessibility_autoclick_preference_title);
- final String iconContentDescription = mContext.getString(
- R.string.accessibility_introduction_title,
- packageName);
- assertThat(footerPreference.getIconContentDescription()).isEqualTo(iconContentDescription);
- }
-}
diff --git a/tests/robotests/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragmentTest.java
index 01e9b38440d..4f4185cb81c 100644
--- a/tests/robotests/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragmentTest.java
@@ -215,8 +215,6 @@ public class ToggleFeaturePreferenceFragmentTest {
(AccessibilityFooterPreference) mFragment.getPreferenceScreen().getPreference(
mFragment.getPreferenceScreen().getPreferenceCount() - 1);
assertThat(accessibilityFooterPreference.getSummary()).isEqualTo(DEFAULT_SUMMARY);
- assertThat(accessibilityFooterPreference.getIconContentDescription()).isEqualTo(
- DEFAULT_DESCRIPTION);
assertThat(accessibilityFooterPreference.isSelectable()).isEqualTo(true);
assertThat(accessibilityFooterPreference.getOrder()).isEqualTo(Integer.MAX_VALUE - 1);
}