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

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

Merge "Create an empty color and motion screen with Catalyst Infra" into main

parents 29641287 688cc944
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
package: "com.android.settings.flags"
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"
+9 −0
Original line number Diff line number Diff line
@@ -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 @@ public class ColorAndMotionFragment extends DashboardFragment {
        }
    }

    @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);
}
+43 −0
Original line number Diff line number Diff line
/*
 * 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
+2 −1
Original line number Diff line number Diff line
# We do not guard tests - everyone is welcomed to contribute to tests.
per-file *.java=*
per-file *.kt=*
+38 −0
Original line number Diff line number Diff line
/*
 * 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