summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-05-17 08:36:43 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-05-17 08:36:43 +0000
commitfe64f2c3113cd0b3e0a93be104e7cebd2fc6ebc6 (patch)
treebfbdc0c1bab615858eaad4789715e5df00413136
parentc55ed4a30243ddaeed0966707e5bdf6e8e1451e5 (diff)
parent538c69661f30d126b6f95fe82713da429ac148b1 (diff)
downloadplatform_packages_apps_Car_LocalMediaPlayer-oreo-dr3-release.tar.gz
platform_packages_apps_Car_LocalMediaPlayer-oreo-dr3-release.tar.bz2
platform_packages_apps_Car_LocalMediaPlayer-oreo-dr3-release.zip
Change-Id: I3924b9f25d08c45d7211761b501db879a702b542
-rw-r--r--proto/proto.proto1
-rw-r--r--src/com/android/car/media/localmediaplayer/Player.java4
2 files changed, 4 insertions, 1 deletions
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 @@ message Playlist {
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 @@ public class Player extends MediaSession.Callback {
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 @@ public class Player extends MediaSession.Callback {
requestAudioFocus(() -> {
try {
- updatePlaybackStatePlaying();
playCurrentQueueIndex();
+ mMediaPlayer.seekTo(playlist.currentSongPosition);
+ updatePlaybackStatePlaying();
} catch (IOException e) {
Log.e(TAG, "Restored queue, but couldn't resume playback.");
}