Loading src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceController.java +5 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,11 @@ public abstract class AccessibilityQuickSettingsPrimarySwitchPreferenceControlle } private void showQuickSettingsTooltipIfNeeded() { if (mPreference == null) { // Returns if no preference found by slice highlight menu. return; } final ComponentName tileComponentName = getTileComponentName(); if (tileComponentName == null) { // Returns if no tile service assigned. Loading tests/robotests/src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceControllerTest.java +13 −1 Original line number Diff line number Diff line Loading @@ -118,18 +118,29 @@ public class AccessibilityQuickSettingsPrimarySwitchPreferenceControllerTest { mController = new TestAccessibilityQuickSettingsPrimarySwitchPreferenceController(mContext, TEST_KEY); when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference); mController.displayPreference(mScreen); } @Test public void setChecked_showTooltipView() { mController.displayPreference(mScreen); mController.setChecked(true); assertThat(getLatestPopupWindow().isShowing()).isTrue(); } @Test public void setChecked_notCallDisplayPreference_notShowTooltipView() { // Simulates the slice highlight menu that does not call {@link #displayPreference} before // {@link #setChecked} called. mController.setChecked(true); assertThat(getLatestPopupWindow()).isNull(); } @Test public void setChecked_tooltipViewShown_notShowTooltipView() { mController.displayPreference(mScreen); mController.setChecked(true); getLatestPopupWindow().dismiss(); mController.setChecked(false); Loading @@ -142,6 +153,7 @@ public class AccessibilityQuickSettingsPrimarySwitchPreferenceControllerTest { @Test @Config(shadows = ShadowFragment.class) public void restoreValueFromSavedInstanceState_showTooltipView() { mController.displayPreference(mScreen); mController.setChecked(true); final Bundle savedInstanceState = new Bundle(); savedInstanceState.putBoolean(KEY_SAVED_QS_TOOLTIP_RESHOW, /* value= */ true); Loading Loading
src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceController.java +5 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,11 @@ public abstract class AccessibilityQuickSettingsPrimarySwitchPreferenceControlle } private void showQuickSettingsTooltipIfNeeded() { if (mPreference == null) { // Returns if no preference found by slice highlight menu. return; } final ComponentName tileComponentName = getTileComponentName(); if (tileComponentName == null) { // Returns if no tile service assigned. Loading
tests/robotests/src/com/android/settings/accessibility/AccessibilityQuickSettingsPrimarySwitchPreferenceControllerTest.java +13 −1 Original line number Diff line number Diff line Loading @@ -118,18 +118,29 @@ public class AccessibilityQuickSettingsPrimarySwitchPreferenceControllerTest { mController = new TestAccessibilityQuickSettingsPrimarySwitchPreferenceController(mContext, TEST_KEY); when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference); mController.displayPreference(mScreen); } @Test public void setChecked_showTooltipView() { mController.displayPreference(mScreen); mController.setChecked(true); assertThat(getLatestPopupWindow().isShowing()).isTrue(); } @Test public void setChecked_notCallDisplayPreference_notShowTooltipView() { // Simulates the slice highlight menu that does not call {@link #displayPreference} before // {@link #setChecked} called. mController.setChecked(true); assertThat(getLatestPopupWindow()).isNull(); } @Test public void setChecked_tooltipViewShown_notShowTooltipView() { mController.displayPreference(mScreen); mController.setChecked(true); getLatestPopupWindow().dismiss(); mController.setChecked(false); Loading @@ -142,6 +153,7 @@ public class AccessibilityQuickSettingsPrimarySwitchPreferenceControllerTest { @Test @Config(shadows = ShadowFragment.class) public void restoreValueFromSavedInstanceState_showTooltipView() { mController.displayPreference(mScreen); mController.setChecked(true); final Bundle savedInstanceState = new Bundle(); savedInstanceState.putBoolean(KEY_SAVED_QS_TOOLTIP_RESHOW, /* value= */ true); Loading