Commit 86a95c2a by tonihei Committed by Rohit Singh

Correctly map deprecated methods in MediaController to replacement

This avoids throwing exceptions for correct (but deprecated) Player
method invocations.

PiperOrigin-RevId: 502341428
parent 3c476e2d
...@@ -479,7 +479,10 @@ public class MediaController implements Player { ...@@ -479,7 +479,10 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public void stop(boolean reset) { public void stop(boolean reset) {
throw new UnsupportedOperationException(); stop();
if (reset) {
clearMediaItems();
}
} }
/** /**
...@@ -1175,7 +1178,7 @@ public class MediaController implements Player { ...@@ -1175,7 +1178,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public boolean isCurrentWindowDynamic() { public boolean isCurrentWindowDynamic() {
throw new UnsupportedOperationException(); return isCurrentMediaItemDynamic();
} }
@Override @Override
...@@ -1192,7 +1195,7 @@ public class MediaController implements Player { ...@@ -1192,7 +1195,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public boolean isCurrentWindowLive() { public boolean isCurrentWindowLive() {
throw new UnsupportedOperationException(); return isCurrentMediaItemLive();
} }
@Override @Override
...@@ -1209,7 +1212,7 @@ public class MediaController implements Player { ...@@ -1209,7 +1212,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public boolean isCurrentWindowSeekable() { public boolean isCurrentWindowSeekable() {
throw new UnsupportedOperationException(); return isCurrentMediaItemSeekable();
} }
@Override @Override
...@@ -1261,7 +1264,7 @@ public class MediaController implements Player { ...@@ -1261,7 +1264,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public int getCurrentWindowIndex() { public int getCurrentWindowIndex() {
throw new UnsupportedOperationException(); return getCurrentMediaItemIndex();
} }
@Override @Override
...@@ -1277,7 +1280,7 @@ public class MediaController implements Player { ...@@ -1277,7 +1280,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public int getPreviousWindowIndex() { public int getPreviousWindowIndex() {
throw new UnsupportedOperationException(); return getPreviousMediaItemIndex();
} }
/** /**
...@@ -1300,7 +1303,7 @@ public class MediaController implements Player { ...@@ -1300,7 +1303,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public int getNextWindowIndex() { public int getNextWindowIndex() {
throw new UnsupportedOperationException(); return getNextMediaItemIndex();
} }
/** /**
...@@ -1323,7 +1326,7 @@ public class MediaController implements Player { ...@@ -1323,7 +1326,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public boolean hasPrevious() { public boolean hasPrevious() {
throw new UnsupportedOperationException(); return hasPreviousMediaItem();
} }
/** /**
...@@ -1333,7 +1336,7 @@ public class MediaController implements Player { ...@@ -1333,7 +1336,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public boolean hasNext() { public boolean hasNext() {
throw new UnsupportedOperationException(); return hasNextMediaItem();
} }
/** /**
...@@ -1343,7 +1346,7 @@ public class MediaController implements Player { ...@@ -1343,7 +1346,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public boolean hasPreviousWindow() { public boolean hasPreviousWindow() {
throw new UnsupportedOperationException(); return hasPreviousMediaItem();
} }
/** /**
...@@ -1353,7 +1356,7 @@ public class MediaController implements Player { ...@@ -1353,7 +1356,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public boolean hasNextWindow() { public boolean hasNextWindow() {
throw new UnsupportedOperationException(); return hasNextMediaItem();
} }
@Override @Override
...@@ -1375,7 +1378,7 @@ public class MediaController implements Player { ...@@ -1375,7 +1378,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public void previous() { public void previous() {
throw new UnsupportedOperationException(); seekToPreviousMediaItem();
} }
/** /**
...@@ -1385,7 +1388,7 @@ public class MediaController implements Player { ...@@ -1385,7 +1388,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public void next() { public void next() {
throw new UnsupportedOperationException(); seekToNextMediaItem();
} }
/** /**
...@@ -1395,7 +1398,7 @@ public class MediaController implements Player { ...@@ -1395,7 +1398,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public void seekToPreviousWindow() { public void seekToPreviousWindow() {
throw new UnsupportedOperationException(); seekToPreviousMediaItem();
} }
/** /**
...@@ -1421,7 +1424,7 @@ public class MediaController implements Player { ...@@ -1421,7 +1424,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public void seekToNextWindow() { public void seekToNextWindow() {
throw new UnsupportedOperationException(); seekToNextMediaItem();
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment