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

Commit 969a0647 authored by Jeff Tinker's avatar Jeff Tinker Committed by Android (Google) Code Review
Browse files

Merge "Improve robustness of MediaDrm after mediaserver crash" into mnc-dev

parents 1247e48e 314b7f3a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -15863,6 +15863,10 @@ package android.media {
    ctor public MediaDrmException(java.lang.String);
  }
  public class MediaDrmResetException extends java.lang.IllegalStateException {
    ctor public MediaDrmResetException(java.lang.String);
  }
  public final class MediaExtractor {
    ctor public MediaExtractor();
    method public boolean advance();
+4 −0
Original line number Diff line number Diff line
@@ -17118,6 +17118,10 @@ package android.media {
    ctor public MediaDrmException(java.lang.String);
  }
  public class MediaDrmResetException extends java.lang.IllegalStateException {
    ctor public MediaDrmResetException(java.lang.String);
  }
  public final class MediaExtractor {
    ctor public MediaExtractor();
    method public boolean advance();
+17 −4
Original line number Diff line number Diff line
@@ -89,10 +89,23 @@ import android.util.Log;
 * encrypted content, the samples returned from the extractor remain encrypted, they
 * are only decrypted when the samples are delivered to the decoder.
 * <p>
 * MediaDrm methods throw {@link java.lang.IllegalStateException}
 * when a method is called on a MediaDrm object that is in an invalid or inoperable
 * state. This is typically due to incorrect application API usage, but may also
 * be due to an unrecoverable failure in the DRM plugin or security hardware.
 * MediaDrm methods throw {@link android.media.MediaDrm.MediaDrmStateException}
 * when a method is called on a MediaDrm object that has had an unrecoverable failure 
 * in the DRM plugin or security hardware. 
 * {@link android.media.MediaDrm.MediaDrmStateException} extends 
 * {@link java.lang.IllegalStateException} with the addition of a developer-readable 
 * diagnostic information string associated with the exception.
 * <p>
 * In the event of a mediaserver process crash or restart while a MediaDrm object
 * is active, MediaDrm methods may throw {@link android.media.MediaDrmResetException}.
 * To recover, the app must release the MediaDrm object, then create and initialize
 * a new one.
 * <p>
 * As {@link android.media.MediaDrmResetException} and 
 * {@link android.media.MediaDrm.MediaDrmStateException} both extend 
 * {@link java.lang.IllegalStateException}, they should be in an earlier catch() 
 * block than {@link java.lang.IllegalStateException} if handled separately.
 * <p>
 * <a name="Callbacks"></a>
 * <h3>Callbacks</h3>
 * <p>Applications should register for informational events in order
+28 −0
Original line number Diff line number Diff line
/*
 * Copyright 2015 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.media;

/**
 * This exception is thrown when the MediaDrm instance has become unusable
 * due to a restart of the mediaserver process.  To continue, the app must
 * release the MediaDrm object, then create and initialize a new one.
 */
public class MediaDrmResetException extends IllegalStateException {
    public MediaDrmResetException(String detailMessage) {
        super(detailMessage);
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -308,6 +308,10 @@ static bool throwExceptionAsNecessary(
    } else if (err == ERROR_DRM_DEVICE_REVOKED) {
        jniThrowException(env, "android/media/DeniedByServerException", msg);
        return true;
    } else if (err == DEAD_OBJECT) {
        jniThrowException(env, "android/media/MediaDrmResetException",
                "mediaserver died");
        return true;
    } else if (err != OK) {
        String8 errbuf;
        if (drmMessage != NULL) {