From 0c0e1bdc33423844b3d679c16073128286af60f4 Mon Sep 17 00:00:00 2001 From: Hyundo Moon Date: Thu, 10 Jan 2019 16:58:52 +0900 Subject: [PATCH] Change initial value of MediaSessionRecord.mDuration to -1 After the CL "a138573: AML: Remove unbundling MediaMetadata in MediaSessionRecord" is merged, MediaController.getPlaybackState() returned wrong position. Since the mDuration is initially set to non-negative value, getStateWithUpdatedPosition() limited the current position to the duration, which is wrong. As a result, the below androidx test failed in Q: - MediaSessionCompatCallbackTest.testGetPlaybackStateWithPositionUpdate This CL fixes the problem. Bug: 121447576 Test: Passed above test Change-Id: If87c844461a8204f3883cd3081f5c6f057ab36c6 --- .../core/java/com/android/server/media/MediaSessionRecord.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/media/MediaSessionRecord.java b/services/core/java/com/android/server/media/MediaSessionRecord.java index b70c64edc2cc4..8ecceb9664f59 100644 --- a/services/core/java/com/android/server/media/MediaSessionRecord.java +++ b/services/core/java/com/android/server/media/MediaSessionRecord.java @@ -116,7 +116,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient { private boolean mIsActive = false; private boolean mDestroyed = false; - private long mDuration; + private long mDuration = -1; private String mMetadataDescription; public MediaSessionRecord(int ownerPid, int ownerUid, int userId, String ownerPackageName,