Create an empty color and motion screen with Catalyst Infra
Bug: 373451690
Test: atest ColorAndMotionScreenTest
Flag: com.android.settings.flags.catalyst_accessibility_color_and_motion
Change-Id: I4bfa5ec4d15bd745d691f586e49318b1b0a9bf6c
diff --git a/aconfig/catalyst/accessibility.aconfig b/aconfig/catalyst/accessibility.aconfig
index 80a9d62..7837067 100644
--- a/aconfig/catalyst/accessibility.aconfig
+++ b/aconfig/catalyst/accessibility.aconfig
@@ -2,8 +2,15 @@
container: "system"
flag {
+ name: "catalyst_accessibility_color_and_motion"
+ namespace: "android_settings"
+ description: "Migrate Color and motion screen to the Catalyst infrastructure"
+ bug: "323791114"
+}
+
+flag {
name: "catalyst_text_reading_screen"
namespace: "android_settings"
description: "Flag for Display size and text"
bug: "323791114"
-}
\ No newline at end of file
+}
diff --git a/src/com/android/settings/accessibility/ColorAndMotionFragment.java b/src/com/android/settings/accessibility/ColorAndMotionFragment.java
index 4ea2226..7a7c21d 100644
--- a/src/com/android/settings/accessibility/ColorAndMotionFragment.java
+++ b/src/com/android/settings/accessibility/ColorAndMotionFragment.java
@@ -17,12 +17,15 @@
package com.android.settings.accessibility;
import android.app.settings.SettingsEnums;
+import android.content.Context;
import android.hardware.display.ColorDisplayManager;
import android.os.Bundle;
import android.os.Handler;
import android.provider.Settings;
import android.view.accessibility.Flags;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.TwoStatePreference;
@@ -148,6 +151,12 @@
}
}
+ @Nullable
+ @Override
+ public String getPreferenceScreenBindingKey(@NonNull Context context) {
+ return ColorAndMotionScreen.KEY;
+ }
+
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.accessibility_color_and_motion);
}
diff --git a/src/com/android/settings/accessibility/ColorAndMotionScreen.kt b/src/com/android/settings/accessibility/ColorAndMotionScreen.kt
new file mode 100644
index 0000000..20a71e3
--- /dev/null
+++ b/src/com/android/settings/accessibility/ColorAndMotionScreen.kt
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.accessibility
+
+import android.content.Context
+import com.android.settings.flags.Flags
+import com.android.settings.R
+import com.android.settingslib.metadata.ProvidePreferenceScreen
+import com.android.settingslib.metadata.preferenceHierarchy
+import com.android.settingslib.preference.PreferenceScreenCreator
+
+@ProvidePreferenceScreen
+class ColorAndMotionScreen : PreferenceScreenCreator {
+ override val key: String = KEY
+ override val title: Int = R.string.accessibility_color_and_motion_title
+
+ override fun isFlagEnabled(context: Context) = Flags.catalystAccessibilityColorAndMotion()
+
+ override fun hasCompleteHierarchy(): Boolean = false
+
+ override fun fragmentClass() = ColorAndMotionFragment::class.java
+
+ override fun getPreferenceHierarchy(context: Context) = preferenceHierarchy(this) {}
+
+
+ companion object {
+ const val KEY = "accessibility_color_and_motion"
+ }
+}
\ No newline at end of file
diff --git a/tests/robotests/OWNERS b/tests/robotests/OWNERS
index 8a7a27e..e15af1c 100644
--- a/tests/robotests/OWNERS
+++ b/tests/robotests/OWNERS
@@ -1,2 +1,3 @@
# We do not guard tests - everyone is welcomed to contribute to tests.
-per-file *.java=*
\ No newline at end of file
+per-file *.java=*
+per-file *.kt=*
diff --git a/tests/robotests/src/com/android/settings/accessibility/ColorAndMotionScreenTest.kt b/tests/robotests/src/com/android/settings/accessibility/ColorAndMotionScreenTest.kt
new file mode 100644
index 0000000..6d7164e
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/ColorAndMotionScreenTest.kt
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.accessibility
+
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import com.android.settings.flags.Flags
+import com.android.settingslib.preference.CatalystScreenTestCase
+import com.android.settingslib.preference.PreferenceScreenCreator
+import com.google.common.truth.Truth.assertThat
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@RunWith(AndroidJUnit4::class)
+class ColorAndMotionScreenTest : CatalystScreenTestCase() {
+ override val preferenceScreenCreator: PreferenceScreenCreator = ColorAndMotionScreen()
+ override val flagName: String = Flags.FLAG_CATALYST_ACCESSIBILITY_COLOR_AND_MOTION
+
+ override fun migration() {}
+
+ @Test
+ fun key() {
+ assertThat(preferenceScreenCreator.key).isEqualTo(ColorAndMotionScreen.KEY)
+ }
+}
\ No newline at end of file