Loading packages/SystemUI/src/com/android/systemui/media/remedia/domain/interactor/MediaInteractor.kt +51 −2 Original line number Original line Diff line number Diff line Loading @@ -16,13 +16,18 @@ package com.android.systemui.media.remedia.domain.interactor package com.android.systemui.media.remedia.domain.interactor import android.app.PendingIntent import android.content.Context import android.content.Context import android.content.Intent import android.content.Intent import android.provider.Settings import android.provider.Settings import android.util.Log import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.asImageBitmap import androidx.compose.ui.graphics.asImageBitmap import com.android.internal.jank.Cuj import com.android.internal.logging.InstanceId import com.android.internal.logging.InstanceId import com.android.settingslib.media.LocalMediaManager.MediaDeviceState import com.android.settingslib.media.LocalMediaManager.MediaDeviceState import com.android.systemui.ActivityIntentHelper import com.android.systemui.animation.Expandable import com.android.systemui.biometrics.Utils.toBitmap import com.android.systemui.biometrics.Utils.toBitmap import com.android.systemui.common.shared.model.ContentDescription import com.android.systemui.common.shared.model.ContentDescription import com.android.systemui.common.shared.model.Icon import com.android.systemui.common.shared.model.Icon Loading @@ -43,6 +48,8 @@ import com.android.systemui.media.remedia.shared.model.MediaColorScheme import com.android.systemui.media.remedia.shared.model.MediaSessionState import com.android.systemui.media.remedia.shared.model.MediaSessionState import com.android.systemui.plugins.ActivityStarter import com.android.systemui.plugins.ActivityStarter import com.android.systemui.res.R import com.android.systemui.res.R import com.android.systemui.statusbar.NotificationLockscreenUserManager import com.android.systemui.statusbar.policy.KeyguardStateController import javax.inject.Inject import javax.inject.Inject /** /** Loading Loading @@ -71,7 +78,10 @@ constructor( @Application val applicationContext: Context, @Application val applicationContext: Context, val repository: MediaRepository, val repository: MediaRepository, val mediaDataProcessor: MediaDataProcessor, val mediaDataProcessor: MediaDataProcessor, private val keyguardStateController: KeyguardStateController, private val activityStarter: ActivityStarter, private val activityStarter: ActivityStarter, private val activityIntentHelper: ActivityIntentHelper, private val lockscreenUserManager: NotificationLockscreenUserManager, ) : MediaInteractor { ) : MediaInteractor { override val sessions: List<MediaSessionModel> override val sessions: List<MediaSessionModel> Loading Loading @@ -115,8 +125,10 @@ constructor( override val subtitle: String override val subtitle: String get() = dataModel.subtitle get() = dataModel.subtitle override val onClick: () -> Unit override val onClick: (Expandable) -> Unit get() = TODO("Not yet implemented") get() = { expandable -> dataModel.clickIntent?.let { startClickIntent(expandable, it) } } override val isActive: Boolean override val isActive: Boolean get() = dataModel.isActive get() = dataModel.isActive Loading Loading @@ -228,7 +240,44 @@ constructor( ) ) } } fun startClickIntent(expandable: Expandable, clickIntent: PendingIntent) { if (!launchOverLockscreen(expandable, clickIntent)) { activityStarter.postStartActivityDismissingKeyguard( clickIntent, expandable.activityTransitionController(Cuj.CUJ_SHADE_APP_LAUNCH_FROM_MEDIA_PLAYER), ) } } private fun launchOverLockscreen( expandable: Expandable, pendingIntent: PendingIntent, ): Boolean { val showOverLockscreen = keyguardStateController.isShowing && activityIntentHelper.wouldPendingShowOverLockscreen( pendingIntent, lockscreenUserManager.currentUserId, ) if (showOverLockscreen) { try { activityStarter.startPendingIntentMaybeDismissingKeyguard( pendingIntent, /* intentSentUiThreadCallback = */ null, expandable.activityTransitionController( Cuj.CUJ_SHADE_APP_LAUNCH_FROM_MEDIA_PLAYER ), ) } catch (e: PendingIntent.CanceledException) { Log.e(TAG, "pending intent was canceled") } return true } return false } companion object { companion object { private const val TAG = "MediaInteractor" private val settingsIntent: Intent = Intent(Settings.ACTION_MEDIA_CONTROLS_SETTINGS) private val settingsIntent: Intent = Intent(Settings.ACTION_MEDIA_CONTROLS_SETTINGS) } } } } packages/SystemUI/src/com/android/systemui/media/remedia/domain/model/MediaSessionModel.kt +2 −1 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.media.remedia.domain.model import androidx.compose.runtime.Stable import androidx.compose.runtime.Stable import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.ImageBitmap 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.media.remedia.shared.model.MediaCardActionButtonLayout import com.android.systemui.media.remedia.shared.model.MediaCardActionButtonLayout import com.android.systemui.media.remedia.shared.model.MediaColorScheme import com.android.systemui.media.remedia.shared.model.MediaColorScheme Loading @@ -41,7 +42,7 @@ interface MediaSessionModel { val subtitle: String val subtitle: String val onClick: () -> Unit val onClick: (Expandable) -> Unit /** /** * Whether the session is currently active. Under some UIs, only currently active session should * Whether the session is currently active. Under some UIs, only currently active session should Loading packages/SystemUI/src/com/android/systemui/media/remedia/ui/compose/Media.kt +45 −13 Original line number Original line Diff line number Diff line Loading @@ -96,6 +96,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.CompositingStrategy import androidx.compose.ui.graphics.CompositingStrategy import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.Path import androidx.compose.ui.graphics.Path import androidx.compose.ui.graphics.RectangleShape import androidx.compose.ui.graphics.StrokeCap import androidx.compose.ui.graphics.StrokeCap import androidx.compose.ui.graphics.drawscope.Stroke import androidx.compose.ui.graphics.drawscope.Stroke import androidx.compose.ui.graphics.drawscope.clipRect import androidx.compose.ui.graphics.drawscope.clipRect Loading Loading @@ -123,6 +124,8 @@ import androidx.compose.ui.util.fastRoundToInt import com.android.compose.PlatformButton import com.android.compose.PlatformButton import com.android.compose.PlatformIconButton import com.android.compose.PlatformIconButton import com.android.compose.PlatformOutlinedButton import com.android.compose.PlatformOutlinedButton import com.android.compose.animation.Expandable import com.android.compose.animation.rememberExpandableController import com.android.compose.animation.scene.ContentScope import com.android.compose.animation.scene.ContentScope import com.android.compose.animation.scene.ElementKey import com.android.compose.animation.scene.ElementKey import com.android.compose.animation.scene.SceneKey import com.android.compose.animation.scene.SceneKey Loading @@ -135,6 +138,7 @@ import com.android.compose.modifiers.thenIf import com.android.compose.theme.LocalAndroidColorScheme import com.android.compose.theme.LocalAndroidColorScheme import com.android.compose.ui.graphics.painter.rememberDrawablePainter import com.android.compose.ui.graphics.painter.rememberDrawablePainter import com.android.mechanics.spec.builder.rememberMotionBuilderContext import com.android.mechanics.spec.builder.rememberMotionBuilderContext 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.common.ui.compose.PagerDots import com.android.systemui.common.ui.compose.PagerDots Loading Loading @@ -327,17 +331,35 @@ private fun Card( CardBackground(image = viewModel.background, modifier = Modifier.matchParentSize()) CardBackground(image = viewModel.background, modifier = Modifier.matchParentSize()) } } Expandable( controller = rememberExpandableController(color = Color.Transparent, shape = RectangleShape), useModifierBasedImplementation = true, ) { key(stlState) { key(stlState) { SceneTransitionLayout(state = stlState) { SceneTransitionLayout(state = stlState) { scene(Media.Scenes.Default) { scene(Media.Scenes.Default) { CardForeground(viewModel = viewModel, threeRows = true, fillHeight = false) CardForeground( expandable = it, viewModel = viewModel, threeRows = true, fillHeight = false, ) } } scene(Media.Scenes.Compressed) { scene(Media.Scenes.Compressed) { CardForeground(viewModel = viewModel, threeRows = false, fillHeight = false) CardForeground( expandable = it, viewModel = viewModel, threeRows = false, fillHeight = false, ) } } scene(Media.Scenes.Compact) { CompactCardForeground(viewModel = viewModel) } scene(Media.Scenes.Compact) { CompactCardForeground(expandable = it, viewModel = viewModel) } } } } } } } } Loading Loading @@ -372,6 +394,7 @@ private fun rememberAnimatedColorScheme(colorScheme: MediaColorScheme?): Animate */ */ @Composable @Composable private fun ContentScope.CardForeground( private fun ContentScope.CardForeground( expandable: Expandable, viewModel: MediaCardViewModel, viewModel: MediaCardViewModel, threeRows: Boolean, threeRows: Boolean, fillHeight: Boolean, fillHeight: Boolean, Loading @@ -391,6 +414,7 @@ private fun ContentScope.CardForeground( Layout( Layout( content = { content = { CardForegroundContent( CardForegroundContent( expandable = expandable, viewModel = viewModel, viewModel = viewModel, threeRows = threeRows, threeRows = threeRows, fillHeight = fillHeight, fillHeight = fillHeight, Loading Loading @@ -436,16 +460,18 @@ private fun ContentScope.CardForeground( @Composable @Composable private fun ContentScope.CardForegroundContent( private fun ContentScope.CardForegroundContent( expandable: Expandable, viewModel: MediaCardViewModel, viewModel: MediaCardViewModel, threeRows: Boolean, threeRows: Boolean, fillHeight: Boolean, fillHeight: Boolean, colorScheme: AnimatedColorScheme, colorScheme: AnimatedColorScheme, modifier: Modifier = Modifier, modifier: Modifier = Modifier, ) { ) { Column( Column( modifier = modifier = modifier.combinedClickable( modifier.combinedClickable( onClick = viewModel.onClick, onClick = { viewModel.onClick(expandable) }, onLongClick = viewModel.onLongClick, onLongClick = viewModel.onLongClick, onClickLabel = viewModel.onClickLabel, onClickLabel = viewModel.onClickLabel, ) ) Loading @@ -468,10 +494,12 @@ private fun ContentScope.CardForegroundContent( horizontalArrangement = Arrangement.spacedBy(8.dp), horizontalArrangement = Arrangement.spacedBy(8.dp), modifier = modifier = Modifier.align(Alignment.TopEnd) Modifier.align(Alignment.TopEnd) // Output switcher chip must be limited to at most 40% of the maximum width // Output switcher chip must be limited to at most 40% of the maximum // width // of the card. // of the card. // // // This saves the maximum possible width of the card so it can be referred // This saves the maximum possible width of the card so it can be // referred // to by child custom layout code below. // to by child custom layout code below. // // // The assumption is that the row can be as wide as the entire card. // The assumption is that the row can be as wide as the entire card. Loading Loading @@ -646,6 +674,7 @@ private fun ContentScope.CardForegroundContent( */ */ @Composable @Composable private fun ContentScope.CompactCardForeground( private fun ContentScope.CompactCardForeground( expandable: Expandable, viewModel: MediaCardViewModel, viewModel: MediaCardViewModel, modifier: Modifier = Modifier, modifier: Modifier = Modifier, ) { ) { Loading @@ -654,7 +683,10 @@ private fun ContentScope.CompactCardForeground( verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically, modifier = modifier = modifier modifier .clickable(onClick = viewModel.onClick, onClickLabel = viewModel.onClickLabel) .clickable( onClick = { viewModel.onClick(expandable) }, onClickLabel = viewModel.onClickLabel, ) .background(MaterialTheme.colorScheme.surfaceContainer) .background(MaterialTheme.colorScheme.surfaceContainer) .padding(16.dp), .padding(16.dp), ) { ) { Loading packages/SystemUI/src/com/android/systemui/media/remedia/ui/viewmodel/MediaCardViewModel.kt +2 −1 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.media.remedia.ui.viewmodel import androidx.compose.runtime.Stable import androidx.compose.runtime.Stable import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.ImageBitmap 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.media.remedia.shared.model.MediaCardActionButtonLayout import com.android.systemui.media.remedia.shared.model.MediaCardActionButtonLayout import com.android.systemui.media.remedia.shared.model.MediaColorScheme import com.android.systemui.media.remedia.shared.model.MediaColorScheme Loading Loading @@ -58,7 +59,7 @@ interface MediaCardViewModel { /** Simple icon-only version of the output switcher for use in compact UIs. */ /** Simple icon-only version of the output switcher for use in compact UIs. */ val outputSwitcherChipButton: MediaSecondaryActionViewModel.Action val outputSwitcherChipButton: MediaSecondaryActionViewModel.Action val onClick: () -> Unit val onClick: (Expandable) -> Unit /** Accessibility string for the click action of the card. */ /** Accessibility string for the click action of the card. */ val onClickLabel: String? val onClickLabel: String? Loading packages/SystemUI/src/com/android/systemui/media/remedia/ui/viewmodel/MediaViewModel.kt +5 −2 Original line number Original line Diff line number Diff line Loading @@ -28,6 +28,7 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue import androidx.compose.ui.geometry.Offset import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.ImageBitmap import com.android.systemui.animation.Expandable import com.android.systemui.classifier.Classifier import com.android.systemui.classifier.Classifier import com.android.systemui.common.shared.model.ContentDescription import com.android.systemui.common.shared.model.ContentDescription import com.android.systemui.common.shared.model.Icon import com.android.systemui.common.shared.model.Icon Loading Loading @@ -266,8 +267,10 @@ constructor( ) ) } } override val onClick = { override val onClick = { expandable: Expandable -> falsingSystem.runIfNotFalseTap(FalsingManager.LOW_PENALTY) { session.onClick() } falsingSystem.runIfNotFalseTap(FalsingManager.LOW_PENALTY) { session.onClick(expandable) } } } override val onClickLabel = override val onClickLabel = context.getString(R.string.controls_media_playing_item_description) context.getString(R.string.controls_media_playing_item_description) Loading Loading
packages/SystemUI/src/com/android/systemui/media/remedia/domain/interactor/MediaInteractor.kt +51 −2 Original line number Original line Diff line number Diff line Loading @@ -16,13 +16,18 @@ package com.android.systemui.media.remedia.domain.interactor package com.android.systemui.media.remedia.domain.interactor import android.app.PendingIntent import android.content.Context import android.content.Context import android.content.Intent import android.content.Intent import android.provider.Settings import android.provider.Settings import android.util.Log import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.asImageBitmap import androidx.compose.ui.graphics.asImageBitmap import com.android.internal.jank.Cuj import com.android.internal.logging.InstanceId import com.android.internal.logging.InstanceId import com.android.settingslib.media.LocalMediaManager.MediaDeviceState import com.android.settingslib.media.LocalMediaManager.MediaDeviceState import com.android.systemui.ActivityIntentHelper import com.android.systemui.animation.Expandable import com.android.systemui.biometrics.Utils.toBitmap import com.android.systemui.biometrics.Utils.toBitmap import com.android.systemui.common.shared.model.ContentDescription import com.android.systemui.common.shared.model.ContentDescription import com.android.systemui.common.shared.model.Icon import com.android.systemui.common.shared.model.Icon Loading @@ -43,6 +48,8 @@ import com.android.systemui.media.remedia.shared.model.MediaColorScheme import com.android.systemui.media.remedia.shared.model.MediaSessionState import com.android.systemui.media.remedia.shared.model.MediaSessionState import com.android.systemui.plugins.ActivityStarter import com.android.systemui.plugins.ActivityStarter import com.android.systemui.res.R import com.android.systemui.res.R import com.android.systemui.statusbar.NotificationLockscreenUserManager import com.android.systemui.statusbar.policy.KeyguardStateController import javax.inject.Inject import javax.inject.Inject /** /** Loading Loading @@ -71,7 +78,10 @@ constructor( @Application val applicationContext: Context, @Application val applicationContext: Context, val repository: MediaRepository, val repository: MediaRepository, val mediaDataProcessor: MediaDataProcessor, val mediaDataProcessor: MediaDataProcessor, private val keyguardStateController: KeyguardStateController, private val activityStarter: ActivityStarter, private val activityStarter: ActivityStarter, private val activityIntentHelper: ActivityIntentHelper, private val lockscreenUserManager: NotificationLockscreenUserManager, ) : MediaInteractor { ) : MediaInteractor { override val sessions: List<MediaSessionModel> override val sessions: List<MediaSessionModel> Loading Loading @@ -115,8 +125,10 @@ constructor( override val subtitle: String override val subtitle: String get() = dataModel.subtitle get() = dataModel.subtitle override val onClick: () -> Unit override val onClick: (Expandable) -> Unit get() = TODO("Not yet implemented") get() = { expandable -> dataModel.clickIntent?.let { startClickIntent(expandable, it) } } override val isActive: Boolean override val isActive: Boolean get() = dataModel.isActive get() = dataModel.isActive Loading Loading @@ -228,7 +240,44 @@ constructor( ) ) } } fun startClickIntent(expandable: Expandable, clickIntent: PendingIntent) { if (!launchOverLockscreen(expandable, clickIntent)) { activityStarter.postStartActivityDismissingKeyguard( clickIntent, expandable.activityTransitionController(Cuj.CUJ_SHADE_APP_LAUNCH_FROM_MEDIA_PLAYER), ) } } private fun launchOverLockscreen( expandable: Expandable, pendingIntent: PendingIntent, ): Boolean { val showOverLockscreen = keyguardStateController.isShowing && activityIntentHelper.wouldPendingShowOverLockscreen( pendingIntent, lockscreenUserManager.currentUserId, ) if (showOverLockscreen) { try { activityStarter.startPendingIntentMaybeDismissingKeyguard( pendingIntent, /* intentSentUiThreadCallback = */ null, expandable.activityTransitionController( Cuj.CUJ_SHADE_APP_LAUNCH_FROM_MEDIA_PLAYER ), ) } catch (e: PendingIntent.CanceledException) { Log.e(TAG, "pending intent was canceled") } return true } return false } companion object { companion object { private const val TAG = "MediaInteractor" private val settingsIntent: Intent = Intent(Settings.ACTION_MEDIA_CONTROLS_SETTINGS) private val settingsIntent: Intent = Intent(Settings.ACTION_MEDIA_CONTROLS_SETTINGS) } } } }
packages/SystemUI/src/com/android/systemui/media/remedia/domain/model/MediaSessionModel.kt +2 −1 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.media.remedia.domain.model import androidx.compose.runtime.Stable import androidx.compose.runtime.Stable import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.ImageBitmap 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.media.remedia.shared.model.MediaCardActionButtonLayout import com.android.systemui.media.remedia.shared.model.MediaCardActionButtonLayout import com.android.systemui.media.remedia.shared.model.MediaColorScheme import com.android.systemui.media.remedia.shared.model.MediaColorScheme Loading @@ -41,7 +42,7 @@ interface MediaSessionModel { val subtitle: String val subtitle: String val onClick: () -> Unit val onClick: (Expandable) -> Unit /** /** * Whether the session is currently active. Under some UIs, only currently active session should * Whether the session is currently active. Under some UIs, only currently active session should Loading
packages/SystemUI/src/com/android/systemui/media/remedia/ui/compose/Media.kt +45 −13 Original line number Original line Diff line number Diff line Loading @@ -96,6 +96,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.CompositingStrategy import androidx.compose.ui.graphics.CompositingStrategy import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.Path import androidx.compose.ui.graphics.Path import androidx.compose.ui.graphics.RectangleShape import androidx.compose.ui.graphics.StrokeCap import androidx.compose.ui.graphics.StrokeCap import androidx.compose.ui.graphics.drawscope.Stroke import androidx.compose.ui.graphics.drawscope.Stroke import androidx.compose.ui.graphics.drawscope.clipRect import androidx.compose.ui.graphics.drawscope.clipRect Loading Loading @@ -123,6 +124,8 @@ import androidx.compose.ui.util.fastRoundToInt import com.android.compose.PlatformButton import com.android.compose.PlatformButton import com.android.compose.PlatformIconButton import com.android.compose.PlatformIconButton import com.android.compose.PlatformOutlinedButton import com.android.compose.PlatformOutlinedButton import com.android.compose.animation.Expandable import com.android.compose.animation.rememberExpandableController import com.android.compose.animation.scene.ContentScope import com.android.compose.animation.scene.ContentScope import com.android.compose.animation.scene.ElementKey import com.android.compose.animation.scene.ElementKey import com.android.compose.animation.scene.SceneKey import com.android.compose.animation.scene.SceneKey Loading @@ -135,6 +138,7 @@ import com.android.compose.modifiers.thenIf import com.android.compose.theme.LocalAndroidColorScheme import com.android.compose.theme.LocalAndroidColorScheme import com.android.compose.ui.graphics.painter.rememberDrawablePainter import com.android.compose.ui.graphics.painter.rememberDrawablePainter import com.android.mechanics.spec.builder.rememberMotionBuilderContext import com.android.mechanics.spec.builder.rememberMotionBuilderContext 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.common.ui.compose.PagerDots import com.android.systemui.common.ui.compose.PagerDots Loading Loading @@ -327,17 +331,35 @@ private fun Card( CardBackground(image = viewModel.background, modifier = Modifier.matchParentSize()) CardBackground(image = viewModel.background, modifier = Modifier.matchParentSize()) } } Expandable( controller = rememberExpandableController(color = Color.Transparent, shape = RectangleShape), useModifierBasedImplementation = true, ) { key(stlState) { key(stlState) { SceneTransitionLayout(state = stlState) { SceneTransitionLayout(state = stlState) { scene(Media.Scenes.Default) { scene(Media.Scenes.Default) { CardForeground(viewModel = viewModel, threeRows = true, fillHeight = false) CardForeground( expandable = it, viewModel = viewModel, threeRows = true, fillHeight = false, ) } } scene(Media.Scenes.Compressed) { scene(Media.Scenes.Compressed) { CardForeground(viewModel = viewModel, threeRows = false, fillHeight = false) CardForeground( expandable = it, viewModel = viewModel, threeRows = false, fillHeight = false, ) } } scene(Media.Scenes.Compact) { CompactCardForeground(viewModel = viewModel) } scene(Media.Scenes.Compact) { CompactCardForeground(expandable = it, viewModel = viewModel) } } } } } } } } Loading Loading @@ -372,6 +394,7 @@ private fun rememberAnimatedColorScheme(colorScheme: MediaColorScheme?): Animate */ */ @Composable @Composable private fun ContentScope.CardForeground( private fun ContentScope.CardForeground( expandable: Expandable, viewModel: MediaCardViewModel, viewModel: MediaCardViewModel, threeRows: Boolean, threeRows: Boolean, fillHeight: Boolean, fillHeight: Boolean, Loading @@ -391,6 +414,7 @@ private fun ContentScope.CardForeground( Layout( Layout( content = { content = { CardForegroundContent( CardForegroundContent( expandable = expandable, viewModel = viewModel, viewModel = viewModel, threeRows = threeRows, threeRows = threeRows, fillHeight = fillHeight, fillHeight = fillHeight, Loading Loading @@ -436,16 +460,18 @@ private fun ContentScope.CardForeground( @Composable @Composable private fun ContentScope.CardForegroundContent( private fun ContentScope.CardForegroundContent( expandable: Expandable, viewModel: MediaCardViewModel, viewModel: MediaCardViewModel, threeRows: Boolean, threeRows: Boolean, fillHeight: Boolean, fillHeight: Boolean, colorScheme: AnimatedColorScheme, colorScheme: AnimatedColorScheme, modifier: Modifier = Modifier, modifier: Modifier = Modifier, ) { ) { Column( Column( modifier = modifier = modifier.combinedClickable( modifier.combinedClickable( onClick = viewModel.onClick, onClick = { viewModel.onClick(expandable) }, onLongClick = viewModel.onLongClick, onLongClick = viewModel.onLongClick, onClickLabel = viewModel.onClickLabel, onClickLabel = viewModel.onClickLabel, ) ) Loading @@ -468,10 +494,12 @@ private fun ContentScope.CardForegroundContent( horizontalArrangement = Arrangement.spacedBy(8.dp), horizontalArrangement = Arrangement.spacedBy(8.dp), modifier = modifier = Modifier.align(Alignment.TopEnd) Modifier.align(Alignment.TopEnd) // Output switcher chip must be limited to at most 40% of the maximum width // Output switcher chip must be limited to at most 40% of the maximum // width // of the card. // of the card. // // // This saves the maximum possible width of the card so it can be referred // This saves the maximum possible width of the card so it can be // referred // to by child custom layout code below. // to by child custom layout code below. // // // The assumption is that the row can be as wide as the entire card. // The assumption is that the row can be as wide as the entire card. Loading Loading @@ -646,6 +674,7 @@ private fun ContentScope.CardForegroundContent( */ */ @Composable @Composable private fun ContentScope.CompactCardForeground( private fun ContentScope.CompactCardForeground( expandable: Expandable, viewModel: MediaCardViewModel, viewModel: MediaCardViewModel, modifier: Modifier = Modifier, modifier: Modifier = Modifier, ) { ) { Loading @@ -654,7 +683,10 @@ private fun ContentScope.CompactCardForeground( verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically, modifier = modifier = modifier modifier .clickable(onClick = viewModel.onClick, onClickLabel = viewModel.onClickLabel) .clickable( onClick = { viewModel.onClick(expandable) }, onClickLabel = viewModel.onClickLabel, ) .background(MaterialTheme.colorScheme.surfaceContainer) .background(MaterialTheme.colorScheme.surfaceContainer) .padding(16.dp), .padding(16.dp), ) { ) { Loading
packages/SystemUI/src/com/android/systemui/media/remedia/ui/viewmodel/MediaCardViewModel.kt +2 −1 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.media.remedia.ui.viewmodel import androidx.compose.runtime.Stable import androidx.compose.runtime.Stable import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.ImageBitmap 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.media.remedia.shared.model.MediaCardActionButtonLayout import com.android.systemui.media.remedia.shared.model.MediaCardActionButtonLayout import com.android.systemui.media.remedia.shared.model.MediaColorScheme import com.android.systemui.media.remedia.shared.model.MediaColorScheme Loading Loading @@ -58,7 +59,7 @@ interface MediaCardViewModel { /** Simple icon-only version of the output switcher for use in compact UIs. */ /** Simple icon-only version of the output switcher for use in compact UIs. */ val outputSwitcherChipButton: MediaSecondaryActionViewModel.Action val outputSwitcherChipButton: MediaSecondaryActionViewModel.Action val onClick: () -> Unit val onClick: (Expandable) -> Unit /** Accessibility string for the click action of the card. */ /** Accessibility string for the click action of the card. */ val onClickLabel: String? val onClickLabel: String? Loading
packages/SystemUI/src/com/android/systemui/media/remedia/ui/viewmodel/MediaViewModel.kt +5 −2 Original line number Original line Diff line number Diff line Loading @@ -28,6 +28,7 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue import androidx.compose.ui.geometry.Offset import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.ImageBitmap import com.android.systemui.animation.Expandable import com.android.systemui.classifier.Classifier import com.android.systemui.classifier.Classifier import com.android.systemui.common.shared.model.ContentDescription import com.android.systemui.common.shared.model.ContentDescription import com.android.systemui.common.shared.model.Icon import com.android.systemui.common.shared.model.Icon Loading Loading @@ -266,8 +267,10 @@ constructor( ) ) } } override val onClick = { override val onClick = { expandable: Expandable -> falsingSystem.runIfNotFalseTap(FalsingManager.LOW_PENALTY) { session.onClick() } falsingSystem.runIfNotFalseTap(FalsingManager.LOW_PENALTY) { session.onClick(expandable) } } } override val onClickLabel = override val onClickLabel = context.getString(R.string.controls_media_playing_item_description) context.getString(R.string.controls_media_playing_item_description) Loading