Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 67b6b5a0 authored by Menghan Li's avatar Menghan Li Committed by Android (Google) Code Review
Browse files

Merge "Fix extra dim turns on failed in setting search bar"

parents 19faa146 d95d799d
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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.
+13 −1
Original line number Diff line number Diff line
@@ -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);
@@ -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);