Snap for 4821244 from 9431f79119cc97ab0cac77d62faa2c9c57038b4e to pi-release
Change-Id: Ib32a9d4cec727f0ef988a4f67d7bd0f2634a338d
diff --git a/car-media-common/res/layout/car_playback_fragment.xml b/car-media-common/res/layout/car_playback_fragment.xml
index 4ca433f..15959f1 100644
--- a/car-media-common/res/layout/car_playback_fragment.xml
+++ b/car-media-common/res/layout/car_playback_fragment.xml
@@ -33,8 +33,8 @@
android:id="@+id/playback_scrim"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@color/car_dark_blue_grey_900"
- android:alpha="@dimen/playback_initial_scrim_alpha"/>
+ android:background="@color/album_art_scrim"
+ android:alpha="@dimen/album_art_scrim_alpha"/>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
diff --git a/car-media-common/res/values-night/dimens.xml b/car-media-common/res/values-night/dimens.xml
new file mode 100644
index 0000000..175b1d5
--- /dev/null
+++ b/car-media-common/res/values-night/dimens.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2018, The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <!-- Album art scrim -->
+ <item name="album_art_scrim_alpha" format="float" type="dimen">0.8</item>
+</resources>
diff --git a/car-media-common/res/values/colors.xml b/car-media-common/res/values/colors.xml
new file mode 100644
index 0000000..b04ffa8
--- /dev/null
+++ b/car-media-common/res/values/colors.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2018, The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <!-- Album art scrim -->
+ <color name="album_art_scrim">#000000</color>
+</resources>
diff --git a/car-media-common/res/values/dimens.xml b/car-media-common/res/values/dimens.xml
index db1f05a..8dba599 100644
--- a/car-media-common/res/values/dimens.xml
+++ b/car-media-common/res/values/dimens.xml
@@ -15,9 +15,8 @@
limitations under the License.
-->
<resources>
-
- <!-- Playback -->
- <item name="playback_initial_scrim_alpha" format="float" type="dimen">0.8</item>
+ <!-- Album art scrim -->
+ <item name="album_art_scrim_alpha" format="float" type="dimen">0.6</item>
<!-- Fab -->
<dimen name="car_fab_elevation">8dp</dimen>
diff --git a/car-media-common/src/com/android/car/media/common/PlaybackModel.java b/car-media-common/src/com/android/car/media/common/PlaybackModel.java
index 6206afe..bbddfee 100644
--- a/car-media-common/src/com/android/car/media/common/PlaybackModel.java
+++ b/car-media-common/src/com/android/car/media/common/PlaybackModel.java
@@ -382,7 +382,7 @@
/**
* @return the current playback progress, in milliseconds. This is a value between 0 and
- * {@link #getMaxProgress()}.
+ * {@link #getMaxProgress()} or PROGRESS_UNKNOWN of the current position is unknown.
*/
public long getProgress() {
if (mMediaController == null) {
@@ -392,6 +392,9 @@
if (state == null) {
return 0;
}
+ if (state.getPosition() == PlaybackState.PLAYBACK_POSITION_UNKNOWN) {
+ return PlaybackState.PLAYBACK_POSITION_UNKNOWN;
+ }
long timeDiff = SystemClock.elapsedRealtime() - state.getLastPositionUpdateTime();
float speed = state.getPlaybackSpeed();
if (state.getState() == PlaybackState.STATE_PAUSED