Merge "[Media Rec] Update the background to be colorSurface." into tm-dev
diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaCarouselController.kt b/packages/SystemUI/src/com/android/systemui/media/MediaCarouselController.kt
index 49966a6..ca25a18 100644
--- a/packages/SystemUI/src/com/android/systemui/media/MediaCarouselController.kt
+++ b/packages/SystemUI/src/com/android/systemui/media/MediaCarouselController.kt
@@ -127,7 +127,6 @@
private val visualStabilityCallback: OnReorderingAllowedListener
private var needsReordering: Boolean = false
private var keysNeedRemoval = mutableSetOf<String>()
- private var bgColor = getBackgroundColor()
protected var shouldScrollToActivePlayer: Boolean = false
private var isRtl: Boolean = false
set(value) {
@@ -488,7 +487,7 @@
val lp = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT)
newRecs.recommendationViewHolder?.recommendations?.setLayoutParams(lp)
- newRecs.bindRecommendation(data.copy(backgroundColor = bgColor))
+ newRecs.bindRecommendation(data)
val curVisibleMediaKey = MediaPlayerData.playerKeys()
.elementAtOrNull(mediaCarouselScrollHandler.visibleMediaIndex)
MediaPlayerData.addMediaRecommendation(key, data, newRecs, shouldPrioritize, systemClock)
@@ -534,7 +533,6 @@
}
private fun recreatePlayers() {
- bgColor = getBackgroundColor()
pageIndicator.tintList = ColorStateList.valueOf(R.color.material_dynamic_neutral_variant80)
MediaPlayerData.mediaData().forEach { (key, data, isSsMediaRec) ->
@@ -554,10 +552,6 @@
}
}
- private fun getBackgroundColor(): Int {
- return context.getColor(R.color.material_dynamic_secondary95)
- }
-
private fun updatePageIndicator() {
val numPages = mediaContent.getChildCount()
pageIndicator.setNumPages(numPages)
diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java b/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java
index 766e7b0..915c3f2 100644
--- a/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java
@@ -60,6 +60,7 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.jank.InteractionJankMonitor;
import com.android.internal.logging.InstanceId;
+import com.android.settingslib.Utils;
import com.android.settingslib.widget.AdaptiveIcon;
import com.android.systemui.ActivityIntentHelper;
import com.android.systemui.R;
@@ -953,11 +954,11 @@
}
mSmartspaceId = SmallHash.hash(data.getTargetId());
- int backgroundColor = data.getBackgroundColor();
mPackageName = data.getPackageName();
mInstanceId = data.getInstanceId();
TransitionLayout recommendationCard = mRecommendationViewHolder.getRecommendations();
- recommendationCard.setBackgroundTintList(ColorStateList.valueOf(backgroundColor));
+ recommendationCard.setBackgroundTintList(
+ Utils.getColorAttr(mContext, com.android.internal.R.attr.colorSurface));
List<SmartspaceAction> mediaRecommendationList = data.getRecommendations();
if (mediaRecommendationList == null || mediaRecommendationList.isEmpty()) {
@@ -1057,6 +1058,8 @@
TextView titleView =
mRecommendationViewHolder.getMediaTitles().get(uiComponentIndex);
titleView.setText(title);
+ titleView.setTextColor(Utils.getColorAttrDefaultColor(
+ mContext, com.android.internal.R.attr.textColorPrimary));
// TODO(b/223603970): If none of them have titles, should we then hide the views?
// Set up subtitle
@@ -1067,6 +1070,8 @@
boolean shouldShowSubtitleText = !TextUtils.isEmpty(title);
CharSequence subtitleText = shouldShowSubtitleText ? subtitle : "";
subtitleView.setText(subtitleText);
+ subtitleView.setTextColor(Utils.getColorAttrDefaultColor(
+ mContext, com.android.internal.R.attr.textColorSecondary));
// TODO(b/223603970): If none of them have subtitles, should we then hide the views?
uiComponentIndex++;
diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt b/packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt
index fd44993..b2751ce 100644
--- a/packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt
+++ b/packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt
@@ -110,7 +110,6 @@
cardAction = null,
recommendations = emptyList(),
dismissIntent = null,
- backgroundColor = 0,
headphoneConnectionTimeMillis = 0,
instanceId = InstanceId.fakeInstanceId(-1))
@@ -1228,7 +1227,6 @@
cardAction = target.baseAction,
recommendations = target.iconGrid,
dismissIntent = dismissIntent,
- backgroundColor = 0,
headphoneConnectionTimeMillis = target.creationTimeMillis,
instanceId = logger.getNewInstanceId())
}
diff --git a/packages/SystemUI/src/com/android/systemui/media/SmartspaceMediaData.kt b/packages/SystemUI/src/com/android/systemui/media/SmartspaceMediaData.kt
index e161ea7..930c5a8 100644
--- a/packages/SystemUI/src/com/android/systemui/media/SmartspaceMediaData.kt
+++ b/packages/SystemUI/src/com/android/systemui/media/SmartspaceMediaData.kt
@@ -51,10 +51,6 @@
*/
val dismissIntent: Intent?,
/**
- * View's background color.
- */
- val backgroundColor: Int,
- /**
* The timestamp in milliseconds that headphone is connected.
*/
val headphoneConnectionTimeMillis: Long,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/MediaDataManagerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/media/MediaDataManagerTest.kt
index ca2fd6b..0cbceb6 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/media/MediaDataManagerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/media/MediaDataManagerTest.kt
@@ -510,7 +510,6 @@
cardAction = mediaSmartspaceBaseAction,
recommendations = listOf(mediaRecommendationItem),
dismissIntent = DISMISS_INTENT,
- backgroundColor = 0,
headphoneConnectionTimeMillis = 1234L,
instanceId = InstanceId.fakeInstanceId(instanceId))),
eq(false))