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

Commit 51c6e873 authored by Chun-Ku Lin's avatar Chun-Ku Lin
Browse files

Remove the legacy mechanism to auto add an a11y shortcut capable tile

With the introduction of the a11y qs shortcut option in the a11y
settings page, for a11y features that has the a11y shortcut toggle, we
use different mechanism to auto add the tile. We no longer need the
legacy mechanism to auto add an a11y shortcut capable tile.

Bug: 330628129
Test: Manually turn on the a11y feature won't automatically add the tile
in QS Panel. Manually turn on the a11y feature's qs shortcut option will
automatically add the tile in the QS Panel.
Test: atest ReduceBrightColorsAutoAddableTest

Flag: ACONFIG android.view.accessibility.a11y_qs_shortcut TRUNKFOOD FULL
Flag: NA EXEMPT not able to feature flag config.xml change
Change-Id: Ie048f539bd82e62250b3adf46b53b8e59dd4794c
parent ec54e9d3
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