summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Dongwon Kang <dwkang@google.com> 2018-10-04 15:07:37 -0700
committer Dongwon Kang <dwkang@google.com> 2018-10-04 15:07:37 -0700
commit37c898b072b96ece8e70040ab8cb008b284fe71e (patch)
treee8b4142c283952db410f329d0e42662755053017
parentc7be180ec45e1d5fb2049c67325e1a7feb7f19f1 (diff)
MediaPlayer2: remove private API usage, Preconditions.checkArgument()
Test: build Bug: 112767549 Change-Id: I0ee4053d593aa75ef79f8c4cff19540312749461
-rw-r--r--media/java/android/media/MediaPlayer2Impl.java21
1 files changed, 13 insertions, 8 deletions
diff --git a/media/java/android/media/MediaPlayer2Impl.java b/media/java/android/media/MediaPlayer2Impl.java
index 53735e58a184..65db248283f5 100644
--- a/media/java/android/media/MediaPlayer2Impl.java
+++ b/media/java/android/media/MediaPlayer2Impl.java
@@ -53,7 +53,6 @@ import android.widget.VideoView;
import com.android.framework.protobuf.InvalidProtocolBufferException;
import com.android.internal.annotations.GuardedBy;
-import com.android.internal.util.Preconditions;
import libcore.io.IoBridge;
@@ -350,7 +349,7 @@ public final class MediaPlayer2Impl extends MediaPlayer2 {
addTask(new Task(CALL_COMPLETED_SET_DATA_SOURCE, false) {
@Override
void process() throws IOException {
- Preconditions.checkArgument(dsd != null, "the DataSourceDesc cannot be null");
+ checkArgument(dsd != null, "the DataSourceDesc cannot be null");
int state = getState();
if (state != PLAYER_STATE_ERROR && state != PLAYER_STATE_IDLE) {
throw new IllegalStateException("called in wrong state " + state);
@@ -376,7 +375,7 @@ public final class MediaPlayer2Impl extends MediaPlayer2 {
addTask(new Task(CALL_COMPLETED_SET_NEXT_DATA_SOURCE, false) {
@Override
void process() {
- Preconditions.checkArgument(dsd != null, "the DataSourceDesc cannot be null");
+ checkArgument(dsd != null, "the DataSourceDesc cannot be null");
synchronized (mSrcLock) {
mNextDSDs = new ArrayList<DataSourceDesc>(1);
mNextDSDs.add(dsd);
@@ -690,7 +689,7 @@ public final class MediaPlayer2Impl extends MediaPlayer2 {
private void handleDataSource(boolean isCurrent, @NonNull DataSourceDesc dsd, long srcId)
throws IOException {
- Preconditions.checkNotNull(dsd, "the DataSourceDesc cannot be null");
+ checkArgument(dsd != null, "the DataSourceDesc cannot be null");
switch (dsd.getType()) {
case DataSourceDesc.TYPE_CALLBACK:
@@ -1290,7 +1289,7 @@ public final class MediaPlayer2Impl extends MediaPlayer2 {
addTask(new Task(CALL_COMPLETED_SET_BUFFERING_PARAMS, false) {
@Override
void process() {
- Preconditions.checkArgument(params != null, "the BufferingParams cannot be null");
+ checkArgument(params != null, "the BufferingParams cannot be null");
_setBufferingParams(params);
}
});
@@ -1354,7 +1353,7 @@ public final class MediaPlayer2Impl extends MediaPlayer2 {
addTask(new Task(CALL_COMPLETED_SET_PLAYBACK_PARAMS, false) {
@Override
void process() {
- Preconditions.checkArgument(params != null, "the PlaybackParams cannot be null");
+ checkArgument(params != null, "the PlaybackParams cannot be null");
_setPlaybackParams(params);
}
});
@@ -1387,7 +1386,7 @@ public final class MediaPlayer2Impl extends MediaPlayer2 {
addTask(new Task(CALL_COMPLETED_SET_SYNC_PARAMS, false) {
@Override
void process() {
- Preconditions.checkArgument(params != null, "the SyncParams cannot be null");
+ checkArgument(params != null, "the SyncParams cannot be null");
_setSyncParams(params);
}
});
@@ -3027,6 +3026,12 @@ public final class MediaPlayer2Impl extends MediaPlayer2 {
}
}
+ public static void checkArgument(boolean expression, String errorMessage) {
+ if (!expression) {
+ throw new IllegalArgumentException(errorMessage);
+ }
+ }
+
private void sendEvent(final EventNotifier notifier) {
synchronized (mEventCbLock) {
try {
@@ -3803,7 +3808,7 @@ public final class MediaPlayer2Impl extends MediaPlayer2 {
private native void _prepareDrm(@NonNull byte[] uuid, @NonNull byte[] drmSessionId);
- // Modular DRM helpers
+ // Modular DRM helpers
private void prepareDrm_createDrmStep(@NonNull UUID uuid)
throws UnsupportedSchemeException {