Loading src/com/android/settings/accessibility/shortcuts/EditShortcutsPreferenceFragment.java +10 −0 Original line number Diff line number Diff line Loading @@ -206,6 +206,16 @@ public class EditShortcutsPreferenceFragment extends DashboardFragment { public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { super.onCreatePreferences(savedInstanceState, rootKey); // Expand to show the Triple Tap shortcut if the user already has that shortcut enabled. // This shortcut affects touch responsiveness so we want to ensure that the user sees that // the shortcut is enabled without requiring them to manually expand it. TripleTapShortcutOptionController tripleTapShortcutOptionController = use(TripleTapShortcutOptionController.class); if (tripleTapShortcutOptionController.isShortcutAvailable() && tripleTapShortcutOptionController.isChecked()) { onExpanded(); } Activity activity = getActivity(); final Preference descriptionPref = findPreference(getString( R.string.accessibility_shortcut_description_pref)); Loading tests/robotests/src/com/android/settings/accessibility/shortcuts/EditShortcutsPreferenceFragmentTest.java +21 −0 Original line number Diff line number Diff line Loading @@ -435,6 +435,27 @@ public class EditShortcutsPreferenceFragmentTest { }); } @Test public void fragmentCreated_tripleTapEnabled_automaticallyExpanded() { Settings.Secure.putInt( mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, AccessibilityUtil.State.ON); ShadowLooper.runUiThreadTasksIncludingDelayedTasks(); mFragmentScenario = createFragScenario(/* isInSuw= */ false, TARGET); mFragmentScenario.moveToState(Lifecycle.State.RESUMED); mFragmentScenario.onFragment(fragment -> { Preference advanced = fragment.findPreference( mContext.getString(R.string.accessibility_shortcuts_advanced_collapsed)); assertThat(advanced.isVisible()).isFalse(); Preference tripleTap = fragment.findPreference( mContext.getString(R.string.accessibility_shortcut_triple_tap_pref)); assertThat(tripleTap.isVisible()).isTrue(); }); } @Test public void fragmentRecreated_expanded_advancedRemainInvisible() { onAdvancedPreferenceClicked_advancedShouldBecomeInvisible(); Loading Loading
src/com/android/settings/accessibility/shortcuts/EditShortcutsPreferenceFragment.java +10 −0 Original line number Diff line number Diff line Loading @@ -206,6 +206,16 @@ public class EditShortcutsPreferenceFragment extends DashboardFragment { public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { super.onCreatePreferences(savedInstanceState, rootKey); // Expand to show the Triple Tap shortcut if the user already has that shortcut enabled. // This shortcut affects touch responsiveness so we want to ensure that the user sees that // the shortcut is enabled without requiring them to manually expand it. TripleTapShortcutOptionController tripleTapShortcutOptionController = use(TripleTapShortcutOptionController.class); if (tripleTapShortcutOptionController.isShortcutAvailable() && tripleTapShortcutOptionController.isChecked()) { onExpanded(); } Activity activity = getActivity(); final Preference descriptionPref = findPreference(getString( R.string.accessibility_shortcut_description_pref)); Loading
tests/robotests/src/com/android/settings/accessibility/shortcuts/EditShortcutsPreferenceFragmentTest.java +21 −0 Original line number Diff line number Diff line Loading @@ -435,6 +435,27 @@ public class EditShortcutsPreferenceFragmentTest { }); } @Test public void fragmentCreated_tripleTapEnabled_automaticallyExpanded() { Settings.Secure.putInt( mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, AccessibilityUtil.State.ON); ShadowLooper.runUiThreadTasksIncludingDelayedTasks(); mFragmentScenario = createFragScenario(/* isInSuw= */ false, TARGET); mFragmentScenario.moveToState(Lifecycle.State.RESUMED); mFragmentScenario.onFragment(fragment -> { Preference advanced = fragment.findPreference( mContext.getString(R.string.accessibility_shortcuts_advanced_collapsed)); assertThat(advanced.isVisible()).isFalse(); Preference tripleTap = fragment.findPreference( mContext.getString(R.string.accessibility_shortcut_triple_tap_pref)); assertThat(tripleTap.isVisible()).isTrue(); }); } @Test public void fragmentRecreated_expanded_advancedRemainInvisible() { onAdvancedPreferenceClicked_advancedShouldBecomeInvisible(); Loading