mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Fix test-only visibility of MediaController#timeDiffMs
PiperOrigin-RevId: 407787258
This commit is contained in:
parent
aed08128c2
commit
05c7a30bd7
@ -15,6 +15,7 @@
|
||||
*/
|
||||
package androidx.media3.session;
|
||||
|
||||
import static androidx.annotation.VisibleForTesting.NONE;
|
||||
import static androidx.media3.common.util.Assertions.checkArgument;
|
||||
import static androidx.media3.common.util.Assertions.checkNotEmpty;
|
||||
import static androidx.media3.common.util.Assertions.checkNotNull;
|
||||
@ -343,7 +344,7 @@ public class MediaController implements Player {
|
||||
|
||||
/* package */ final Handler applicationHandler;
|
||||
|
||||
@VisibleForTesting long timeDiffMs;
|
||||
private long timeDiffMs;
|
||||
|
||||
private boolean connectionNotified;
|
||||
|
||||
@ -1722,10 +1723,19 @@ public class MediaController implements Player {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the time diff forcefully when calculating current position.
|
||||
*
|
||||
* @param timeDiffMs {@code C.TIME_UNSET} for reset.
|
||||
* Gets the optional time diff (in milliseconds) used for calculating the current position, or
|
||||
* {@link C#TIME_UNSET} if no diff should be applied.
|
||||
*/
|
||||
/* package */ long getTimeDiffMs() {
|
||||
return timeDiffMs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the time diff (in milliseconds) used when calculating the current position.
|
||||
*
|
||||
* @param timeDiffMs {@link C#TIME_UNSET} for reset.
|
||||
*/
|
||||
@VisibleForTesting(otherwise = NONE)
|
||||
/* package */ void setTimeDiffMs(long timeDiffMs) {
|
||||
verifyApplicationThread();
|
||||
this.timeDiffMs = timeDiffMs;
|
||||
|
@ -644,8 +644,8 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
return playerInfo.sessionPositionInfo.positionInfo.positionMs;
|
||||
}
|
||||
long elapsedTimeMs =
|
||||
(instance.timeDiffMs != C.TIME_UNSET)
|
||||
? instance.timeDiffMs
|
||||
(instance.getTimeDiffMs() != C.TIME_UNSET)
|
||||
? instance.getTimeDiffMs()
|
||||
: SystemClock.elapsedRealtime() - playerInfo.sessionPositionInfo.eventTimeMs;
|
||||
long estimatedPositionMs =
|
||||
playerInfo.sessionPositionInfo.positionInfo.positionMs
|
||||
@ -686,8 +686,8 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
return playerInfo.sessionPositionInfo.positionInfo.contentPositionMs;
|
||||
}
|
||||
long elapsedTimeMs =
|
||||
(instance.timeDiffMs != C.TIME_UNSET)
|
||||
? instance.timeDiffMs
|
||||
(instance.getTimeDiffMs() != C.TIME_UNSET)
|
||||
? instance.getTimeDiffMs()
|
||||
: SystemClock.elapsedRealtime() - playerInfo.sessionPositionInfo.eventTimeMs;
|
||||
long estimatedPositionMs =
|
||||
playerInfo.sessionPositionInfo.positionInfo.contentPositionMs
|
||||
|
@ -1305,14 +1305,14 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
||||
controllerCompat.getFlags(),
|
||||
controllerCompat.isSessionReady(),
|
||||
controllerCompat.getRatingType(),
|
||||
instance.timeDiffMs);
|
||||
instance.getTimeDiffMs());
|
||||
Pair<@NullableType Integer, @NullableType Integer> reasons =
|
||||
calculateDiscontinuityAndTransitionReason(
|
||||
legacyPlayerInfo,
|
||||
controllerInfo,
|
||||
newLegacyPlayerInfo,
|
||||
newControllerInfo,
|
||||
instance.timeDiffMs);
|
||||
instance.getTimeDiffMs());
|
||||
updateControllerInfo(
|
||||
notifyConnected,
|
||||
newLegacyPlayerInfo,
|
||||
|
Loading…
x
Reference in New Issue
Block a user