Allow Magnification Settings launch from outside of AccessibilitySettings

Before this CL, Magnification Settings can only be
launched from MagnificationPreferenceController.

This CL initializes FooterPreferenceController if the
parent class does not initialize it from Intent extras.

Bug: 268411305
Test: manual
      make RunSettingsRoboTests ROBOTEST_FILTER=MagnificationGesturesPreferenceControllerTest
      make RunSettingsRoboTests ROBOTEST_FILTER=ToggleScreenMagnificationPreferenceFragmentTest
Change-Id: I954739c39c823ce7fe0daa711743f729d182571b
This commit is contained in:
Arc Wang
2023-02-18 16:08:24 +08:00
parent f144ed6e00
commit 1596a2838d
4 changed files with 44 additions and 12 deletions

View File

@@ -23,6 +23,7 @@ import static com.android.settings.accessibility.ToggleFeaturePreferenceFragment
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
@@ -405,6 +406,17 @@ public class ToggleScreenMagnificationPreferenceFragmentTest {
assertThat(mFragment.getHelpResource()).isEqualTo(R.string.help_url_magnification);
}
@Test
public void onProcessArguments_defaultArgumentUnavailable_shouldSetDefaultArguments() {
Bundle arguments = new Bundle();
mFragment.onProcessArguments(arguments);
assertTrue(arguments.containsKey(AccessibilitySettings.EXTRA_PREFERENCE_KEY));
assertTrue(arguments.containsKey(AccessibilitySettings.EXTRA_INTRO));
assertTrue(arguments.containsKey(AccessibilitySettings.EXTRA_HTML_DESCRIPTION));
}
private void putStringIntoSettings(String key, String componentName) {
Settings.Secure.putString(mContext.getContentResolver(), key, componentName);
}