Commit 13dc59fc by tonihei Committed by christosts

Correctly map deprecated methods in MediaController to replacement

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

PiperOrigin-RevId: 502341428
(cherry picked from commit 86a95c2a)
parent a2aaad65
...@@ -478,7 +478,10 @@ public class MediaController implements Player { ...@@ -478,7 +478,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();
}
} }
/** /**
...@@ -1174,7 +1177,7 @@ public class MediaController implements Player { ...@@ -1174,7 +1177,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public boolean isCurrentWindowDynamic() { public boolean isCurrentWindowDynamic() {
throw new UnsupportedOperationException(); return isCurrentMediaItemDynamic();
} }
@Override @Override
...@@ -1191,7 +1194,7 @@ public class MediaController implements Player { ...@@ -1191,7 +1194,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public boolean isCurrentWindowLive() { public boolean isCurrentWindowLive() {
throw new UnsupportedOperationException(); return isCurrentMediaItemLive();
} }
@Override @Override
...@@ -1208,7 +1211,7 @@ public class MediaController implements Player { ...@@ -1208,7 +1211,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public boolean isCurrentWindowSeekable() { public boolean isCurrentWindowSeekable() {
throw new UnsupportedOperationException(); return isCurrentMediaItemSeekable();
} }
@Override @Override
...@@ -1260,7 +1263,7 @@ public class MediaController implements Player { ...@@ -1260,7 +1263,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public int getCurrentWindowIndex() { public int getCurrentWindowIndex() {
throw new UnsupportedOperationException(); return getCurrentMediaItemIndex();
} }
@Override @Override
...@@ -1276,7 +1279,7 @@ public class MediaController implements Player { ...@@ -1276,7 +1279,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public int getPreviousWindowIndex() { public int getPreviousWindowIndex() {
throw new UnsupportedOperationException(); return getPreviousMediaItemIndex();
} }
/** /**
...@@ -1299,7 +1302,7 @@ public class MediaController implements Player { ...@@ -1299,7 +1302,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public int getNextWindowIndex() { public int getNextWindowIndex() {
throw new UnsupportedOperationException(); return getNextMediaItemIndex();
} }
/** /**
...@@ -1322,7 +1325,7 @@ public class MediaController implements Player { ...@@ -1322,7 +1325,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public boolean hasPrevious() { public boolean hasPrevious() {
throw new UnsupportedOperationException(); return hasPreviousMediaItem();
} }
/** /**
...@@ -1332,7 +1335,7 @@ public class MediaController implements Player { ...@@ -1332,7 +1335,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public boolean hasNext() { public boolean hasNext() {
throw new UnsupportedOperationException(); return hasNextMediaItem();
} }
/** /**
...@@ -1342,7 +1345,7 @@ public class MediaController implements Player { ...@@ -1342,7 +1345,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public boolean hasPreviousWindow() { public boolean hasPreviousWindow() {
throw new UnsupportedOperationException(); return hasPreviousMediaItem();
} }
/** /**
...@@ -1352,7 +1355,7 @@ public class MediaController implements Player { ...@@ -1352,7 +1355,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public boolean hasNextWindow() { public boolean hasNextWindow() {
throw new UnsupportedOperationException(); return hasNextMediaItem();
} }
@Override @Override
...@@ -1374,7 +1377,7 @@ public class MediaController implements Player { ...@@ -1374,7 +1377,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public void previous() { public void previous() {
throw new UnsupportedOperationException(); seekToPreviousMediaItem();
} }
/** /**
...@@ -1384,7 +1387,7 @@ public class MediaController implements Player { ...@@ -1384,7 +1387,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public void next() { public void next() {
throw new UnsupportedOperationException(); seekToNextMediaItem();
} }
/** /**
...@@ -1394,7 +1397,7 @@ public class MediaController implements Player { ...@@ -1394,7 +1397,7 @@ public class MediaController implements Player {
@Deprecated @Deprecated
@Override @Override
public void seekToPreviousWindow() { public void seekToPreviousWindow() {
throw new UnsupportedOperationException(); seekToPreviousMediaItem();
} }
/** /**
...@@ -1420,7 +1423,7 @@ public class MediaController implements Player { ...@@ -1420,7 +1423,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