Merge "Rename SystemUIComposeCore to PlatformComposeCore (1/2)" into tm-qpr-dev

This commit is contained in:
TreeHugger Robot
2022-12-28 17:51:12 +00:00
committed by Android (Google) Code Review
33 changed files with 58 additions and 59 deletions

View File

@@ -60,7 +60,7 @@ systemui_compose_java_defaults {
// except for SystemUI-core. // except for SystemUI-core.
// Copied from compose/features/Android.bp. // Copied from compose/features/Android.bp.
static_libs: [ static_libs: [
"SystemUIComposeCore", "PlatformComposeCore",
"androidx.compose.runtime_runtime", "androidx.compose.runtime_runtime",
"androidx.compose.material3_material3", "androidx.compose.material3_material3",

View File

@@ -22,7 +22,7 @@ package {
} }
android_library { android_library {
name: "SystemUIComposeCore", name: "PlatformComposeCore",
manifest: "AndroidManifest.xml", manifest: "AndroidManifest.xml",
srcs: [ srcs: [

View File

@@ -16,7 +16,7 @@
--> -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.systemui.compose.core"> package="com.android.compose.core">
</manifest> </manifest>

View File

@@ -1,7 +1,7 @@
{ {
"presubmit": [ "presubmit": [
{ {
"name": "SystemUIComposeCoreTests", "name": "PlatformComposeCoreTests",
"options": [ "options": [
{ {
"exclude-annotation": "org.junit.Ignore" "exclude-annotation": "org.junit.Ignore"

View File

@@ -15,7 +15,7 @@
* *
*/ */
package com.android.systemui.compose package com.android.compose
import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.PaddingValues
@@ -27,10 +27,10 @@ import androidx.compose.material3.ButtonDefaults
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.android.systemui.compose.theme.LocalAndroidColorScheme import com.android.compose.theme.LocalAndroidColorScheme
@Composable @Composable
fun SysUiButton( fun PlatformButton(
onClick: () -> Unit, onClick: () -> Unit,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
enabled: Boolean = true, enabled: Boolean = true,
@@ -48,7 +48,7 @@ fun SysUiButton(
} }
@Composable @Composable
fun SysUiOutlinedButton( fun PlatformOutlinedButton(
onClick: () -> Unit, onClick: () -> Unit,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
enabled: Boolean = true, enabled: Boolean = true,
@@ -67,7 +67,7 @@ fun SysUiOutlinedButton(
} }
@Composable @Composable
fun SysUiTextButton( fun PlatformTextButton(
onClick: () -> Unit, onClick: () -> Unit,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
enabled: Boolean = true, enabled: Boolean = true,

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.compose package com.android.compose
import android.app.Activity import android.app.Activity
import android.content.Context import android.content.Context

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.compose.animation package com.android.compose.animation
import android.content.Context import android.content.Context
import android.view.View import android.view.View

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.compose.animation package com.android.compose.animation
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.compose.animation package com.android.compose.animation
import android.view.View import android.view.View
import androidx.savedstate.SavedStateRegistryOwner import androidx.savedstate.SavedStateRegistryOwner

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.compose.modifiers package com.android.compose.modifiers
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.DrawModifier import androidx.compose.ui.draw.DrawModifier

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.compose.modifiers package com.android.compose.modifiers
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.LayoutModifier import androidx.compose.ui.layout.LayoutModifier

View File

@@ -15,7 +15,7 @@
* *
*/ */
package com.android.systemui.compose.modifiers package com.android.compose.modifiers
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.IntrinsicMeasurable import androidx.compose.ui.layout.IntrinsicMeasurable

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.compose.layout.pager package com.android.compose.pager
import androidx.compose.animation.core.AnimationSpec import androidx.compose.animation.core.AnimationSpec
import androidx.compose.animation.core.DecayAnimationSpec import androidx.compose.animation.core.DecayAnimationSpec
@@ -40,7 +40,6 @@ import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.Velocity import androidx.compose.ui.unit.Velocity
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filter
/** Library-wide switch to turn on debug logging. */ /** Library-wide switch to turn on debug logging. */

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.compose.layout.pager package com.android.compose.pager
import androidx.annotation.FloatRange import androidx.annotation.FloatRange
import androidx.annotation.IntRange import androidx.annotation.IntRange

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.compose.layout.pager package com.android.compose.pager
import androidx.compose.animation.core.AnimationSpec import androidx.compose.animation.core.AnimationSpec
import androidx.compose.animation.core.AnimationState import androidx.compose.animation.core.AnimationState

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.compose.runtime package com.android.compose.runtime
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.InternalComposeApi import androidx.compose.runtime.InternalComposeApi

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.compose.theme package com.android.compose.theme
import android.annotation.ColorInt import android.annotation.ColorInt
import android.content.Context import android.content.Context
@@ -27,7 +27,7 @@ val LocalAndroidColorScheme =
staticCompositionLocalOf<AndroidColorScheme> { staticCompositionLocalOf<AndroidColorScheme> {
throw IllegalStateException( throw IllegalStateException(
"No AndroidColorScheme configured. Make sure to use LocalAndroidColorScheme in a " + "No AndroidColorScheme configured. Make sure to use LocalAndroidColorScheme in a " +
"Composable surrounded by a SystemUITheme {}." "Composable surrounded by a PlatformTheme {}."
) )
} }

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.compose.theme package com.android.compose.theme
import android.annotation.AttrRes import android.annotation.AttrRes
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.compose.theme package com.android.compose.theme
import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
@@ -24,15 +24,15 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import com.android.systemui.compose.theme.typography.TypeScaleTokens import com.android.compose.theme.typography.TypeScaleTokens
import com.android.systemui.compose.theme.typography.TypefaceNames import com.android.compose.theme.typography.TypefaceNames
import com.android.systemui.compose.theme.typography.TypefaceTokens import com.android.compose.theme.typography.TypefaceTokens
import com.android.systemui.compose.theme.typography.TypographyTokens import com.android.compose.theme.typography.TypographyTokens
import com.android.systemui.compose.theme.typography.systemUITypography import com.android.compose.theme.typography.platformTypography
/** The Material 3 theme that should wrap all SystemUI Composables. */ /** The Material 3 theme that should wrap all Platform Composables. */
@Composable @Composable
fun SystemUITheme( fun PlatformTheme(
isDarkTheme: Boolean = isSystemInDarkTheme(), isDarkTheme: Boolean = isSystemInDarkTheme(),
content: @Composable () -> Unit, content: @Composable () -> Unit,
) { ) {
@@ -49,7 +49,7 @@ fun SystemUITheme(
val typefaceNames = remember(context) { TypefaceNames.get(context) } val typefaceNames = remember(context) { TypefaceNames.get(context) }
val typography = val typography =
remember(typefaceNames) { remember(typefaceNames) {
systemUITypography(TypographyTokens(TypeScaleTokens(TypefaceTokens(typefaceNames)))) platformTypography(TypographyTokens(TypeScaleTokens(TypefaceTokens(typefaceNames))))
} }
MaterialTheme(colorScheme, typography = typography) { MaterialTheme(colorScheme, typography = typography) {

View File

@@ -14,18 +14,18 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.compose.theme.typography package com.android.compose.theme.typography
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Typography import androidx.compose.material3.Typography
/** /**
* The SystemUI typography. * The typography for Platform Compose code.
* *
* Do not use directly and call [MaterialTheme.typography] instead to access the different text * Do not use directly and call [MaterialTheme.typography] instead to access the different text
* styles. * styles.
*/ */
internal fun systemUITypography(typographyTokens: TypographyTokens): Typography { internal fun platformTypography(typographyTokens: TypographyTokens): Typography {
return Typography( return Typography(
displayLarge = typographyTokens.displayLarge, displayLarge = typographyTokens.displayLarge,
displayMedium = typographyTokens.displayMedium, displayMedium = typographyTokens.displayMedium,

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.compose.theme.typography package com.android.compose.theme.typography
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp

View File

@@ -16,7 +16,7 @@
@file:OptIn(ExperimentalTextApi::class) @file:OptIn(ExperimentalTextApi::class)
package com.android.systemui.compose.theme.typography package com.android.compose.theme.typography
import android.content.Context import android.content.Context
import androidx.compose.ui.text.ExperimentalTextApi import androidx.compose.ui.text.ExperimentalTextApi

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.compose.theme.typography package com.android.compose.theme.typography
import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.TextStyle

View File

@@ -23,7 +23,7 @@ package {
// TODO(b/230606318): Make those host tests instead of device tests. // TODO(b/230606318): Make those host tests instead of device tests.
android_test { android_test {
name: "SystemUIComposeCoreTests", name: "PlatformComposeCoreTests",
manifest: "AndroidManifest.xml", manifest: "AndroidManifest.xml",
test_suites: ["device-tests"], test_suites: ["device-tests"],
sdk_version: "current", sdk_version: "current",
@@ -34,7 +34,7 @@ android_test {
], ],
static_libs: [ static_libs: [
"SystemUIComposeCore", "PlatformComposeCore",
"androidx.test.runner", "androidx.test.runner",
"androidx.test.ext.junit", "androidx.test.ext.junit",

View File

@@ -15,14 +15,14 @@
--> -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.systemui.compose.core.tests" > package="com.android.compose.core.tests" >
<application> <application>
<uses-library android:name="android.test.runner" /> <uses-library android:name="android.test.runner" />
</application> </application>
<instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.systemui.compose.core.tests" android:targetPackage="com.android.compose.core.tests"
android:label="Tests for SystemUIComposeCore"/> android:label="Tests for PlatformComposeCore"/>
</manifest> </manifest>

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.systemui.compose.theme package com.android.compose.theme
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.ui.test.assertIsDisplayed import androidx.compose.ui.test.assertIsDisplayed
@@ -32,7 +32,7 @@ class SystemUIThemeTest {
@Test @Test
fun testThemeShowsContent() { fun testThemeShowsContent() {
composeRule.setContent { SystemUITheme { Text("foo") } } composeRule.setContent { PlatformTheme { Text("foo") } }
composeRule.onNodeWithText("foo").assertIsDisplayed() composeRule.onNodeWithText("foo").assertIsDisplayed()
} }
@@ -40,7 +40,7 @@ class SystemUIThemeTest {
@Test @Test
fun testAndroidColorsAreAvailableInsideTheme() { fun testAndroidColorsAreAvailableInsideTheme() {
composeRule.setContent { composeRule.setContent {
SystemUITheme { Text("foo", color = LocalAndroidColorScheme.current.colorAccent) } PlatformTheme { Text("foo", color = LocalAndroidColorScheme.current.colorAccent) }
} }
composeRule.onNodeWithText("foo").assertIsDisplayed() composeRule.onNodeWithText("foo").assertIsDisplayed()

View File

@@ -18,7 +18,7 @@ package com.android.systemui.compose
import androidx.activity.ComponentActivity import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import com.android.systemui.compose.theme.SystemUITheme import com.android.compose.theme.PlatformTheme
import com.android.systemui.people.ui.compose.PeopleScreen import com.android.systemui.people.ui.compose.PeopleScreen
import com.android.systemui.people.ui.viewmodel.PeopleViewModel import com.android.systemui.people.ui.viewmodel.PeopleViewModel
@@ -31,6 +31,6 @@ object ComposeFacade : BaseComposeFacade {
viewModel: PeopleViewModel, viewModel: PeopleViewModel,
onResult: (PeopleViewModel.Result) -> Unit, onResult: (PeopleViewModel.Result) -> Unit,
) { ) {
activity.setContent { SystemUITheme { PeopleScreen(viewModel, onResult) } } activity.setContent { PlatformTheme { PeopleScreen(viewModel, onResult) } }
} }
} }

View File

@@ -31,7 +31,7 @@ android_library {
static_libs: [ static_libs: [
"SystemUI-core", "SystemUI-core",
"SystemUIComposeCore", "PlatformComposeCore",
"androidx.compose.runtime_runtime", "androidx.compose.runtime_runtime",
"androidx.compose.material3_material3", "androidx.compose.material3_material3",

View File

@@ -49,8 +49,8 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.lifecycle.Lifecycle import androidx.lifecycle.Lifecycle
import androidx.lifecycle.repeatOnLifecycle import androidx.lifecycle.repeatOnLifecycle
import com.android.compose.theme.LocalAndroidColorScheme
import com.android.systemui.R import com.android.systemui.R
import com.android.systemui.compose.theme.LocalAndroidColorScheme
import com.android.systemui.people.ui.viewmodel.PeopleTileViewModel import com.android.systemui.people.ui.viewmodel.PeopleTileViewModel
import com.android.systemui.people.ui.viewmodel.PeopleViewModel import com.android.systemui.people.ui.viewmodel.PeopleViewModel

View File

@@ -41,8 +41,8 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.android.compose.theme.LocalAndroidColorScheme
import com.android.systemui.R import com.android.systemui.R
import com.android.systemui.compose.theme.LocalAndroidColorScheme
@Composable @Composable
internal fun PeopleScreenEmpty( internal fun PeopleScreenEmpty(

View File

@@ -65,14 +65,14 @@ import androidx.compose.ui.unit.sp
import androidx.lifecycle.Lifecycle import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.repeatOnLifecycle import androidx.lifecycle.repeatOnLifecycle
import com.android.compose.animation.Expandable
import com.android.compose.modifiers.background
import com.android.compose.theme.LocalAndroidColorScheme
import com.android.compose.theme.colorAttr
import com.android.systemui.R import com.android.systemui.R
import com.android.systemui.animation.Expandable import com.android.systemui.animation.Expandable
import com.android.systemui.common.shared.model.Icon import com.android.systemui.common.shared.model.Icon
import com.android.systemui.common.ui.compose.Icon import com.android.systemui.common.ui.compose.Icon
import com.android.systemui.compose.animation.Expandable
import com.android.systemui.compose.modifiers.background
import com.android.systemui.compose.theme.LocalAndroidColorScheme
import com.android.systemui.compose.theme.colorAttr
import com.android.systemui.qs.footer.ui.viewmodel.FooterActionsButtonViewModel import com.android.systemui.qs.footer.ui.viewmodel.FooterActionsButtonViewModel
import com.android.systemui.qs.footer.ui.viewmodel.FooterActionsForegroundServicesButtonViewModel import com.android.systemui.qs.footer.ui.viewmodel.FooterActionsForegroundServicesButtonViewModel
import com.android.systemui.qs.footer.ui.viewmodel.FooterActionsSecurityButtonViewModel import com.android.systemui.qs.footer.ui.viewmodel.FooterActionsSecurityButtonViewModel

View File

@@ -30,7 +30,7 @@ android_library {
], ],
static_libs: [ static_libs: [
"SystemUIComposeCore", "PlatformComposeCore",
"SystemUIScreenshotLib", "SystemUIScreenshotLib",
"androidx.compose.runtime_runtime", "androidx.compose.runtime_runtime",

View File

@@ -22,7 +22,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.ViewRootForTest import androidx.compose.ui.platform.ViewRootForTest
import androidx.compose.ui.test.junit4.createAndroidComposeRule import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.compose.ui.test.onRoot import androidx.compose.ui.test.onRoot
import com.android.systemui.compose.theme.SystemUITheme import com.android.compose.theme.PlatformTheme
import com.android.systemui.testing.screenshot.ScreenshotActivity import com.android.systemui.testing.screenshot.ScreenshotActivity
import com.android.systemui.testing.screenshot.SystemUIGoldenImagePathManager import com.android.systemui.testing.screenshot.SystemUIGoldenImagePathManager
import com.android.systemui.testing.screenshot.UnitTestBitmapMatcher import com.android.systemui.testing.screenshot.UnitTestBitmapMatcher
@@ -79,7 +79,7 @@ class ComposeScreenshotTestRule(
// Set the content using the AndroidComposeRule to make sure that the Activity is set up // Set the content using the AndroidComposeRule to make sure that the Activity is set up
// correctly. // correctly.
composeRule.setContent { composeRule.setContent {
SystemUITheme { PlatformTheme {
Surface( Surface(
color = MaterialTheme.colorScheme.background, color = MaterialTheme.colorScheme.background,
) { ) {