release-request-3605d486-97ee-488a-9bef-b52de93b00b5-for-git_oc-dr1-release-4017239 snap-temp-L53000000064886993
Change-Id: I3924b9f25d08c45d7211761b501db879a702b542
diff --git a/proto/proto.proto b/proto/proto.proto
index aab14fd..979ee72 100644
--- a/proto/proto.proto
+++ b/proto/proto.proto
@@ -24,6 +24,7 @@
repeated Song songs = 1;
optional int64 current_queue_id = 2;
optional string name = 3;
+ optional int32 current_song_position = 4;
}
message Song {
diff --git a/src/com/android/car/media/localmediaplayer/Player.java b/src/com/android/car/media/localmediaplayer/Player.java
index 8a6aae9..7f1850f 100644
--- a/src/com/android/car/media/localmediaplayer/Player.java
+++ b/src/com/android/car/media/localmediaplayer/Player.java
@@ -213,6 +213,7 @@
idx++;
}
playlist.currentQueueId = mQueue.get(mCurrentQueueIdx).getQueueId();
+ playlist.currentSongPosition = mMediaPlayer.getCurrentPosition();
playlist.name = CURRENT_PLAYLIST_KEY;
// Go to Base64 to ensure that we can actually store the string in a sharedpref. This is
@@ -277,8 +278,9 @@
requestAudioFocus(() -> {
try {
- updatePlaybackStatePlaying();
playCurrentQueueIndex();
+ mMediaPlayer.seekTo(playlist.currentSongPosition);
+ updatePlaybackStatePlaying();
} catch (IOException e) {
Log.e(TAG, "Restored queue, but couldn't resume playback.");
}