Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc0636e5 authored by Chong Zhang's avatar Chong Zhang Committed by Android Git Automerger
Browse files

am 7b1c33f7: am 00795e9e: Merge "return error MEDIA_ERROR_UNSUPPORTED when...

am 7b1c33f7: am 00795e9e: Merge "return error MEDIA_ERROR_UNSUPPORTED when Range request fail" into lmp-mr1-dev automerge: 6610985c

* commit '7b1c33f7':
  return error MEDIA_ERROR_UNSUPPORTED when Range request fail
parents ac5aedb0 7b1c33f7
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import java.net.URL;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.NoRouteToHostException;
import java.net.ProtocolException;
import java.util.HashMap;
import java.util.Map;

@@ -282,7 +283,7 @@ public class MediaHTTPConnection extends IMediaHTTPConnection.Stub {
            if (offset > 0 && response != HttpURLConnection.HTTP_PARTIAL) {
                // Some servers simply ignore "Range" requests and serve
                // data from the start of the content.
                throw new IOException();
                throw new ProtocolException();
            }

            mInputStream =
@@ -330,6 +331,9 @@ public class MediaHTTPConnection extends IMediaHTTPConnection.Stub {
            }

            return n;
        } catch (ProtocolException e) {
            Log.w(TAG, "readAt " + offset + " / " + size + " => " + e);
            return MEDIA_ERROR_UNSUPPORTED;
        } catch (NoRouteToHostException e) {
            Log.w(TAG, "readAt " + offset + " / " + size + " => " + e);
            return MEDIA_ERROR_UNSUPPORTED;