diff options
3 files changed, 6 insertions, 3 deletions
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/common/ui/compose/ContentDescription.kt b/packages/SystemUI/compose/features/src/com/android/systemui/common/ui/compose/ContentDescription.kt index 4a5ad6554dc6..b254963cc5e9 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/common/ui/compose/ContentDescription.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/common/ui/compose/ContentDescription.kt @@ -17,11 +17,13 @@ package com.android.systemui.common.ui.compose import androidx.compose.runtime.Composable +import androidx.compose.runtime.ReadOnlyComposable import androidx.compose.ui.res.stringResource import com.android.systemui.common.shared.model.ContentDescription /** Returns the loaded [String] or `null` if there isn't one. */ @Composable +@ReadOnlyComposable fun ContentDescription.load(): String? { return when (this) { is ContentDescription.Loaded -> description diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/common/ui/compose/Icon.kt b/packages/SystemUI/compose/features/src/com/android/systemui/common/ui/compose/Icon.kt index 82d14369f239..8b0c00535262 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/common/ui/compose/Icon.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/common/ui/compose/Icon.kt @@ -21,9 +21,8 @@ import androidx.compose.material3.LocalContentColor import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.asImageBitmap import androidx.compose.ui.res.painterResource -import androidx.core.graphics.drawable.toBitmap +import com.android.compose.ui.graphics.painter.rememberDrawablePainter import com.android.systemui.common.shared.model.Icon /** @@ -36,7 +35,7 @@ fun Icon(icon: Icon, modifier: Modifier = Modifier, tint: Color = LocalContentCo val contentDescription = icon.contentDescription?.load() when (icon) { is Icon.Loaded -> { - Icon(icon.drawable.toBitmap().asImageBitmap(), contentDescription, modifier, tint) + Icon(rememberDrawablePainter(icon.drawable), contentDescription, modifier, tint) } is Icon.Resource -> Icon(painterResource(icon.res), contentDescription, modifier, tint) } diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/common/ui/compose/TextExt.kt b/packages/SystemUI/compose/features/src/com/android/systemui/common/ui/compose/TextExt.kt index 4e8121f14e4b..19adba0f39de 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/common/ui/compose/TextExt.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/common/ui/compose/TextExt.kt @@ -19,6 +19,7 @@ package com.android.systemui.common.ui.compose import android.content.Context import androidx.compose.runtime.Composable +import androidx.compose.runtime.ReadOnlyComposable import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.AnnotatedString import com.android.systemui.common.shared.model.Text @@ -26,6 +27,7 @@ import com.android.systemui.common.shared.model.Text.Companion.loadText /** Returns the loaded [String] or `null` if there isn't one. */ @Composable +@ReadOnlyComposable fun Text.load(): String? { return when (this) { is Text.Loaded -> text |