1 /* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.media; 18 19 import android.annotation.Nullable; 20 21 /** 22 * Exception thrown if MediaCrypto object could not be instantiated or 23 * if unable to perform an operation on the MediaCrypto object. 24 */ 25 public final class MediaCryptoException extends Exception implements MediaDrmThrowable { MediaCryptoException(@ullable String detailMessage)26 public MediaCryptoException(@Nullable String detailMessage) { 27 this(detailMessage, 0, 0, 0); 28 } 29 30 /** 31 * @hide 32 */ MediaCryptoException(String message, int vendorError, int oemError, int errorContext)33 public MediaCryptoException(String message, int vendorError, int oemError, int errorContext) { 34 super(message); 35 mVendorError = vendorError; 36 mOemError = oemError; 37 mErrorContext = errorContext; 38 } 39 40 @Override getVendorError()41 public int getVendorError() { 42 return mVendorError; 43 } 44 45 @Override getOemError()46 public int getOemError() { 47 return mOemError; 48 } 49 50 @Override getErrorContext()51 public int getErrorContext() { 52 return mErrorContext; 53 } 54 55 private final int mVendorError, mOemError, mErrorContext; 56 } 57