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

Commit da49530f authored by Zhibin Liu's avatar Zhibin Liu
Browse files

Add expressive design flag for SPA

Bug: 386013400
Flag: com.android.settingslib.widget.theme.flags.is_expressive_design_enabled
Test: manual test via build & robotest
Change-Id: Ie99ab9827fd572e3fe92c1d5cba37d490f33fba3
parent cc83e680
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -24,7 +24,9 @@ android_library {
    srcs: ["src/**/*.kt"],
    srcs: ["src/**/*.kt"],
    use_resource_processor: true,
    use_resource_processor: true,
    static_libs: [
    static_libs: [
        "MPAndroidChart",
        "SettingsLibColor",
        "SettingsLibColor",
        "aconfig_settingstheme_exported_flags_java_lib",
        "androidx.compose.animation_animation",
        "androidx.compose.animation_animation",
        "androidx.compose.material3_material3",
        "androidx.compose.material3_material3",
        "androidx.compose.material_material-icons-extended",
        "androidx.compose.material_material-icons-extended",
@@ -36,7 +38,6 @@ android_library {
        "androidx.navigation_navigation-compose",
        "androidx.navigation_navigation-compose",
        "com.google.android.material_material",
        "com.google.android.material_material",
        "lottie_compose",
        "lottie_compose",
        "MPAndroidChart",
    ],
    ],
    kotlincflags: [
    kotlincflags: [
        "-Xjvm-default=all",
        "-Xjvm-default=all",
+5 −2
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.CompositionLocalProvider
import com.android.settingslib.spa.framework.util.SystemProperties
import com.android.settingslib.spa.framework.util.SystemProperties
import com.android.settingslib.widget.theme.flags.Flags


/**
/**
 * The Material 3 Theme for Settings.
 * The Material 3 Theme for Settings.
@@ -42,5 +43,7 @@ fun SettingsTheme(content: @Composable () -> Unit) {
    }
    }
}
}


val isSpaExpressiveEnabled
val isSpaExpressiveEnabled by lazy {
    by lazy { SystemProperties.getBoolean("is_expressive_design_enabled", false) }
    SystemProperties.getBoolean("is_expressive_design_enabled", false) ||
        Flags.isExpressiveDesignEnabled()
}
+4 −0
Original line number Original line Diff line number Diff line
@@ -30,10 +30,14 @@ android_test {
    static_libs: [
    static_libs: [
        "SpaLib",
        "SpaLib",
        "SpaLibTestUtils",
        "SpaLibTestUtils",
        "aconfig_settingstheme_exported_flags_java_lib",
        "androidx.compose.runtime_runtime",
        "androidx.compose.runtime_runtime",
        "androidx.test.ext.junit",
        "androidx.test.ext.junit",
        "androidx.test.runner",
        "androidx.test.runner",
        "flag-junit",
        "flag-junit-base",
        "mockito-target-minus-junit4",
        "mockito-target-minus-junit4",
        "platform-test-annotations",
    ],
    ],
    kotlincflags: ["-Xjvm-default=all"],
    kotlincflags: ["-Xjvm-default=all"],
    sdk_version: "current",
    sdk_version: "current",
+6 −0
Original line number Original line Diff line number Diff line
@@ -16,6 +16,8 @@


package com.android.settingslib.spa.widget.button
package com.android.settingslib.spa.widget.button


import android.platform.test.annotations.RequiresFlagsDisabled
import android.platform.test.flag.junit.DeviceFlagsValueProvider
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.Launch
import androidx.compose.material.icons.automirrored.outlined.Launch
import androidx.compose.material.icons.outlined.Close
import androidx.compose.material.icons.outlined.Close
@@ -28,6 +30,7 @@ import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performClick
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.android.settingslib.widget.theme.flags.Flags.FLAG_IS_EXPRESSIVE_DESIGN_ENABLED
import com.google.common.truth.Truth.assertThat
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Rule
import org.junit.Test
import org.junit.Test
@@ -37,6 +40,8 @@ import org.junit.runner.RunWith
class ActionButtonsTest {
class ActionButtonsTest {
    @get:Rule
    @get:Rule
    val composeTestRule = createComposeRule()
    val composeTestRule = createComposeRule()
    @get:Rule
    val mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule()


    @Test
    @Test
    fun button_displayed() {
    fun button_displayed() {
@@ -54,6 +59,7 @@ class ActionButtonsTest {
        composeTestRule.onNodeWithText("Open").assertIsDisplayed()
        composeTestRule.onNodeWithText("Open").assertIsDisplayed()
    }
    }


    @RequiresFlagsDisabled(FLAG_IS_EXPRESSIVE_DESIGN_ENABLED)
    @Test
    @Test
    fun button_clickable() {
    fun button_clickable() {
        var clicked by mutableStateOf(false)
        var clicked by mutableStateOf(false)
+6 −0
Original line number Original line Diff line number Diff line
@@ -16,6 +16,8 @@


package com.android.settingslib.spa.widget.scaffold
package com.android.settingslib.spa.widget.scaffold


import android.platform.test.annotations.RequiresFlagsDisabled
import android.platform.test.flag.junit.DeviceFlagsValueProvider
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyColumn
@@ -52,6 +54,7 @@ import androidx.compose.ui.text.TextStyle
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.android.settingslib.spa.testutils.rootWidth
import com.android.settingslib.spa.testutils.rootWidth
import com.android.settingslib.spa.testutils.setContentForSizeAssertions
import com.android.settingslib.spa.testutils.setContentForSizeAssertions
import com.android.settingslib.widget.theme.flags.Flags.FLAG_IS_EXPRESSIVE_DESIGN_ENABLED
import com.google.common.truth.Truth.assertThat
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Rule
import org.junit.Test
import org.junit.Test
@@ -62,6 +65,8 @@ import org.junit.runner.RunWith
class CustomizedAppBarTest {
class CustomizedAppBarTest {


    @get:Rule val rule = createComposeRule()
    @get:Rule val rule = createComposeRule()
    @get:Rule
    val mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule()


    @Test
    @Test
    fun smallTopAppBar_expandsToScreen() {
    fun smallTopAppBar_expandsToScreen() {
@@ -97,6 +102,7 @@ class CustomizedAppBarTest {
        assertThat(textStyle).isEqualTo(expectedTextStyle)
        assertThat(textStyle).isEqualTo(expectedTextStyle)
    }
    }


    @RequiresFlagsDisabled(FLAG_IS_EXPRESSIVE_DESIGN_ENABLED)
    @Test
    @Test
    fun smallTopAppBar_contentColor() {
    fun smallTopAppBar_contentColor() {
        var titleColor: Color = Color.Unspecified
        var titleColor: Color = Color.Unspecified