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

Commit a13b3f49 authored by Zhibin Liu's avatar Zhibin Liu Committed by Android (Google) Code Review
Browse files

Merge "Add expressive design flag for SPA" into main

parents 50f245cb da49530f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -24,7 +24,9 @@ android_library {
    srcs: ["src/**/*.kt"],
    use_resource_processor: true,
    static_libs: [
        "MPAndroidChart",
        "SettingsLibColor",
        "aconfig_settingstheme_exported_flags_java_lib",
        "androidx.compose.animation_animation",
        "androidx.compose.material3_material3",
        "androidx.compose.material_material-icons-extended",
@@ -36,7 +38,6 @@ android_library {
        "androidx.navigation_navigation-compose",
        "com.google.android.material_material",
        "lottie_compose",
        "MPAndroidChart",
    ],
    kotlincflags: [
        "-Xjvm-default=all",
+5 −2
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import com.android.settingslib.spa.framework.util.SystemProperties
import com.android.settingslib.widget.theme.flags.Flags

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

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

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.automirrored.outlined.Launch
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.performClick
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 org.junit.Rule
import org.junit.Test
@@ -37,6 +40,8 @@ import org.junit.runner.RunWith
class ActionButtonsTest {
    @get:Rule
    val composeTestRule = createComposeRule()
    @get:Rule
    val mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule()

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

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

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.fillMaxSize
import androidx.compose.foundation.lazy.LazyColumn
@@ -52,6 +54,7 @@ import androidx.compose.ui.text.TextStyle
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.android.settingslib.spa.testutils.rootWidth
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 org.junit.Rule
import org.junit.Test
@@ -62,6 +65,8 @@ import org.junit.runner.RunWith
class CustomizedAppBarTest {

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

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

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