1 #ifndef HIDL_GENERATED_ANDROID_HARDWARE_DRM_V1_4_IDRMPLUGIN_H
2 #define HIDL_GENERATED_ANDROID_HARDWARE_DRM_V1_4_IDRMPLUGIN_H
3 
4 #include <android/hardware/drm/1.0/types.h>
5 #include <android/hardware/drm/1.1/types.h>
6 #include <android/hardware/drm/1.2/IDrmPlugin.h>
7 #include <android/hardware/drm/1.4/types.h>
8 
9 #include <android/hidl/manager/1.0/IServiceNotification.h>
10 
11 #include <hidl/HidlSupport.h>
12 #include <hidl/MQDescriptor.h>
13 #include <hidl/Status.h>
14 #include <utils/NativeHandle.h>
15 #include <utils/misc.h>
16 
17 namespace android {
18 namespace hardware {
19 namespace drm {
20 namespace V1_4 {
21 
22 /**
23  * IDrmPlugin is used to interact with a specific drm plugin that was
24  * created by IDrmFactory::createPlugin. A drm plugin provides methods for
25  * obtaining drm keys to be used by a codec to decrypt protected video
26  * content.
27  */
28 struct IDrmPlugin : public ::android::hardware::drm::V1_2::IDrmPlugin {
29     /**
30      * Type tag for use in template logic that indicates this is a 'pure' class.
31      */
32     typedef ::android::hardware::details::i_tag _hidl_tag;
33 
34     /**
35      * Fully qualified interface name: "[email protected]::IDrmPlugin"
36      */
37     static const char* descriptor;
38 
39     /**
40      * Returns whether this object's implementation is outside of the current process.
41      */
isRemoteIDrmPlugin42     virtual bool isRemote() const override { return false; }
43 
44     /**
45      * Return callback for openSession
46      */
47     using openSession_cb = std::function<void(::android::hardware::drm::V1_0::Status status, const ::android::hardware::hidl_vec<uint8_t>& sessionId)>;
48     /**
49      * Open a new session with the DrmPlugin object. A session ID is returned
50      * in the sessionId parameter.
51      * @return status the status of the call. The status must be OK or one of
52      * the following errors: ERROR_DRM_NOT_PROVISIONED if the device requires
53      * provisioning before it can open a session, ERROR_DRM_RESOURCE_BUSY if
54      * there are insufficent resources available to open a session,
55      * ERROR_DRM_CANNOT_HANDLE, if openSession is not supported at the time of
56      * the call or ERROR_DRM_INVALID_STATE if the HAL is in a state where a
57      * session cannot be opened.
58      * @return sessionId the session ID for the newly opened session
59      */
60     virtual ::android::hardware::Return<void> openSession(openSession_cb _hidl_cb) override = 0;
61 
62     /**
63      * Close a session on the DrmPlugin object
64      *
65      * @param sessionId the session id the call applies to
66      * @return status the status of the call.  The status must be OK or one of
67      * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not
68      * opened, BAD_VALUE if the sessionId is invalid or ERROR_DRM_INVALID_STATE
69      * if the HAL is in a state where the session cannot be closed.
70      */
71     virtual ::android::hardware::Return<::android::hardware::drm::V1_0::Status> closeSession(const ::android::hardware::hidl_vec<uint8_t>& sessionId) override = 0;
72 
73     /**
74      * Return callback for getKeyRequest
75      */
76     using getKeyRequest_cb = std::function<void(::android::hardware::drm::V1_0::Status status, const ::android::hardware::hidl_vec<uint8_t>& request, ::android::hardware::drm::V1_0::KeyRequestType requestType, const ::android::hardware::hidl_string& defaultUrl)>;
77     /**
78      * A key request/response exchange occurs between the app and a License
79      * Server to obtain the keys required to decrypt the content.
80      * getKeyRequest() is used to obtain an opaque key request blob that is
81      * delivered to the license server.
82      *
83      * @param scope may be a sessionId or a keySetId, depending on the
84      * specified keyType. When the keyType is OFFLINE or STREAMING,
85      * scope should be set to the sessionId the keys will be provided to.
86      * When the keyType is RELEASE, scope should be set to the keySetId
87      * of the keys being released.
88      * @param initData container-specific data, its meaning is interpreted
89      * based on the mime type provided in the mimeType parameter. It could
90      * contain, for example, the content ID, key ID or other data obtained
91      * from the content metadata that is required to generate the key request.
92      * initData may be empty when keyType is RELEASE.
93      * @param mimeType identifies the mime type of the content
94      * @param keyType specifies if the keys are to be used for streaming,
95      * offline or a release
96      * @param optionalParameters included in the key request message to
97      * allow a client application to provide additional message parameters to
98      * the server.
99      *
100      * @return status the status of the call.  The status must be OK or one of
101      * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not
102      * opened, ERROR_DRM_NOT_PROVISIONED if the device requires provisioning
103      * before it can generate a key request, ERROR_DRM_CANNOT_HANDLE if
104      * getKeyRequest is not supported at the time of the call, BAD_VALUE if any
105      * parameters are invalid or ERROR_DRM_INVALID_STATE if the HAL is in a state
106      * where a key request cannot be generated.
107      * @return request if successful, the opaque key request blob is returned
108      * @return requestType indicates type information about the returned
109      * request. The type may be one of INITIAL, RENEWAL or RELEASE. An
110      * INITIAL request is the first key request for a license. RENEWAL is a
111      * subsequent key request used to refresh the keys in a license. RELEASE
112      * corresponds to a keyType of RELEASE, which indicates keys are being
113      * released.
114      * @return defaultUrl the URL that the request may be sent to, if
115      * provided by the drm HAL. The app may choose to override this
116      * URL.
117      */
118     virtual ::android::hardware::Return<void> getKeyRequest(const ::android::hardware::hidl_vec<uint8_t>& scope, const ::android::hardware::hidl_vec<uint8_t>& initData, const ::android::hardware::hidl_string& mimeType, ::android::hardware::drm::V1_0::KeyType keyType, const ::android::hardware::hidl_vec<::android::hardware::drm::V1_0::KeyValue>& optionalParameters, getKeyRequest_cb _hidl_cb) override = 0;
119 
120     /**
121      * Return callback for provideKeyResponse
122      */
123     using provideKeyResponse_cb = std::function<void(::android::hardware::drm::V1_0::Status status, const ::android::hardware::hidl_vec<uint8_t>& keySetId)>;
124     /**
125      * After a key response is received by the app, it is provided to the
126      * Drm plugin using provideKeyResponse.
127      *
128      * @param scope may be a sessionId or a keySetId depending on the type
129      * of the response. Scope should be set to the sessionId when the response
130      * is for either streaming or offline key requests. Scope should be set to
131      * the keySetId when the response is for a release request.
132      * @param response the response from the key server that is being
133      * provided to the drm HAL.
134      *
135      * @return status the status of the call.  The status must be OK or one of
136      * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not
137      * opened, ERROR_DRM_NOT_PROVISIONED if the device requires provisioning
138      * before it can handle the key response, ERROR_DRM_DEVICE_REVOKED if the
139      * device has been disabled by the license policy, ERROR_DRM_CANNOT_HANDLE
140      * if provideKeyResponse is not supported at the time of the call, BAD_VALUE
141      * if any parameters are invalid or ERROR_DRM_INVALID_STATE if the HAL is
142      * in a state where a key response cannot be handled.
143      * @return keySetId when the response is for an offline key request, a
144      * keySetId is returned in the keySetId vector parameter that can be used
145      * to later restore the keys to a new session with the method restoreKeys.
146      * When the response is for a streaming or release request, no keySetId is
147      * returned.
148      */
149     virtual ::android::hardware::Return<void> provideKeyResponse(const ::android::hardware::hidl_vec<uint8_t>& scope, const ::android::hardware::hidl_vec<uint8_t>& response, provideKeyResponse_cb _hidl_cb) override = 0;
150 
151     /**
152      * Remove the current keys from a session
153      *
154      * @param sessionId the session id the call applies to
155      * @return status the status of the call.  The status must be OK or one of
156      * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not
157      * opened, BAD_VALUE if the sessionId is invalid or ERROR_DRM_INVALID_STATE
158      * if the HAL is in a state where the keys cannot be removed.
159      */
160     virtual ::android::hardware::Return<::android::hardware::drm::V1_0::Status> removeKeys(const ::android::hardware::hidl_vec<uint8_t>& sessionId) override = 0;
161 
162     /**
163      * Restore persisted offline keys into a new session
164      *
165      * @param sessionId the session id the call applies to
166      * @param keySetId identifies the keys to load, obtained from a prior
167      * call to provideKeyResponse().
168      * @return status the status of the call. The status must be OK or one of
169      * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not
170      * opened, BAD_VALUE if any parameters are invalid or ERROR_DRM_INVALID_STATE
171      * if the HAL is in a state where keys cannot be restored.
172      */
173     virtual ::android::hardware::Return<::android::hardware::drm::V1_0::Status> restoreKeys(const ::android::hardware::hidl_vec<uint8_t>& sessionId, const ::android::hardware::hidl_vec<uint8_t>& keySetId) override = 0;
174 
175     /**
176      * Return callback for queryKeyStatus
177      */
178     using queryKeyStatus_cb = std::function<void(::android::hardware::drm::V1_0::Status status, const ::android::hardware::hidl_vec<::android::hardware::drm::V1_0::KeyValue>& infoList)>;
179     /**
180      * Request an informative description of the license for the session. The
181      * status is in the form of {name, value} pairs. Since DRM license policies
182      * vary by vendor, the specific status field names are determined by each
183      * DRM vendor. Refer to your DRM provider documentation for definitions of
184      * the field names for a particular drm scheme.
185      *
186      * @param sessionId the session id the call applies to
187      * @return status the status of the call. The status must be OK or one of
188      * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not
189      * opened, BAD_VALUE if the sessionId is invalid or ERROR_DRM_INVALID_STATE
190      * if the HAL is in a state where key status cannot be queried.
191      * @return infoList a list of name value pairs describing the license
192      */
193     virtual ::android::hardware::Return<void> queryKeyStatus(const ::android::hardware::hidl_vec<uint8_t>& sessionId, queryKeyStatus_cb _hidl_cb) override = 0;
194 
195     /**
196      * Return callback for getProvisionRequest
197      */
198     using getProvisionRequest_cb = std::function<void(::android::hardware::drm::V1_0::Status status, const ::android::hardware::hidl_vec<uint8_t>& request, const ::android::hardware::hidl_string& defaultUrl)>;
199     /**
200      * A provision request/response exchange occurs between the app and a
201      * provisioning server to retrieve a device certificate. getProvisionRequest
202      * is used to obtain an opaque provisioning request blob that is delivered
203      * to the provisioning server.
204      *
205      * @param certificateType the type of certificate requested, e.g. "X.509"
206      * @param certificateAuthority identifies the certificate authority. A
207      * certificate authority (CA) is an entity which issues digital certificates
208      * for use by other parties. It is an example of a trusted third party.
209      * @return status the status of the call. The status must be OK or one of
210      * the following errors: ERROR_DRM_CANNOT_HANDLE if the drm scheme does not
211      * require provisioning or ERROR_DRM_INVALID_STATE if the HAL is in a state
212      * where the provision request cannot be generated.
213      * @return request if successful the opaque certificate request blob
214      * is returned
215      * @return defaultUrl URL that the provisioning request should be
216      * sent to, if known by the HAL implementation.  If the HAL implementation
217      * does not provide a defaultUrl, the returned string must be empty.
218      */
219     virtual ::android::hardware::Return<void> getProvisionRequest(const ::android::hardware::hidl_string& certificateType, const ::android::hardware::hidl_string& certificateAuthority, getProvisionRequest_cb _hidl_cb) override = 0;
220 
221     /**
222      * Return callback for provideProvisionResponse
223      */
224     using provideProvisionResponse_cb = std::function<void(::android::hardware::drm::V1_0::Status status, const ::android::hardware::hidl_vec<uint8_t>& certificate, const ::android::hardware::hidl_vec<uint8_t>& wrappedKey)>;
225     /**
226      * After a provision response is received by the app from a provisioning
227      * server, it is provided to the Drm HAL using provideProvisionResponse.
228      * The HAL implementation must receive the provision request and
229      * store the provisioned credentials.
230      *
231      * @param response the opaque provisioning response received by the
232      * app from a provisioning server.
233      *
234      * @return status the status of the call. The status must be OK or one of
235      * the following errors: ERROR_DRM_DEVICE_REVOKED if the device has been
236      * disabled by the license policy, BAD_VALUE if any parameters are invalid
237      * or ERROR_DRM_INVALID_STATE if the HAL is in a state where the provision
238      * response cannot be handled.
239      * @return certificate the public certificate resulting from the provisioning
240      * operation, if any. An empty vector indicates that no certificate was
241      * returned.
242      * @return wrappedKey an opaque object containing encrypted private key
243      * material to be used by signRSA when computing an RSA signature on a
244      * message, see the signRSA method.
245      */
246     virtual ::android::hardware::Return<void> provideProvisionResponse(const ::android::hardware::hidl_vec<uint8_t>& response, provideProvisionResponse_cb _hidl_cb) override = 0;
247 
248     /**
249      * Return callback for getSecureStops
250      */
251     using getSecureStops_cb = std::function<void(::android::hardware::drm::V1_0::Status status, const ::android::hardware::hidl_vec<::android::hardware::drm::V1_0::SecureStop>& secureStops)>;
252     /**
253      * SecureStop is a way of enforcing the concurrent stream limit per
254      * subscriber. It can securely monitor the lifetime of sessions across
255      * device reboots by periodically persisting the session lifetime
256      * status in secure storage.
257      *
258      * A signed version of the sessionID is written to persistent storage on the
259      * device when each MediaCrypto object is created and periodically during
260      * playback. The sessionID is signed by the device private key to prevent
261      * tampering.
262      *
263      * When playback is completed the session is destroyed, and the secure
264      * stops are queried by the app. The app then delivers the secure stop
265      * message to a server which verifies the signature to confirm that the
266      * session and its keys have been removed from the device. The persisted
267      * record on the device is removed after receiving and verifying the
268      * signed response from the server.
269      *
270      *
271      * Get all secure stops on the device
272      *
273      * @return status the status of the call. The status must be OK or
274      * ERROR_DRM_INVALID_STATE if the HAL is in a state where the secure stops
275      * cannot be returned.
276      * @return secureStops a list of the secure stop opaque objects
277      */
278     virtual ::android::hardware::Return<void> getSecureStops(getSecureStops_cb _hidl_cb) override = 0;
279 
280     /**
281      * Return callback for getSecureStop
282      */
283     using getSecureStop_cb = std::function<void(::android::hardware::drm::V1_0::Status status, const ::android::hardware::drm::V1_0::SecureStop& secureStop)>;
284     /**
285      * Get all secure stops by secure stop ID
286      *
287      * @param secureStopId the ID of the secure stop to return. The
288      * secure stop ID is delivered by the key server as part of the key
289      * response and must also be known by the app.
290      *
291      * @return status the status of the call. The status must be OK or one of
292      * the following errors: BAD_VALUE if the secureStopId is invalid or
293      * ERROR_DRM_INVALID_STATE if the HAL is in a state where the secure stop
294      * cannot be returned.
295      * @return secureStop the secure stop opaque object
296      */
297     virtual ::android::hardware::Return<void> getSecureStop(const ::android::hardware::hidl_vec<uint8_t>& secureStopId, getSecureStop_cb _hidl_cb) override = 0;
298 
299     /**
300      * Release all secure stops on the device
301      *
302      * @return status the status of the call. The status must be OK or
303      * ERROR_DRM_INVALID_STATE if the HAL is in a state where the secure
304      * stops cannot be released.
305      */
306     virtual ::android::hardware::Return<::android::hardware::drm::V1_0::Status> releaseAllSecureStops() override = 0;
307 
308     /**
309      * Release a secure stop by secure stop ID
310      *
311      * @param secureStopId the ID of the secure stop to release. The
312      * secure stop ID is delivered by the key server as part of the key
313      * response and must also be known by the app.
314      *
315      * @return status the status of the call. The status must be OK or one of
316      * the following errors: BAD_VALUE if the secureStopId is invalid or
317      * ERROR_DRM_INVALID_STATE if the HAL is in a state where the secure stop
318      * cannot be released.
319      */
320     virtual ::android::hardware::Return<::android::hardware::drm::V1_0::Status> releaseSecureStop(const ::android::hardware::hidl_vec<uint8_t>& secureStopId) override = 0;
321 
322     /**
323      * Return callback for getPropertyString
324      */
325     using getPropertyString_cb = std::function<void(::android::hardware::drm::V1_0::Status status, const ::android::hardware::hidl_string& value)>;
326     /**
327      * A drm scheme can have properties that are settable and readable
328      * by an app. There are a few forms of property access methods,
329      * depending on the data type of the property.
330      *
331      * Property values defined by the public API are:
332      *   "vendor" [string] identifies the maker of the drm scheme
333      *   "version" [string] identifies the version of the drm scheme
334      *   "description" [string] describes the drm scheme
335      *   'deviceUniqueId' [byte array] The device unique identifier is
336      *   established during device provisioning and provides a means of
337      *   uniquely identifying each device.
338      *
339      * Since drm scheme properties may vary, additional field names may be
340      * defined by each DRM vendor. Refer to your DRM provider documentation
341      * for definitions of its additional field names.
342      *
343      *
344      * Read a string property value given the property name.
345      *
346      * @param propertyName the name of the property
347      * @return status the status of the call. The status must be OK or one of
348      * the following errors: BAD_VALUE if the property name is invalid,
349      * ERROR_DRM_CANNOT_HANDLE if the property is not supported, or
350      * ERROR_DRM_INVALID_STATE if the HAL is in a state where the property
351      * cannot be obtained.
352      * @return value the property value string
353      */
354     virtual ::android::hardware::Return<void> getPropertyString(const ::android::hardware::hidl_string& propertyName, getPropertyString_cb _hidl_cb) override = 0;
355 
356     /**
357      * Return callback for getPropertyByteArray
358      */
359     using getPropertyByteArray_cb = std::function<void(::android::hardware::drm::V1_0::Status status, const ::android::hardware::hidl_vec<uint8_t>& value)>;
360     /**
361      * Read a byte array property value given the property name.
362      *
363      * @param propertyName the name of the property
364      * @return status the status of the call. The status must be OK or one of
365      * the following errors: BAD_VALUE if the property name is invalid,
366      * ERROR_DRM_CANNOT_HANDLE if the property is not supported, or
367      * ERROR_DRM_INVALID_STATE if the HAL is in a state where the property
368      * cannot be obtained.
369      * @return value the property value byte array
370      */
371     virtual ::android::hardware::Return<void> getPropertyByteArray(const ::android::hardware::hidl_string& propertyName, getPropertyByteArray_cb _hidl_cb) override = 0;
372 
373     /**
374      * Write a property string value given the property name
375      *
376      * @param propertyName the name of the property
377      * @param value the value to write
378      * @return status the status of the call. The status must be OK or one of
379      * the following errors: BAD_VALUE if the property name is invalid,
380      * ERROR_DRM_CANNOT_HANDLE if the property is not supported, or
381      * ERROR_DRM_INVALID_STATE if the HAL is in a state where the property
382      * cannot be set.
383      */
384     virtual ::android::hardware::Return<::android::hardware::drm::V1_0::Status> setPropertyString(const ::android::hardware::hidl_string& propertyName, const ::android::hardware::hidl_string& value) override = 0;
385 
386     /**
387      * Write a property byte array value given the property name
388      *
389      * @param propertyName the name of the property
390      * @param value the value to write
391      * @return status the status of the call. The status must be OK or one of
392      * the following errors: BAD_VALUE if the property name is invalid,
393      * ERROR_DRM_CANNOT_HANDLE if the property is not supported, or
394      * ERROR_DRM_INVALID_STATE if the HAL is in a state where the property
395      * cannot be set.
396      */
397     virtual ::android::hardware::Return<::android::hardware::drm::V1_0::Status> setPropertyByteArray(const ::android::hardware::hidl_string& propertyName, const ::android::hardware::hidl_vec<uint8_t>& value) override = 0;
398 
399     /**
400      * The following methods implement operations on a CryptoSession to support
401      * encrypt, decrypt, sign verify operations on operator-provided
402      * session keys.
403      *
404      *
405      * Set the cipher algorithm to be used for the specified session.
406      *
407      * @param sessionId the session id the call applies to
408      * @param algorithm the algorithm to use. The string conforms to JCA
409      * Standard Names for Cipher Transforms and is case insensitive. An
410      * example algorithm is "AES/CBC/PKCS5Padding".
411      * @return status the status of the call. The status must be OK or one of
412      * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not
413      * opened, BAD_VALUE if any parameters are invalid or ERROR_DRM_INVALID_STATE
414      * if the HAL is in a state where the algorithm cannot be set.
415      */
416     virtual ::android::hardware::Return<::android::hardware::drm::V1_0::Status> setCipherAlgorithm(const ::android::hardware::hidl_vec<uint8_t>& sessionId, const ::android::hardware::hidl_string& algorithm) override = 0;
417 
418     /**
419      * Set the MAC algorithm to be used for computing hashes in a session.
420      *
421      * @param sessionId the session id the call applies to
422      * @param algorithm the algorithm to use. The string conforms to JCA
423      * Standard Names for Mac Algorithms and is case insensitive. An example MAC
424      * algorithm string is "HmacSHA256".
425      * @return status the status of the call. The status must be OK or one of the
426      * following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not
427      * opened, BAD_VALUE if any parameters are invalid or ERROR_DRM_INVALID_STATE
428      * if the HAL is in a state where the algorithm cannot be set.
429      */
430     virtual ::android::hardware::Return<::android::hardware::drm::V1_0::Status> setMacAlgorithm(const ::android::hardware::hidl_vec<uint8_t>& sessionId, const ::android::hardware::hidl_string& algorithm) override = 0;
431 
432     /**
433      * Return callback for encrypt
434      */
435     using encrypt_cb = std::function<void(::android::hardware::drm::V1_0::Status status, const ::android::hardware::hidl_vec<uint8_t>& output)>;
436     /**
437      * Encrypt the provided input buffer with the cipher algorithm specified by
438      * setCipherAlgorithm and the key selected by keyId, and return the
439      * encrypted data.
440      *
441      * @param sessionId the session id the call applies to
442      * @param keyId the ID of the key to use for encryption
443      * @param input the input data to encrypt
444      * @param iv the initialization vector to use for encryption
445      * @return status the status of the call. The status must be OK or one of the
446      * following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not opened,
447      * BAD_VALUE if any parameters are invalid or ERROR_DRM_INVALID_STATE
448      * if the HAL is in a state where the encrypt operation cannot be performed.
449      * @return output the decrypted data
450      */
451     virtual ::android::hardware::Return<void> encrypt(const ::android::hardware::hidl_vec<uint8_t>& sessionId, const ::android::hardware::hidl_vec<uint8_t>& keyId, const ::android::hardware::hidl_vec<uint8_t>& input, const ::android::hardware::hidl_vec<uint8_t>& iv, encrypt_cb _hidl_cb) override = 0;
452 
453     /**
454      * Return callback for decrypt
455      */
456     using decrypt_cb = std::function<void(::android::hardware::drm::V1_0::Status status, const ::android::hardware::hidl_vec<uint8_t>& output)>;
457     /**
458      * Decrypt the provided input buffer with the cipher algorithm
459      * specified by setCipherAlgorithm and the key selected by keyId,
460      * and return the decrypted data.
461      *
462      * @param sessionId the session id the call applies to
463      * @param keyId the ID of the key to use for decryption
464      * @param input the input data to decrypt
465      * @param iv the initialization vector to use for decryption
466      * @return status the status of the call. The status must be OK or one of
467      * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not
468      * opened, BAD_VALUE if any parameters are invalid or ERROR_DRM_INVALID_STATE
469      * if the HAL is in a state where the decrypt operation cannot be
470      * performed.
471      * @return output the decrypted data
472      */
473     virtual ::android::hardware::Return<void> decrypt(const ::android::hardware::hidl_vec<uint8_t>& sessionId, const ::android::hardware::hidl_vec<uint8_t>& keyId, const ::android::hardware::hidl_vec<uint8_t>& input, const ::android::hardware::hidl_vec<uint8_t>& iv, decrypt_cb _hidl_cb) override = 0;
474 
475     /**
476      * Return callback for sign
477      */
478     using sign_cb = std::function<void(::android::hardware::drm::V1_0::Status status, const ::android::hardware::hidl_vec<uint8_t>& signature)>;
479     /**
480      * Compute a signature over the provided message using the mac algorithm
481      * specified by setMacAlgorithm and the key selected by keyId and return
482      * the signature.
483      *
484      * @param sessionId the session id the call applies to
485      * @param keyId the ID of the key to use for decryption
486      * @param message the message to compute a signature over
487      * @return status the status of the call. The status must be OK or one of
488      * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not
489      * opened, BAD_VALUE if any parameters are invalid or ERROR_DRM_INVALID_STATE
490      * if the HAL is in a state where the sign operation cannot be
491      * performed.
492      * @return signature the computed signature
493      */
494     virtual ::android::hardware::Return<void> sign(const ::android::hardware::hidl_vec<uint8_t>& sessionId, const ::android::hardware::hidl_vec<uint8_t>& keyId, const ::android::hardware::hidl_vec<uint8_t>& message, sign_cb _hidl_cb) override = 0;
495 
496     /**
497      * Return callback for verify
498      */
499     using verify_cb = std::function<void(::android::hardware::drm::V1_0::Status status, bool match)>;
500     /**
501      * Compute a hash of the provided message using the mac algorithm specified
502      * by setMacAlgorithm and the key selected by keyId, and compare with the
503      * expected result.
504      *
505      * @param sessionId the session id the call applies to
506      * @param keyId the ID of the key to use for decryption
507      * @param message the message to compute a hash of
508      * @param signature the signature to verify
509      * @return status the status of the call. The status must be OK or one of
510      * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is not
511      * opened, BAD_VALUE if any parameters are invalid or ERROR_DRM_INVALID_STATE
512      * if the HAL is in a state where the verify operation cannot be
513      * performed.
514      * @return match true if the signature is verified positively,
515      * false otherwise.
516      */
517     virtual ::android::hardware::Return<void> verify(const ::android::hardware::hidl_vec<uint8_t>& sessionId, const ::android::hardware::hidl_vec<uint8_t>& keyId, const ::android::hardware::hidl_vec<uint8_t>& message, const ::android::hardware::hidl_vec<uint8_t>& signature, verify_cb _hidl_cb) override = 0;
518 
519     /**
520      * Return callback for signRSA
521      */
522     using signRSA_cb = std::function<void(::android::hardware::drm::V1_0::Status status, const ::android::hardware::hidl_vec<uint8_t>& signature)>;
523     /**
524      * Compute an RSA signature on the provided message using the specified
525      * algorithm.
526      *
527      * @param sessionId the session id the call applies to
528      * @param algorithm the signing algorithm, such as "RSASSA-PSS-SHA1"
529      * or "PKCS1-BlockType1"
530      * @param message the message to compute the signature on
531      * @param wrappedKey the private key returned during provisioning as
532      * returned by provideProvisionResponse.
533      * @return status the status of the call. The status must be OK or one of
534      * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is
535      * not opened, BAD_VALUE if any parameters are invalid or
536      * ERROR_DRM_INVALID_STATE if the HAL is in a state where the signRSA
537      * operation cannot be performed.
538      * @return signature the RSA signature computed over the message
539      */
540     virtual ::android::hardware::Return<void> signRSA(const ::android::hardware::hidl_vec<uint8_t>& sessionId, const ::android::hardware::hidl_string& algorithm, const ::android::hardware::hidl_vec<uint8_t>& message, const ::android::hardware::hidl_vec<uint8_t>& wrappedkey, signRSA_cb _hidl_cb) override = 0;
541 
542     /**
543      * Plugins call the following methods to deliver events to the
544      * java app.
545      *
546      *
547      * Set a listener for a drm session. This allows the drm HAL to
548      * make asynchronous calls back to the client of IDrm.
549      *
550      * @param listener instance of IDrmPluginListener to receive the events
551      */
552     virtual ::android::hardware::Return<void> setListener(const ::android::sp<::android::hardware::drm::V1_0::IDrmPluginListener>& listener) override = 0;
553 
554     /**
555      * Legacy event sending method, it sends events of various types using a
556      * single overloaded set of parameters. This form is deprecated.
557      *
558      * @param eventType the type of the event
559      * @param sessionId identifies the session the event originated from
560      * @param data event-specific data blob
561      */
562     virtual ::android::hardware::Return<void> sendEvent(::android::hardware::drm::V1_0::EventType eventType, const ::android::hardware::hidl_vec<uint8_t>& sessionId, const ::android::hardware::hidl_vec<uint8_t>& data) override = 0;
563 
564     /**
565      * Send a license expiration update to the listener. The expiration
566      * update indicates how long the current license is valid before it
567      * needs to be renewed.
568      *
569      * @param sessionId identifies the session the event originated from
570      * @param expiryTimeInMS the time when the keys need to be renewed.
571      * The time is in milliseconds, relative to the Unix epoch. A time of 0
572      * indicates that the keys never expire.
573      */
574     virtual ::android::hardware::Return<void> sendExpirationUpdate(const ::android::hardware::hidl_vec<uint8_t>& sessionId, int64_t expiryTimeInMS) override = 0;
575 
576     /**
577      * Send a keys change event to the listener. The keys change event
578      * indicates the status of each key in the session. Keys can be
579      * indicated as being usable, expired, outputnotallowed or statuspending.
580      *
581      * @param sessionId identifies the session the event originated from
582      * @param keyStatusList indicates the status for each key ID in the
583      * session.
584      * @param hasNewUsableKey indicates if the event includes at least one
585      * key that has become usable.
586      */
587     virtual ::android::hardware::Return<void> sendKeysChange(const ::android::hardware::hidl_vec<uint8_t>& sessionId, const ::android::hardware::hidl_vec<::android::hardware::drm::V1_0::KeyStatus>& keyStatusList, bool hasNewUsableKey) override = 0;
588 
589     /**
590      * Return callback for openSession_1_1
591      */
592     using openSession_1_1_cb = std::function<void(::android::hardware::drm::V1_0::Status status, const ::android::hardware::hidl_vec<uint8_t>& sessionId)>;
593     /**
594      * Open a new session at a requested security level. The security level
595      * represents the robustness of the device's DRM implementation. By default,
596      * sessions are opened at the native security level of the device which is
597      * the maximum level that can be supported. Overriding the security level is
598      * necessary when the decrypted frames need to be manipulated, such as for
599      * image compositing. The security level parameter must be equal to or lower
600      * than the native level. If the requested level is not supported, the next
601      * lower supported security level must be set. The level can be queried
602      * using {@link #getSecurityLevel}. A session ID is returned.  When the
603      * [email protected] openSession is called, which has no securityLevel parameter, the
604      * security level is defaulted to the native security level of the device.
605      *
606      * @return status the status of the call. The status must be OK or one of
607      *     the following errors: ERROR_DRM_NOT_PROVISIONED if the device
608      *     requires provisioning before it can open a session,
609      *     ERROR_DRM_RESOURCE_BUSY if there are insufficent resources available
610      *     to open a session, ERROR_DRM_CANNOT_HANDLE if the requested security
611      *     level is higher than the native level or lower than the lowest
612      *     supported level or if openSession is not supported at the time of
613      *     the call, or ERROR_DRM_INVALID_STATE if the HAL is in a state where
614      *     a session cannot be opened.
615      * @param level the requested security level
616      * @return sessionId the session ID for the newly opened session
617      */
618     virtual ::android::hardware::Return<void> openSession_1_1(::android::hardware::drm::V1_1::SecurityLevel securityLevel, openSession_1_1_cb _hidl_cb) override = 0;
619 
620     /**
621      * Return callback for getKeyRequest_1_1
622      */
623     using getKeyRequest_1_1_cb = std::function<void(::android::hardware::drm::V1_0::Status status, const ::android::hardware::hidl_vec<uint8_t>& request, ::android::hardware::drm::V1_1::KeyRequestType requestType, const ::android::hardware::hidl_string& defaultUrl)>;
624     /**
625      * A key request/response exchange occurs between the app and a License
626      * Server to obtain the keys required to decrypt the content.
627      * getKeyRequest_1_1() is used to obtain an opaque key request blob that is
628      * delivered to the license server.
629      *
630      * getKeyRequest_1_1() only differs from getKeyRequest() in that additional
631      * values are returned in 1.1::KeyRequestType as compared to
632      * 1.0::KeyRequestType
633      *
634      * @param scope may be a sessionId or a keySetId, depending on the
635      *        specified keyType. When the keyType is OFFLINE or STREAMING,
636      *        scope should be set to the sessionId the keys will be provided
637      *        to. When the keyType is RELEASE, scope should be set to the
638      *        keySetId of the keys being released.
639      * @param initData container-specific data, its meaning is interpreted
640      *        based on the mime type provided in the mimeType parameter.
641      *        It could contain, for example, the content ID, key ID or
642      *        other data obtained from the content metadata that is
643      *        required to generate the key request. initData may be empty
644      *        when keyType is RELEASE.
645      * @param mimeType identifies the mime type of the content
646      * @param keyType specifies if the keys are to be used for streaming,
647      *        offline or a release
648      * @param optionalParameters included in the key request message to
649      *        allow a client application to provide additional message
650      *        parameters to the server.
651      * @return status the status of the call. The status must be OK or one of
652      *         the following errors: ERROR_DRM_SESSION_NOT_OPENED if the
653      *         session is not opened, ERROR_DRM_NOT_PROVISIONED if the device
654      *         requires provisioning before it can generate a key request,
655      *         ERROR_DRM_CANNOT_HANDLE if getKeyRequest is not supported
656      *         at the time of the call, BAD_VALUE if any parameters are
657      *         invalid or ERROR_DRM_INVALID_STATE if the HAL is in a
658      *         state where a key request cannot be generated.
659      * @return request if successful, the opaque key request blob is returned
660      * @return requestType indicates type information about the returned
661      *         request. The type may be one of INITIAL, RENEWAL, RELEASE,
662      *         NONE or UPDATE. An INITIAL request is the first key request
663      *         for a license. RENEWAL is a subsequent key request used to
664      *         refresh the keys in a license. RELEASE corresponds to a
665      *         keyType of RELEASE, which indicates keys are being released.
666      *         NONE indicates that no request is needed because the keys are
667      *         already loaded. UPDATE indicates that the keys need to be
668      *         refetched after the initial license request.
669      * @return defaultUrl the URL that the request may be sent to, if
670      *         provided by the drm HAL. The app may choose to override this URL.
671      */
672     virtual ::android::hardware::Return<void> getKeyRequest_1_1(const ::android::hardware::hidl_vec<uint8_t>& scope, const ::android::hardware::hidl_vec<uint8_t>& initData, const ::android::hardware::hidl_string& mimeType, ::android::hardware::drm::V1_0::KeyType keyType, const ::android::hardware::hidl_vec<::android::hardware::drm::V1_0::KeyValue>& optionalParameters, getKeyRequest_1_1_cb _hidl_cb) override = 0;
673 
674     /**
675      * Return callback for getHdcpLevels
676      */
677     using getHdcpLevels_cb = std::function<void(::android::hardware::drm::V1_0::Status status, ::android::hardware::drm::V1_1::HdcpLevel connectedLevel, ::android::hardware::drm::V1_1::HdcpLevel maxLevel)>;
678     /**
679      * Return the currently negotiated and max supported HDCP levels.
680      *
681      * The current level is based on the display(s) the device is connected to.
682      * If multiple HDCP-capable displays are simultaneously connected to
683      * separate interfaces, this method returns the lowest negotiated HDCP level
684      * of all interfaces.
685      *
686      * The maximum HDCP level is the highest level that can potentially be
687      * negotiated. It is a constant for any device, i.e. it does not depend on
688      * downstream receiving devices that could be connected. For example, if
689      * the device has HDCP 1.x keys and is capable of negotiating HDCP 1.x, but
690      * does not have HDCP 2.x keys, then the maximum HDCP capability would be
691      * reported as 1.x. If multiple HDCP-capable interfaces are present, it
692      * indicates the highest of the maximum HDCP levels of all interfaces.
693      *
694      * This method should only be used for informational purposes, not for
695      * enforcing compliance with HDCP requirements. Trusted enforcement of HDCP
696      * policies must be handled by the DRM system.
697      *
698      * @return status the status of the call. The status must be OK or
699      *         ERROR_DRM_INVALID_STATE if the HAL is in a state where the HDCP
700      *         level cannot be queried.
701      * @return connectedLevel the lowest HDCP level for any connected
702      *         displays
703      * @return maxLevel the highest HDCP level that can be supported
704      *         by the device
705      */
706     virtual ::android::hardware::Return<void> getHdcpLevels(getHdcpLevels_cb _hidl_cb) override = 0;
707 
708     /**
709      * Return callback for getNumberOfSessions
710      */
711     using getNumberOfSessions_cb = std::function<void(::android::hardware::drm::V1_0::Status status, uint32_t currentSessions, uint32_t maxSessions)>;
712     /**
713      * Return the current number of open sessions and the maximum number of
714      * sessions that may be opened simultaneosly among all DRM instances for the
715      * active DRM scheme.
716      *
717      * @return status the status of the call. The status must be OK or
718      *         ERROR_DRM_INVALID_STATE if the HAL is in a state where number of
719      *         sessions cannot be queried.
720      * @return currentSessions the number of currently opened sessions
721      * @return maxSessions the maximum number of sessions that the device
722      *         can support
723      */
724     virtual ::android::hardware::Return<void> getNumberOfSessions(getNumberOfSessions_cb _hidl_cb) override = 0;
725 
726     /**
727      * Return callback for getSecurityLevel
728      */
729     using getSecurityLevel_cb = std::function<void(::android::hardware::drm::V1_0::Status status, ::android::hardware::drm::V1_1::SecurityLevel level)>;
730     /**
731      * Return the current security level of a session. A session has an initial
732      * security level determined by the robustness of the DRM system's
733      * implementation on the device.
734      *
735      * @param sessionId the session id the call applies to
736      * @return status the status of the call. The status must be OK or one of
737      *         the following errors: ERROR_DRM_SESSION_NOT_OPENED if the
738      *         session is not opened, BAD_VALUE if the sessionId is invalid or
739      *         ERROR_DRM_INVALID_STATE if the HAL is in a state where the
740      *         security level cannot be queried.
741      * @return level the current security level for the session
742      */
743     virtual ::android::hardware::Return<void> getSecurityLevel(const ::android::hardware::hidl_vec<uint8_t>& sessionId, getSecurityLevel_cb _hidl_cb) override = 0;
744 
745     /**
746      * Return callback for getMetrics
747      */
748     using getMetrics_cb = std::function<void(::android::hardware::drm::V1_0::Status status, const ::android::hardware::hidl_vec<::android::hardware::drm::V1_1::DrmMetricGroup>& metric_groups)>;
749     /**
750      * Returns the plugin-specific metrics. Multiple metric groups may be
751      * returned in one call to getMetrics(). The scope and definition of the
752      * metrics is defined by the plugin.
753      *
754      * @return status the status of the call. The status must be OK or
755      *         ERROR_DRM_INVALID_STATE if the metrics are not available to be
756      *         returned.
757      * @return metric_groups the collection of metric groups provided by the
758      *         plugin.
759      */
760     virtual ::android::hardware::Return<void> getMetrics(getMetrics_cb _hidl_cb) override = 0;
761 
762     /**
763      * Return callback for getSecureStopIds
764      */
765     using getSecureStopIds_cb = std::function<void(::android::hardware::drm::V1_0::Status status, const ::android::hardware::hidl_vec<::android::hardware::hidl_vec<uint8_t>>& secureStopIds)>;
766     /**
767      * Get the IDs of all secure stops on the device
768      *
769      * @return status the status of the call. The status must be OK or
770      * ERROR_DRM_INVALID_STATE if the HAL is in a state where the secure stop
771      * IDs cannot be returned.
772      * @return secureStopIds a list of the IDs
773      */
774     virtual ::android::hardware::Return<void> getSecureStopIds(getSecureStopIds_cb _hidl_cb) override = 0;
775 
776     /**
777      * Release secure stops given a release message from the key server
778      *
779      * @param ssRelease the secure stop release message identifying one or more
780      * secure stops to release. ssRelease is opaque, it is passed directly from
781      * a DRM license server through the app and media framework to the vendor
782      * HAL module. The format and content of ssRelease must be defined by the
783      * DRM scheme being implemented according to this HAL. The DRM scheme
784      * can be identified by its UUID which can be queried using
785      * IDrmFactory::isCryptoSchemeSupported.
786      *
787      * @return status the status of the call. The status must be OK or one of
788      * the following errors: BAD_VALUE if ssRelease is invalid or
789      * ERROR_DRM_INVALID_STATE if the HAL is in a state where the secure stop
790      * cannot be released.
791      */
792     virtual ::android::hardware::Return<::android::hardware::drm::V1_0::Status> releaseSecureStops(const ::android::hardware::drm::V1_1::SecureStopRelease& ssRelease) override = 0;
793 
794     /**
795      * Remove a secure stop given its secure stop ID, without requiring
796      * a secure stop release response message from the key server.
797      *
798      * @param secureStopId the ID of the secure stop to release.
799      *
800      * @return status the status of the call. The status must be OK or one of
801      * the following errors: BAD_VALUE if the secureStopId is invalid or
802      * ERROR_DRM_INVALID_STATE if the HAL is in a state where the secure stop
803      * cannot be released.
804      */
805     virtual ::android::hardware::Return<::android::hardware::drm::V1_0::Status> removeSecureStop(const ::android::hardware::hidl_vec<uint8_t>& secureStopId) override = 0;
806 
807     /**
808      * Remove all secure stops on the device without requiring a secure
809      * stop release response message from the key server.
810      *
811      * @return status the status of the call. The status must be OK or
812      * ERROR_DRM_INVALID_STATE if the HAL is in a state where the secure
813      * stops cannot be removed.
814      */
815     virtual ::android::hardware::Return<::android::hardware::drm::V1_0::Status> removeAllSecureStops() override = 0;
816 
817     /**
818      * Return callback for getOfflineLicenseKeySetIds
819      */
820     using getOfflineLicenseKeySetIds_cb = std::function<void(::android::hardware::drm::V1_0::Status status, const ::android::hardware::hidl_vec<::android::hardware::hidl_vec<uint8_t>>& keySetIds)>;
821     /**
822      * The keys in an offline license allow protected content to be
823      * played even if the device is not connected to a network.
824      * Offline licenses are stored on the device after a key
825      * request/response exchange when the key request KeyType is
826      * OFFLINE. Normally each app is responsible for keeping track of
827      * the KeySetIds it has created. In some situations however, it
828      * will be necessary to request the list of stored offline license
829      * KeySetIds. If an app loses the KeySetId for any stored licenses
830      * that it created, for example, it must be able to recover the
831      * stored KeySetIds so those licenses will be removed when they
832      * expire or when the app is uninstalled.
833      * <p>
834      * This method returns a list of the KeySetIds for all offline
835      * licenses. The offline license KeySetId allows an app to query
836      * the status of an offline license or remove it.
837      *
838      * @return status the status of the call. Must be OK or
839      *     ERROR_DRM_INVALID_STATE if the HAL is in a state where the
840      *     KeySetIds can't be returned.
841      * @return a list of offline license keySetIds. If there are no offline
842      *     licenses, the list must be empty and OK must be returned as the
843      *     status.
844      */
845     virtual ::android::hardware::Return<void> getOfflineLicenseKeySetIds(getOfflineLicenseKeySetIds_cb _hidl_cb) override = 0;
846 
847     /**
848      * Normally offline licenses are released using a key
849      * request/response exchange using getKeyRequest where the KeyType
850      * is RELEASE, followed by provideKeyResponse. This allows the
851      * server to cryptographically confirm that the license has been
852      * removed and then adjust the count of offline licenses allocated
853      * to the device.
854      * <p>
855      * In some exceptional situations it will be necessary to directly
856      * remove offline licenses without notifying the server, which is
857      * performed by this method.
858      *
859      * @param keySetId the id of the offline license to remove
860      * @return status the status of the call. Must be one of OK on
861      *     success, BAD_VALUE if the license is not found or
862      *     ERROR_DRM_INVALID_STATE if the HAL is in a state where the
863      *     KeySetIds can't be removed.
864      */
865     virtual ::android::hardware::Return<::android::hardware::drm::V1_0::Status> removeOfflineLicense(const ::android::hardware::hidl_vec<uint8_t>& keySetId) override = 0;
866 
867     /**
868      * Return callback for getOfflineLicenseState
869      */
870     using getOfflineLicenseState_cb = std::function<void(::android::hardware::drm::V1_0::Status status, ::android::hardware::drm::V1_2::OfflineLicenseState state)>;
871     /**
872      * Request the state of an offline license. An offline license must
873      * be usable or inactive. The keys in a usable offline license are
874      * available for decryption. When the offline license state is
875      * inactive, the keys have been marked for release using
876      * getKeyRequest with KeyType RELEASE but the key response has not
877      * been received. The keys in an inactive offline license are not
878      * usable for decryption.
879      *
880      * @param keySetId the id of the offline license
881      * @return status the status of the call. Must be one of OK on
882      *     success, BAD_VALUE if the license is not found or
883      *     ERROR_DRM_INVALID_STATE if the HAL is in a state where the
884      *     offline license state can't be queried.
885      * @return the offline license state, one of USABLE or INACTIVE.
886      *     If the return status is not OK then state must be set to
887      *     UNKNOWN.
888      */
889     virtual ::android::hardware::Return<void> getOfflineLicenseState(const ::android::hardware::hidl_vec<uint8_t>& keySetId, getOfflineLicenseState_cb _hidl_cb) override = 0;
890 
891     /**
892      * Return callback for getKeyRequest_1_2
893      */
894     using getKeyRequest_1_2_cb = std::function<void(::android::hardware::drm::V1_2::Status status, const ::android::hardware::hidl_vec<uint8_t>& request, ::android::hardware::drm::V1_1::KeyRequestType requestType, const ::android::hardware::hidl_string& defaultUrl)>;
895     /**
896      * A key request/response exchange occurs between the app and a License
897      * Server to obtain the keys required to decrypt the content.
898      * getKeyRequest_1_2() is used to obtain an opaque key request blob that is
899      * delivered to the license server.
900      *
901      * getKeyRequest_1_2() only differs from getKeyRequest_1_1() in that
902      *     additional status codes must be returned.
903      *
904      * @param scope either a sessionId or a keySetId, depending on the
905      *     specified keyType. When the keyType is OFFLINE or STREAMING, scope
906      *     must be set to the sessionId the keys will be provided to. When the
907      *     keyType is RELEASE, scope must be set to the keySetId of the keys
908      *     being released.
909      * @param initData container-specific data, its meaning is interpreted
910      *     based on the mime type provided in the mimeType parameter. It could
911      *     contain, for example, the content ID, key ID or other data obtained
912      *     from the content metadata that is required to generate the key
913      *     request. initData must be empty when keyType is RELEASE.
914      * @param mimeType identifies the mime type of the content
915      * @param keyType specifies if the keys are to be used for streaming,
916      *     offline or a release
917      * @param optionalParameters included in the key request message to
918      *     allow a client application to provide additional message parameters
919      *     to the server.
920      * @return status the status of the call. The status must be OK or one of
921      *     the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session is
922      *     not opened, ERROR_DRM_NOT_PROVISIONED if the device requires
923      *     provisioning before it is able to generate a key request,
924      *     ERROR_DRM_RESOURCE_CONTENTION if client applications using the hal
925      *     are temporarily exceeding the available crypto resources such that a
926      *     retry of the operation is likely to succeed, ERROR_DRM_CANNOT_HANDLE
927      *     if getKeyRequest is not supported at the time of the call, BAD_VALUE
928      *     if any parameters are invalid or ERROR_DRM_INVALID_STATE if the HAL
929      *     is in a state where a key request cannot be generated.
930      * @return request if successful, the opaque key request blob is returned
931      * @return requestType indicates type information about the returned
932      *      request. The type must be one of INITIAL, RENEWAL, RELEASE, NONE or
933      *      UPDATE. An INITIAL request is the first key request for a
934      *      license. RENEWAL is a subsequent key request used to refresh the
935      *      keys in a license. RELEASE corresponds to a keyType of RELEASE,
936      *      which indicates keys are being released. NONE indicates that no
937      *      request is needed because the keys are already loaded. UPDATE
938      *      indicates that the keys need to be refetched after the initial
939      *      license request.
940      * @return defaultUrl the URL that the request may be sent to, if
941      *      provided by the drm HAL. The app can choose to override this URL.
942      */
943     virtual ::android::hardware::Return<void> getKeyRequest_1_2(const ::android::hardware::hidl_vec<uint8_t>& scope, const ::android::hardware::hidl_vec<uint8_t>& initData, const ::android::hardware::hidl_string& mimeType, ::android::hardware::drm::V1_0::KeyType keyType, const ::android::hardware::hidl_vec<::android::hardware::drm::V1_0::KeyValue>& optionalParameters, getKeyRequest_1_2_cb _hidl_cb) override = 0;
944 
945     /**
946      * Return callback for getProvisionRequest_1_2
947      */
948     using getProvisionRequest_1_2_cb = std::function<void(::android::hardware::drm::V1_2::Status status, const ::android::hardware::hidl_vec<uint8_t>& request, const ::android::hardware::hidl_string& defaultUrl)>;
949     /**
950      * A provision request/response exchange occurs between the app and a
951      * provisioning server to retrieve a device certificate. getProvisionRequest
952      * is used to obtain an opaque provisioning request blob that is delivered
953      * to the provisioning server.
954      *
955      * getProvisionRequest_1_2() only differs from getProvisionRequest_1_0() in
956      *     that additional status codes must be returned.
957      *
958      * @param certificateType the type of certificate requested, e.g. "X.509"
959      * @param certificateAuthority identifies the certificate authority. A
960      *     certificate authority (CA) is an entity which issues digital
961      *     certificates for use by other parties. It is an example of a trusted
962      *     third party.
963      * @return status the status of the call. The status must be OK or one of
964      *     the following errors: ERROR_DRM_RESOURCE_CONTENTION if client
965      *     applications using the hal are temporarily exceeding the available
966      *     crypto resources such that a retry of the operation is likely to
967      *     succeed, ERROR_DRM_CANNOT_HANDLE if the drm scheme does not require
968      *     provisioning or ERROR_DRM_INVALID_STATE if the HAL is in a state
969      *     where the provision request cannot be generated.
970      * @return request if successful the opaque certificate request blob
971      *     is returned
972      * @return defaultUrl URL that the provisioning request may be
973      *     sent to, if known by the HAL implementation. An app can choose to
974      *     override this URL. If the HAL implementation does not provide a
975      *     defaultUrl, the returned string must be empty.
976      */
977     virtual ::android::hardware::Return<void> getProvisionRequest_1_2(const ::android::hardware::hidl_string& certificateType, const ::android::hardware::hidl_string& certificateAuthority, getProvisionRequest_1_2_cb _hidl_cb) override = 0;
978 
979     /**
980      * Return callback for getHdcpLevels_1_2
981      */
982     using getHdcpLevels_1_2_cb = std::function<void(::android::hardware::drm::V1_2::Status status, ::android::hardware::drm::V1_2::HdcpLevel connectedLevel, ::android::hardware::drm::V1_2::HdcpLevel maxLevel)>;
983     /**
984      * Return the currently negotiated and max supported HDCP levels.
985      *
986      * This method only differs from @1.1 version by the addition of
987      * support for HDCP 2.3.
988      *
989      * The current level is based on the display(s) the device is connected to.
990      * If multiple HDCP-capable displays are simultaneously connected to
991      * separate interfaces, this method returns the lowest negotiated HDCP level
992      * of all interfaces.
993      *
994      * The maximum HDCP level is the highest level that can potentially be
995      * negotiated. It is a constant for any device, i.e. it does not depend on
996      * downstream receiving devices that could be connected. For example, if
997      * the device has HDCP 1.x keys and is capable of negotiating HDCP 1.x, but
998      * does not have HDCP 2.x keys, then the maximum HDCP capability would be
999      * reported as 1.x. If multiple HDCP-capable interfaces are present, it
1000      * indicates the highest of the maximum HDCP levels of all interfaces.
1001      *
1002      * This method should only be used for informational purposes, not for
1003      * enforcing compliance with HDCP requirements. Trusted enforcement of HDCP
1004      * policies must be handled by the DRM system.
1005      *
1006      * @return status the status of the call. The status must be OK or
1007      *         ERROR_DRM_INVALID_STATE if the HAL is in a state where the HDCP
1008      *         level cannot be queried.
1009      * @return connectedLevel the lowest HDCP level for any connected
1010      *         displays
1011      * @return maxLevel the highest HDCP level that can be supported
1012      *         by the device
1013      */
1014     virtual ::android::hardware::Return<void> getHdcpLevels_1_2(getHdcpLevels_1_2_cb _hidl_cb) override = 0;
1015 
1016     /**
1017      * Send a session lost state event to the listener. This event
1018      * indicates that a session's state has become invalid because the
1019      * device crypto hardware is incapable of retaining crypto session
1020      * state across suspend and resume cycles.
1021      *
1022      * @param sessionId identifies the session the event originated from
1023      */
1024     virtual ::android::hardware::Return<void> sendSessionLostState(const ::android::hardware::hidl_vec<uint8_t>& sessionId) override = 0;
1025 
1026     /**
1027      * Send a keys change event to the listener. The keys change event
1028      * indicates the status of each key in the session. Keys can be
1029      * indicated as being usable, expired, outputnotallowed or statuspending.
1030      *
1031      * This method only differs from @1.0 version by the addition of new
1032      * KeyStatusType(s) in keyStatusList.
1033      *
1034      * @param sessionId identifies the session the event originated from
1035      * @param keyStatusList indicates the status for each key ID in the
1036      * session.
1037      * @param hasNewUsableKey indicates if the event includes at least one
1038      * key that has become usable.
1039      */
1040     virtual ::android::hardware::Return<void> sendKeysChange_1_2(const ::android::hardware::hidl_vec<uint8_t>& sessionId, const ::android::hardware::hidl_vec<::android::hardware::drm::V1_2::KeyStatus>& keyStatusList, bool hasNewUsableKey) override = 0;
1041 
1042     /**
1043      * Check if the specified mime-type & security level require a secure decoder
1044      * component.
1045      *
1046      * @param mime The content mime-type
1047      * @param level the requested security level
1048      * @return secureRequired must be true if and only if a secure decoder is required
1049      * for the specified mime-type & security level
1050      */
1051     virtual ::android::hardware::Return<bool> requiresSecureDecoder(const ::android::hardware::hidl_string& mime, ::android::hardware::drm::V1_1::SecurityLevel level) = 0;
1052 
1053     /**
1054      * Check if the specified mime-type requires a secure decoder component
1055      * at the highest security level supported on the device.
1056      *
1057      * @param mime The content mime-type
1058      * @return secureRequired must be true if and only if a secure decoder is required
1059      * for the specified mime-type
1060      */
1061     virtual ::android::hardware::Return<bool> requiresSecureDecoderDefault(const ::android::hardware::hidl_string& mime) = 0;
1062 
1063     /**
1064      * Set playback id of a drm session. The playback id can be used to join drm session metrics
1065      * with metrics from other low level media components, e.g. codecs, or metrics from the high
1066      * level player.
1067      *
1068      * @param sessionId drm session id
1069      * @param playbackId high level playback id
1070      * @return status the status of the call. The status must be OK on success, or
1071      *     ERROR_DRM_SESSION_NOT_OPENED if the drm session cannot be found
1072      */
1073     virtual ::android::hardware::Return<::android::hardware::drm::V1_0::Status> setPlaybackId(const ::android::hardware::hidl_vec<uint8_t>& sessionId, const ::android::hardware::hidl_string& playbackId) = 0;
1074 
1075     /**
1076      * Return callback for getLogMessages
1077      */
1078     using getLogMessages_cb = std::function<void(::android::hardware::drm::V1_4::Status status, const ::android::hardware::hidl_vec<::android::hardware::drm::V1_4::LogMessage>& logMessages)>;
1079     /**
1080      * @return logMessages latest plugin level log messages. Can be used
1081      *     by apps in diagnosis of errors.
1082      * @return status the status of the call. The status must be:
1083      *     OK on success;
1084      *     GENERAL_OEM_ERROR on OEM-provided, low-level component failures;
1085      *     GENERAL_PLUGIN_ERROR on unexpected plugin-level errors.
1086      */
1087     virtual ::android::hardware::Return<void> getLogMessages(getLogMessages_cb _hidl_cb) = 0;
1088 
1089     /**
1090      * Return callback for interfaceChain
1091      */
1092     using interfaceChain_cb = std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& descriptors)>;
1093     /*
1094      * Provides run-time type information for this object.
1095      * For example, for the following interface definition:
1096      *     package [email protected];
1097      *     interface IParent {};
1098      *     interface IChild extends IParent {};
1099      * Calling interfaceChain on an IChild object must yield the following:
1100      *     ["[email protected]::IChild",
1101      *      "[email protected]::IParent"
1102      *      "[email protected]::IBase"]
1103      *
1104      * @return descriptors a vector of descriptors of the run-time type of the
1105      *         object.
1106      */
1107     virtual ::android::hardware::Return<void> interfaceChain(interfaceChain_cb _hidl_cb) override;
1108 
1109     /*
1110      * Emit diagnostic information to the given file.
1111      *
1112      * Optionally overriden.
1113      *
1114      * @param fd      File descriptor to dump data to.
1115      *                Must only be used for the duration of this call.
1116      * @param options Arguments for debugging.
1117      *                Must support empty for default debug information.
1118      */
1119     virtual ::android::hardware::Return<void> debug(const ::android::hardware::hidl_handle& fd, const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& options) override;
1120 
1121     /**
1122      * Return callback for interfaceDescriptor
1123      */
1124     using interfaceDescriptor_cb = std::function<void(const ::android::hardware::hidl_string& descriptor)>;
1125     /*
1126      * Provides run-time type information for this object.
1127      * For example, for the following interface definition:
1128      *     package [email protected];
1129      *     interface IParent {};
1130      *     interface IChild extends IParent {};
1131      * Calling interfaceDescriptor on an IChild object must yield
1132      *     "[email protected]::IChild"
1133      *
1134      * @return descriptor a descriptor of the run-time type of the
1135      *         object (the first element of the vector returned by
1136      *         interfaceChain())
1137      */
1138     virtual ::android::hardware::Return<void> interfaceDescriptor(interfaceDescriptor_cb _hidl_cb) override;
1139 
1140     /**
1141      * Return callback for getHashChain
1142      */
1143     using getHashChain_cb = std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_array<uint8_t, 32>>& hashchain)>;
1144     /*
1145      * Returns hashes of the source HAL files that define the interfaces of the
1146      * runtime type information on the object.
1147      * For example, for the following interface definition:
1148      *     package [email protected];
1149      *     interface IParent {};
1150      *     interface IChild extends IParent {};
1151      * Calling interfaceChain on an IChild object must yield the following:
1152      *     [(hash of IChild.hal),
1153      *      (hash of IParent.hal)
1154      *      (hash of IBase.hal)].
1155      *
1156      * SHA-256 is used as the hashing algorithm. Each hash has 32 bytes
1157      * according to SHA-256 standard.
1158      *
1159      * @return hashchain a vector of SHA-1 digests
1160      */
1161     virtual ::android::hardware::Return<void> getHashChain(getHashChain_cb _hidl_cb) override;
1162 
1163     /*
1164      * This method trigger the interface to enable/disable instrumentation based
1165      * on system property hal.instrumentation.enable.
1166      */
1167     virtual ::android::hardware::Return<void> setHALInstrumentation() override;
1168 
1169     /*
1170      * Registers a death recipient, to be called when the process hosting this
1171      * interface dies.
1172      *
1173      * @param recipient a hidl_death_recipient callback object
1174      * @param cookie a cookie that must be returned with the callback
1175      * @return success whether the death recipient was registered successfully.
1176      */
1177     virtual ::android::hardware::Return<bool> linkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient, uint64_t cookie) override;
1178 
1179     /*
1180      * Provides way to determine if interface is running without requesting
1181      * any functionality.
1182      */
1183     virtual ::android::hardware::Return<void> ping() override;
1184 
1185     /**
1186      * Return callback for getDebugInfo
1187      */
1188     using getDebugInfo_cb = std::function<void(const ::android::hidl::base::V1_0::DebugInfo& info)>;
1189     /*
1190      * Get debug information on references on this interface.
1191      * @return info debugging information. See comments of DebugInfo.
1192      */
1193     virtual ::android::hardware::Return<void> getDebugInfo(getDebugInfo_cb _hidl_cb) override;
1194 
1195     /*
1196      * This method notifies the interface that one or more system properties
1197      * have changed. The default implementation calls
1198      * (C++)  report_sysprop_change() in libcutils or
1199      * (Java) android.os.SystemProperties.reportSyspropChanged,
1200      * which in turn calls a set of registered callbacks (eg to update trace
1201      * tags).
1202      */
1203     virtual ::android::hardware::Return<void> notifySyspropsChanged() override;
1204 
1205     /*
1206      * Unregisters the registered death recipient. If this service was registered
1207      * multiple times with the same exact death recipient, this unlinks the most
1208      * recently registered one.
1209      *
1210      * @param recipient a previously registered hidl_death_recipient callback
1211      * @return success whether the death recipient was unregistered successfully.
1212      */
1213     virtual ::android::hardware::Return<bool> unlinkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient) override;
1214 
1215     // cast static functions
1216     /**
1217      * This performs a checked cast based on what the underlying implementation actually is.
1218      */
1219     static ::android::hardware::Return<::android::sp<::android::hardware::drm::V1_4::IDrmPlugin>> castFrom(const ::android::sp<::android::hardware::drm::V1_4::IDrmPlugin>& parent, bool emitError = false);
1220     /**
1221      * This performs a checked cast based on what the underlying implementation actually is.
1222      */
1223     static ::android::hardware::Return<::android::sp<::android::hardware::drm::V1_4::IDrmPlugin>> castFrom(const ::android::sp<::android::hardware::drm::V1_2::IDrmPlugin>& parent, bool emitError = false);
1224     /**
1225      * This performs a checked cast based on what the underlying implementation actually is.
1226      */
1227     static ::android::hardware::Return<::android::sp<::android::hardware::drm::V1_4::IDrmPlugin>> castFrom(const ::android::sp<::android::hardware::drm::V1_1::IDrmPlugin>& parent, bool emitError = false);
1228     /**
1229      * This performs a checked cast based on what the underlying implementation actually is.
1230      */
1231     static ::android::hardware::Return<::android::sp<::android::hardware::drm::V1_4::IDrmPlugin>> castFrom(const ::android::sp<::android::hardware::drm::V1_0::IDrmPlugin>& parent, bool emitError = false);
1232     /**
1233      * This performs a checked cast based on what the underlying implementation actually is.
1234      */
1235     static ::android::hardware::Return<::android::sp<::android::hardware::drm::V1_4::IDrmPlugin>> castFrom(const ::android::sp<::android::hidl::base::V1_0::IBase>& parent, bool emitError = false);
1236 
1237     // helper methods for interactions with the hwservicemanager
1238     /**
1239      * This gets the service of this type with the specified instance name. If the
1240      * service is currently not available or not in the VINTF manifest on a Trebilized
1241      * device, this will return nullptr. This is useful when you don't want to block
1242      * during device boot. If getStub is true, this will try to return an unwrapped
1243      * passthrough implementation in the same process. This is useful when getting an
1244      * implementation from the same partition/compilation group.
1245      *
1246      * In general, prefer getService(std::string,bool)
1247      */
1248     static ::android::sp<IDrmPlugin> tryGetService(const std::string &serviceName="default", bool getStub=false);
1249     /**
1250      * Deprecated. See tryGetService(std::string, bool)
1251      */
1252     static ::android::sp<IDrmPlugin> tryGetService(const char serviceName[], bool getStub=false)  { std::string str(serviceName ? serviceName : "");      return tryGetService(str, getStub); }
1253     /**
1254      * Deprecated. See tryGetService(std::string, bool)
1255      */
1256     static ::android::sp<IDrmPlugin> tryGetService(const ::android::hardware::hidl_string& serviceName, bool getStub=false)  { std::string str(serviceName.c_str());      return tryGetService(str, getStub); }
1257     /**
1258      * Calls tryGetService("default", bool). This is the recommended instance name for singleton services.
1259      */
tryGetServiceIDrmPlugin1260     static ::android::sp<IDrmPlugin> tryGetService(bool getStub) { return tryGetService("default", getStub); }
1261     /**
1262      * This gets the service of this type with the specified instance name. If the
1263      * service is not in the VINTF manifest on a Trebilized device, this will return
1264      * nullptr. If the service is not available, this will wait for the service to
1265      * become available. If the service is a lazy service, this will start the service
1266      * and return when it becomes available. If getStub is true, this will try to
1267      * return an unwrapped passthrough implementation in the same process. This is
1268      * useful when getting an implementation from the same partition/compilation group.
1269      */
1270     static ::android::sp<IDrmPlugin> getService(const std::string &serviceName="default", bool getStub=false);
1271     /**
1272      * Deprecated. See getService(std::string, bool)
1273      */
1274     static ::android::sp<IDrmPlugin> getService(const char serviceName[], bool getStub=false)  { std::string str(serviceName ? serviceName : "");      return getService(str, getStub); }
1275     /**
1276      * Deprecated. See getService(std::string, bool)
1277      */
1278     static ::android::sp<IDrmPlugin> getService(const ::android::hardware::hidl_string& serviceName, bool getStub=false)  { std::string str(serviceName.c_str());      return getService(str, getStub); }
1279     /**
1280      * Calls getService("default", bool). This is the recommended instance name for singleton services.
1281      */
getServiceIDrmPlugin1282     static ::android::sp<IDrmPlugin> getService(bool getStub) { return getService("default", getStub); }
1283     /**
1284      * Registers a service with the service manager. For Trebilized devices, the service
1285      * must also be in the VINTF manifest.
1286      */
1287     __attribute__ ((warn_unused_result))::android::status_t registerAsService(const std::string &serviceName="default");
1288     /**
1289      * Registers for notifications for when a service is registered.
1290      */
1291     static bool registerForNotifications(
1292             const std::string &serviceName,
1293             const ::android::sp<::android::hidl::manager::V1_0::IServiceNotification> &notification);
1294 };
1295 
1296 //
1297 // type declarations for package
1298 //
1299 
1300 static inline std::string toString(const ::android::sp<::android::hardware::drm::V1_4::IDrmPlugin>& o);
1301 
1302 //
1303 // type header definitions for package
1304 //
1305 
toString(const::android::sp<::android::hardware::drm::V1_4::IDrmPlugin> & o)1306 static inline std::string toString(const ::android::sp<::android::hardware::drm::V1_4::IDrmPlugin>& o) {
1307     std::string os = "[class or subclass of ";
1308     os += ::android::hardware::drm::V1_4::IDrmPlugin::descriptor;
1309     os += "]";
1310     os += o->isRemote() ? "@remote" : "@local";
1311     return os;
1312 }
1313 
1314 
1315 }  // namespace V1_4
1316 }  // namespace drm
1317 }  // namespace hardware
1318 }  // namespace android
1319 
1320 //
1321 // global type declarations for package
1322 //
1323 
1324 
1325 #endif  // HIDL_GENERATED_ANDROID_HARDWARE_DRM_V1_4_IDRMPLUGIN_H
1326