summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chun-Ku Lin <chunkulin@google.com> 2024-04-02 19:26:48 +0000
committer Chun-Ku Lin <chunkulin@google.com> 2024-04-04 00:46:28 +0000
commit51c6e873acf751fe87f082c0e382e49858af9fed (patch)
tree8ca1b0d3ce30d9a84aa760b36af871283de20b5e
parentec54e9d34057976306a8600f43748d79e9623319 (diff)
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
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/ReduceBrightColorsAutoAddableTest.kt15
-rw-r--r--packages/SystemUI/res/values/config.xml3
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/pipeline/domain/autoaddable/ReduceBrightColorsAutoAddable.kt5
3 files changed, 17 insertions, 6 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/ReduceBrightColorsAutoAddableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/ReduceBrightColorsAutoAddableTest.kt
index 6d6fd754341d..d0699aa12a43 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/ReduceBrightColorsAutoAddableTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/autoaddable/ReduceBrightColorsAutoAddableTest.kt
@@ -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
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index a6f6d4dcf2f9..fa9d507dbff5 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -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>
diff --git a/packages/SystemUI/src/com/android/systemui/qs/pipeline/domain/autoaddable/ReduceBrightColorsAutoAddable.kt b/packages/SystemUI/src/com/android/systemui/qs/pipeline/domain/autoaddable/ReduceBrightColorsAutoAddable.kt
index 267e2b7d0609..9c1b85799648 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/pipeline/domain/autoaddable/ReduceBrightColorsAutoAddable.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/pipeline/domain/autoaddable/ReduceBrightColorsAutoAddable.kt
@@ -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