summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorLajos Molnar <lajos@google.com>2014-08-18 14:26:55 -0700
committerLajos Molnar <lajos@google.com>2014-08-19 11:08:08 -0700
commitd504ab14d264e340fac9422b84b5f3c677d87c5f (patch)
tree3776a3125ac272036320877530efe35336c26dbb /media
parenta66c40bf6e0fb79ead6d8a9fc29c5671fa7b1206 (diff)
downloadframeworks_base-d504ab14d264e340fac9422b84b5f3c677d87c5f.zip
frameworks_base-d504ab14d264e340fac9422b84b5f3c677d87c5f.tar.gz
frameworks_base-d504ab14d264e340fac9422b84b5f3c677d87c5f.tar.bz2
media.MediaPlayer: don't check file-existence for URI-s with scheme
setDataSource can be called with URI-s as well as with file paths. Check file-existence only for file:// URI-s as well as URI-s without scheme (which are assumed to be paths). Bug: 17109022 Change-Id: I70f16a4f614dcef0b47fa264cf708473036cef4e
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/MediaPlayer.java23
1 files changed, 11 insertions, 12 deletions
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index 2fa0c93..7c3b4fc 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -1049,8 +1049,17 @@ public class MediaPlayer implements SubtitleController.Listener
private void setDataSource(String path, String[] keys, String[] values)
throws IOException, IllegalArgumentException, SecurityException, IllegalStateException {
final Uri uri = Uri.parse(path);
- if ("file".equals(uri.getScheme())) {
+ final String scheme = uri.getScheme();
+ if ("file".equals(scheme)) {
path = uri.getPath();
+ } else if (scheme != null) {
+ // handle non-file sources
+ nativeSetDataSource(
+ MediaHTTPService.createHttpServiceBinderIfNecessary(path),
+ path,
+ keys,
+ values);
+ return;
}
final File file = new File(path);
@@ -1060,20 +1069,10 @@ public class MediaPlayer implements SubtitleController.Listener
setDataSource(fd);
is.close();
} else {
- _setDataSource(path, keys, values);
+ throw new IOException("setDataSource failed.");
}
}
- private void _setDataSource(
- String path, String[] keys, String[] values)
- throws IOException, IllegalArgumentException, SecurityException, IllegalStateException {
- nativeSetDataSource(
- MediaHTTPService.createHttpServiceBinderIfNecessary(path),
- path,
- keys,
- values);
- }
-
private native void nativeSetDataSource(
IBinder httpServiceBinder, String path, String[] keys, String[] values)
throws IOException, IllegalArgumentException, SecurityException, IllegalStateException;