summaryrefslogtreecommitdiffstats
path: root/media/java
diff options
context:
space:
mode:
authorAlex Klyubin <klyubin@google.com>2015-04-20 10:11:57 -0700
committerAlex Klyubin <klyubin@google.com>2015-04-20 10:11:57 -0700
commit6db04b369ec4a4d59315ba0207ecc53d8e8852cc (patch)
tree818323821f1d78fd7215b41b188ba95818012664 /media/java
parentb0557acebc7a47f6d8a3653c376165160fc68105 (diff)
downloadframeworks_base-6db04b369ec4a4d59315ba0207ecc53d8e8852cc.zip
frameworks_base-6db04b369ec4a4d59315ba0207ecc53d8e8852cc.tar.gz
frameworks_base-6db04b369ec4a4d59315ba0207ecc53d8e8852cc.tar.bz2
Make MediaPlayer fail fast on UnknownServiceException.
This makes MediaPlayer's network streaming code fail fast when an UnknownServiceException is encountered. This currently occurs when the application declares that it does not perform cleartext network traffic and tries to load media over cleartext HTTP. Without this CL, MediaPlayer blocks for 30 seconds because it treats this error as recoverable and goes into a ten retry loop with a three second delay before each retry. The result at MediaPlayer client level is MediaPlayer.MEDIA_ERROR_UNKNOWN error. This error code is used for non-recoverable situations such as when an invalid redirect is encountered or the destination is unreachable. Bug: 20026006 Change-Id: I10f0dadb7740902f8c7c73d0df96cfff31f08ada
Diffstat (limited to 'media/java')
-rw-r--r--media/java/android/media/MediaHTTPConnection.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/media/java/android/media/MediaHTTPConnection.java b/media/java/android/media/MediaHTTPConnection.java
index b2886bb..541d871 100644
--- a/media/java/android/media/MediaHTTPConnection.java
+++ b/media/java/android/media/MediaHTTPConnection.java
@@ -32,6 +32,7 @@ import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.NoRouteToHostException;
import java.net.ProtocolException;
+import java.net.UnknownServiceException;
import java.util.HashMap;
import java.util.Map;
@@ -337,7 +338,10 @@ public class MediaHTTPConnection extends IMediaHTTPConnection.Stub {
} catch (NoRouteToHostException e) {
Log.w(TAG, "readAt " + offset + " / " + size + " => " + e);
return MEDIA_ERROR_UNSUPPORTED;
- } catch (IOException e) {
+ } catch (UnknownServiceException e) {
+ Log.w(TAG, "readAt " + offset + " / " + size + " => " + e);
+ return MEDIA_ERROR_UNSUPPORTED;
+ }catch (IOException e) {
if (VERBOSE) {
Log.d(TAG, "readAt " + offset + " / " + size + " => -1");
}