Robert Shih | 8ee9888 | 2022-01-04 23:37:35 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2021 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.hardware.drm; |
| 18 | |
| 19 | @VintfStability |
| 20 | @Backing(type="int") |
| 21 | enum Status { |
| 22 | /** |
| 23 | * The DRM plugin must return OK when an operation completes without any |
| 24 | * errors. |
| 25 | */ |
| 26 | OK, |
| 27 | /** |
| 28 | * The DRM plugin must return ERROR_DRM_NO_LICENSE, when decryption is |
| 29 | * attempted and no license keys have been provided. |
| 30 | */ |
| 31 | ERROR_DRM_NO_LICENSE, |
| 32 | /** |
| 33 | * ERROR_DRM_LICENSE_EXPIRED must be returned when an attempt is made |
| 34 | * to use a license and the keys in that license have expired. |
| 35 | */ |
| 36 | ERROR_DRM_LICENSE_EXPIRED, |
| 37 | /** |
| 38 | * The DRM plugin must return ERROR_DRM_SESSION_NOT_OPENED when an |
| 39 | * attempt is made to use a session that has not been opened. |
| 40 | */ |
| 41 | ERROR_DRM_SESSION_NOT_OPENED, |
| 42 | /** |
| 43 | * The DRM plugin must return ERROR_DRM_CANNOT_HANDLE when an unsupported |
| 44 | * data format or operation is attempted. |
| 45 | */ |
| 46 | ERROR_DRM_CANNOT_HANDLE, |
| 47 | /** |
| 48 | * ERROR_DRM_INVALID_STATE must be returned when the device is in a state |
| 49 | * where it is not able to perform decryption. |
| 50 | */ |
| 51 | ERROR_DRM_INVALID_STATE, |
| 52 | /** |
| 53 | * The DRM plugin must return BAD_VALUE whenever an illegal parameter is |
| 54 | * passed to one of the interface functions. |
| 55 | */ |
| 56 | BAD_VALUE, |
| 57 | /** |
| 58 | * The DRM plugin must return ERROR_DRM_NOT_PROVISIONED from getKeyRequest, |
| 59 | * openSession or provideKeyResponse when the device has not yet been |
| 60 | * provisioned. |
| 61 | */ |
| 62 | ERROR_DRM_NOT_PROVISIONED, |
| 63 | /** |
| 64 | * ERROR_DRM_RESOURCE_BUSY must be returned when resources, such as drm |
| 65 | * sessions or secure buffers are not available to perform a requested |
| 66 | * operation because they are already in use. |
| 67 | */ |
| 68 | ERROR_DRM_RESOURCE_BUSY, |
| 69 | /** |
| 70 | * The DRM Plugin must return ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION |
| 71 | * when the output protection level enabled on the device is not |
| 72 | * sufficient to meet the requirements in the license policy. HDCP is an |
| 73 | * example of a form of output protection. |
| 74 | */ |
| 75 | ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION, |
| 76 | /** |
| 77 | * The DRM Plugin must return ERROR_DRM_DEVICE_REVOKED from |
| 78 | * provideProvisionResponse and provideKeyResponse if the response indicates |
| 79 | * that the device has been revoked. Device revocation means that the device |
| 80 | * is no longer permitted to play content. |
| 81 | */ |
| 82 | ERROR_DRM_DEVICE_REVOKED, |
| 83 | /** |
| 84 | * The DRM Plugin must return ERROR_DRM_DECRYPT if the CryptoPlugin |
| 85 | * decrypt operation fails. |
| 86 | */ |
| 87 | ERROR_DRM_DECRYPT, |
| 88 | /** |
| 89 | * ERROR_DRM_UNKNOWN must be returned when a fatal failure occurs and no |
| 90 | * other defined error is appropriate. |
| 91 | */ |
| 92 | ERROR_DRM_UNKNOWN, |
| 93 | /** |
| 94 | * The drm HAL module must return ERROR_DRM_INSUFFICIENT_SECURITY |
| 95 | * from the crypto plugin decrypt method when the security level |
| 96 | * of the device is not sufficient to meet the requirements in the |
| 97 | * license policy. |
| 98 | */ |
| 99 | ERROR_DRM_INSUFFICIENT_SECURITY, |
| 100 | /** |
| 101 | * The drm HAL module must return ERROR_FRAME_TOO_LARGE from the |
| 102 | * decrypt method when the frame being decrypted into the secure |
| 103 | * output buffer exceeds the size of the buffer. |
| 104 | */ |
| 105 | ERROR_DRM_FRAME_TOO_LARGE, |
| 106 | /** |
| 107 | * This error must be returned from any session method when an |
| 108 | * attempt is made to use the session after the crypto hardware |
| 109 | * state has been invalidated. Some devices are not able to |
| 110 | * retain crypto session state across device suspend/resume which |
| 111 | * results in invalid session state. |
| 112 | */ |
| 113 | ERROR_DRM_SESSION_LOST_STATE, |
| 114 | /** |
| 115 | * The drm HAL module must return this error if client |
| 116 | * applications using the hal are temporarily exceeding the |
| 117 | * capacity of available crypto resources such that a retry of |
| 118 | * the operation is likely to succeed. |
| 119 | */ |
| 120 | ERROR_DRM_RESOURCE_CONTENTION, |
| 121 | /** |
| 122 | * queueSecureInput buffer called with 0 subsamples. |
| 123 | */ |
| 124 | CANNOT_DECRYPT_ZERO_SUBSAMPLES, |
| 125 | /** |
| 126 | * An error happened within the crypto library used by the drm plugin. |
| 127 | */ |
| 128 | CRYPTO_LIBRARY_ERROR, |
| 129 | /** |
| 130 | * Non-specific error reported by the device OEM subsystem. |
| 131 | */ |
| 132 | GENERAL_OEM_ERROR, |
| 133 | /** |
| 134 | * Unexpected internal failure in the drm/crypto plugin. |
| 135 | */ |
| 136 | GENERAL_PLUGIN_ERROR, |
| 137 | /** |
| 138 | * The init data parameter passed to getKeyRequest is empty or invalid. |
| 139 | */ |
| 140 | INIT_DATA_INVALID, |
| 141 | /** |
| 142 | * Either the key was not loaded from the license before attempting the |
| 143 | * operation, or the key ID parameter provided by the app is incorrect. |
| 144 | */ |
| 145 | KEY_NOT_LOADED, |
| 146 | /** |
| 147 | * The license response was empty, fields are missing or otherwise unable |
| 148 | * to be parsed. |
| 149 | */ |
| 150 | LICENSE_PARSE_ERROR, |
| 151 | /** |
| 152 | * The operation (e.g. to renew or persist a license) is prohibited by the |
| 153 | * license policy. |
| 154 | */ |
| 155 | LICENSE_POLICY_ERROR, |
| 156 | /** |
| 157 | * Failed to generate a release request because a field in the stored |
| 158 | * license is empty or malformed. |
| 159 | */ |
| 160 | LICENSE_RELEASE_ERROR, |
| 161 | /** |
| 162 | * The license server detected an error in the license request. |
| 163 | */ |
| 164 | LICENSE_REQUEST_REJECTED, |
| 165 | /** |
| 166 | * Failed to restore an offline license because a field is empty or |
| 167 | * malformed. |
| 168 | */ |
| 169 | LICENSE_RESTORE_ERROR, |
| 170 | /** |
| 171 | * License is in an invalid state for the attempted operation. |
| 172 | */ |
| 173 | LICENSE_STATE_ERROR, |
| 174 | /** |
| 175 | * Certificate is malformed or is of the wrong type. |
| 176 | */ |
| 177 | MALFORMED_CERTIFICATE, |
| 178 | /** |
| 179 | * Failure in the media framework. |
| 180 | */ |
| 181 | MEDIA_FRAMEWORK_ERROR, |
| 182 | /** |
| 183 | * Certificate has not been set. |
| 184 | */ |
| 185 | MISSING_CERTIFICATE, |
| 186 | /** |
| 187 | * There was an error loading the provisioned certificate. |
| 188 | */ |
| 189 | PROVISIONING_CERTIFICATE_ERROR, |
| 190 | /** |
| 191 | * Required steps where not performed before provisioning was attempted. |
| 192 | */ |
| 193 | PROVISIONING_CONFIGURATION_ERROR, |
| 194 | /** |
| 195 | * The provisioning response was empty, fields are missing or otherwise |
| 196 | * unable to be parsed. |
| 197 | */ |
| 198 | PROVISIONING_PARSE_ERROR, |
| 199 | /** |
| 200 | * The provisioning server detected an error in the provisioning request. |
| 201 | */ |
| 202 | PROVISIONING_REQUEST_REJECTED, |
| 203 | /** |
| 204 | * Provisioning failed in a way that is likely to succeed on a subsequent |
| 205 | * attempt. |
| 206 | */ |
| 207 | RETRYABLE_PROVISIONING_ERROR, |
| 208 | /** |
| 209 | * Failed to generate a secure stop request because a field in the stored |
| 210 | * license is empty or malformed. |
| 211 | */ |
| 212 | SECURE_STOP_RELEASE_ERROR, |
| 213 | /** |
| 214 | * The plugin was unable to read data from the filesystem. |
| 215 | */ |
| 216 | STORAGE_READ_FAILURE, |
| 217 | /** |
| 218 | * The plugin was unable to write data to the filesystem. |
| 219 | */ |
| 220 | STORAGE_WRITE_FAILURE, |
| 221 | } |