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

Commit 2f1160fd authored by Chun-Ku Lin's avatar Chun-Ku Lin Committed by Android (Google) Code Review
Browse files

Merge "Remove the legacy mechanism to auto add an a11y shortcut capable tile" into main

parents 96c3f9d2 51c6e873
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -16,7 +16,9 @@

package com.android.systemui.qs.pipeline.domain.autoaddable

import android.platform.test.annotations.EnabledOnRavenwood
import android.platform.test.annotations.DisableFlags
import android.platform.test.annotations.EnableFlags
import android.view.accessibility.Flags
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
@@ -44,7 +46,6 @@ import org.mockito.MockitoAnnotations

@OptIn(ExperimentalCoroutinesApi::class)
@SmallTest
@EnabledOnRavenwood
@RunWith(AndroidJUnit4::class)
class ReduceBrightColorsAutoAddableTest : SysuiTestCase() {

@@ -67,12 +68,14 @@ class ReduceBrightColorsAutoAddableTest : SysuiTestCase() {
        }

    @Test
    @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT)
    fun available_strategyIfNotAdded() =
        testWithFeatureAvailability(available = true) {
            assertThat(underTest.autoAddTracking).isEqualTo(AutoAddTracking.IfNotAdded(SPEC))
        }

    @Test
    @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT)
    fun activated_addSignal() = testWithFeatureAvailability {
        val signal by collectLastValue(underTest.autoAddSignal(0))
        runCurrent()
@@ -85,6 +88,7 @@ class ReduceBrightColorsAutoAddableTest : SysuiTestCase() {
    }

    @Test
    @DisableFlags(Flags.FLAG_A11Y_QS_SHORTCUT)
    fun notActivated_noSignal() = testWithFeatureAvailability {
        val signal by collectLastValue(underTest.autoAddSignal(0))
        runCurrent()
@@ -96,6 +100,13 @@ class ReduceBrightColorsAutoAddableTest : SysuiTestCase() {
        assertThat(signal).isNull()
    }

    @Test
    @EnableFlags(Flags.FLAG_A11Y_QS_SHORTCUT)
    fun available_a11yQsShortcutFlagEnabled_strategyDisabled() =
        testWithFeatureAvailability(available = true) {
            assertThat(underTest.autoAddTracking).isEqualTo(AutoAddTracking.Disabled)
        }

    private fun testWithFeatureAvailability(
        available: Boolean = true,
        body: suspend TestScope.() -> TestResult
+0 −3
Original line number Diff line number Diff line
@@ -116,9 +116,6 @@
         The syntax is setting-name:spec. If the tile is a TileService, the spec should be specified
         as custom(package/class). Relative class name is supported. -->
    <string-array name="config_quickSettingsAutoAdd" translatable="false">
        <item>accessibility_display_daltonizer_enabled:color_correction</item>
        <item>accessibility_display_inversion_enabled:inversion</item>
        <item>one_handed_mode_enabled:onehanded</item>
        <item>accessibility_font_scaling_has_been_changed:font_scaling</item>
    </string-array>

+4 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.qs.pipeline.domain.autoaddable

import android.view.accessibility.Flags
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.qs.ReduceBrightColorsController
import com.android.systemui.qs.dagger.QSFlagsModule.RBC_AVAILABLE
@@ -58,7 +59,9 @@ constructor(

    override val autoAddTracking
        get() =
            if (available) {
            if (Flags.a11yQsShortcut()) {
                AutoAddTracking.Disabled
            } else if (available) {
                super.autoAddTracking
            } else {
                AutoAddTracking.Disabled