1 /*
2  * Copyright (C) 2022 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 /**
20  * A @{@link Throwable} thrown from {@link MediaDrm} or @{@link MediaCrypto} APIs
21  */
22 public interface MediaDrmThrowable {
23     /**
24      * Returns {@link MediaDrm} plugin vendor defined error code associated with this {@link
25      * MediaDrmThrowable}.
26      * <p>
27      * Please consult the {@link MediaDrm} plugin vendor for details on the error code.
28      *
29      * @return an error code defined by the {@link MediaDrm} plugin vendor if available,
30      * otherwise 0.
31      */
getVendorError()32     public default int getVendorError() {
33         return 0;
34     }
35 
36     /**
37      * Returns OEM or SOC specific error code associated with this {@link
38      * MediaDrmThrowable}.
39      * <p>
40      * Please consult the {@link MediaDrm} plugin, chip, or device vendor for details on the
41      * error code.
42      *
43      * @return an OEM or SOC specific error code if available, otherwise 0.
44      */
getOemError()45     public default int getOemError() {
46         return 0;
47     }
48 
49     /**
50      * Returns {@link MediaDrm} plugin vendor defined error context associated with this {@link
51      * MediaDrmThrowable}.
52      * <p>
53      * Please consult the {@link MediaDrm} plugin vendor for details on the error context.
54      *
55      * @return an opaque integer that would help the @{@link MediaDrm} vendor locate the
56      * source of the error if available, otherwise 0.
57      */
getErrorContext()58     public default int getErrorContext() {
59         return 0;
60     }
61 
62 }
63