From 8b9da561acfd07493aed5f45f04fdb31c83bbff3 Mon Sep 17 00:00:00 2001 From: Michael Mikhail Date: Mon, 21 Nov 2022 22:09:26 +0000 Subject: [PATCH] Modify tablet recommendation card dimensions adds overlays for the existing values in the sw720dp-land file. And makes sure that media players are getting recreated when configuration changed (orientation changes) Fixes: 233569483 Bug: 243972769 Test: manual - checked that albums sizes are matching the updated dimensions in figma specs. Change-Id: Iec2d15db285ee6ed184ececfddd7aa2661d889b2 Change-Id: Icda17079c972a90b63c2833170382bba844cd48a --- .../res/layout/media_smartspace_recommendations.xml | 2 +- packages/SystemUI/res/values-sw720dp-land/dimens.xml | 5 +++++ packages/SystemUI/res/values/dimens.xml | 1 + .../systemui/media/controls/ui/MediaCarouselController.kt | 8 +++++--- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/res/layout/media_smartspace_recommendations.xml b/packages/SystemUI/res/layout/media_smartspace_recommendations.xml index 79ba7ead1ec3e..aa655e6b35644 100644 --- a/packages/SystemUI/res/layout/media_smartspace_recommendations.xml +++ b/packages/SystemUI/res/layout/media_smartspace_recommendations.xml @@ -41,7 +41,7 @@ android:layout_width="@dimen/qs_media_app_icon_size" android:layout_height="@dimen/qs_media_app_icon_size" android:layout_marginStart="@dimen/qs_media_padding" - android:layout_marginTop="@dimen/qs_media_padding" + android:layout_marginTop="@dimen/qs_media_rec_icon_top_margin" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> diff --git a/packages/SystemUI/res/values-sw720dp-land/dimens.xml b/packages/SystemUI/res/values-sw720dp-land/dimens.xml index 868c003d99a5d..3fc59e38ec6c5 100644 --- a/packages/SystemUI/res/values-sw720dp-land/dimens.xml +++ b/packages/SystemUI/res/values-sw720dp-land/dimens.xml @@ -35,6 +35,11 @@ not appear immediately after user swipes to the side --> 20dp + + 27dp + 152dp + 16dp + 42dp + 16dp 88dp 16dp 8dp diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/ui/MediaCarouselController.kt b/packages/SystemUI/src/com/android/systemui/media/controls/ui/MediaCarouselController.kt index 8aaee81a57ddb..1fdbc99333cb0 100644 --- a/packages/SystemUI/src/com/android/systemui/media/controls/ui/MediaCarouselController.kt +++ b/packages/SystemUI/src/com/android/systemui/media/controls/ui/MediaCarouselController.kt @@ -184,6 +184,7 @@ constructor( private val configListener = object : ConfigurationController.ConfigurationListener { + override fun onDensityOrFontScaleChanged() { // System font changes should only happen when UMO is offscreen or a flicker may // occur @@ -199,6 +200,7 @@ constructor( override fun onConfigChanged(newConfig: Configuration?) { if (newConfig == null) return isRtl = newConfig.layoutDirection == View.LAYOUT_DIRECTION_RTL + updatePlayers(recreateMedia = true) } override fun onUiModeChanged() { @@ -635,7 +637,7 @@ constructor( val existingSmartspaceMediaKey = MediaPlayerData.smartspaceMediaKey() existingSmartspaceMediaKey?.let { val removedPlayer = - MediaPlayerData.removeMediaPlayer(existingSmartspaceMediaKey, true) + removePlayer(existingSmartspaceMediaKey, dismissMediaData = false) removedPlayer?.run { debugLogger.logPotentialMemoryLeak(existingSmartspaceMediaKey) } @@ -685,7 +687,7 @@ constructor( key: String, dismissMediaData: Boolean = true, dismissRecommendation: Boolean = true - ) { + ): MediaControlPanel? { if (key == MediaPlayerData.smartspaceMediaKey()) { MediaPlayerData.smartspaceMediaData?.let { logger.logRecommendationRemoved(it.packageName, it.instanceId) @@ -693,7 +695,7 @@ constructor( } val removed = MediaPlayerData.removeMediaPlayer(key, dismissMediaData || dismissRecommendation) - removed?.apply { + return removed?.apply { mediaCarouselScrollHandler.onPrePlayerRemoved(removed) mediaContent.removeView(removed.mediaViewHolder?.player) mediaContent.removeView(removed.recommendationViewHolder?.recommendations)