1/**
2 * Copyright (C) 2018 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
17package [email protected];
18
19import @1.0::KeyStatusType;
20import @1.0::Status;
21import @1.1::HdcpLevel;
22
23enum OfflineLicenseState : uint32_t {
24    /**
25     * Offline license state is unknown
26     */
27    UNKNOWN,
28
29    /**
30     * Offline license state is usable, the keys are usable for decryption.
31     */
32    USABLE,
33
34    /**
35     * Offline license state is inactive, the keys have been marked for
36     * release using {@link #getKeyRequest} with KEY_TYPE_RELEASE but the
37     * key response has not been received.
38     */
39    INACTIVE
40};
41
42enum Status : @1.0::Status {
43    /**
44     * The drm HAL module must return ERROR_DRM_INSUFFICIENT_SECURITY
45     * from the crypto plugin decrypt method when the security level
46     * of the device is not sufficient to meet the requirements in the
47     * license policy.
48     */
49    ERROR_DRM_INSUFFICIENT_SECURITY,
50
51    /**
52     * The drm HAL module must return ERROR_FRAME_TOO_LARGE from the
53     * decrypt method when the frame being decrypted into the secure
54     * output buffer exceeds the size of the buffer.
55     */
56    ERROR_DRM_FRAME_TOO_LARGE,
57
58    /**
59     * This error must be returned from any session method when an
60     * attempt is made to use the session after the crypto hardware
61     * state has been invalidated. Some devices are not able to
62     * retain crypto session state across device suspend/resume which
63     * results in invalid session state.
64     */
65    ERROR_DRM_SESSION_LOST_STATE,
66
67     /**
68      * The drm HAL module must return this error if client
69      * applications using the hal are temporarily exceeding the
70      * capacity of available crypto resources such that a retry of
71      * the operation is likely to succeed.
72      */
73    ERROR_DRM_RESOURCE_CONTENTION,
74};
75
76/**
77 * HDCP specifications are defined by Digital Content Protection LLC (DCP).
78 *   "HDCP Specification Rev. 2.3 Interface Independent Adaptation"
79 *   "HDCP 2.3 on HDMI Specification"
80 */
81enum HdcpLevel : @1.1::HdcpLevel {
82    /**
83     * HDCP version 2.3 Type 1.
84     */
85    HDCP_V2_3
86};
87
88
89/**
90 * KeySetId is an identifier that references a set of keys in an
91 * offline license. The keySetId is created by the HAL implementation
92 * and returned from provideKeyResponse and getOfflineLicenseIds. The
93 * framework passes KeySetId back to the HAL when referring to the key
94 * set in methods that take a KeySetId as an input parameter.
95 */
96typedef vec<uint8_t> KeySetId;
97
98enum KeyStatusType : @1.0::KeyStatusType {
99    /**
100     * The key is not yet usable to decrypt media because the start
101     * time is in the future. The key must become usable when
102     * its start time is reached.
103     */
104    USABLEINFUTURE
105};
106
107/**
108 * Used by sendKeysChange_1_2 to report the usability status of each key to the
109 * app.
110 *
111 * This struct only differs from @1.0 version by the addition of new
112 * KeyStatusType(s).
113 *
114 */
115struct KeyStatus {
116    KeySetId keyId;
117    KeyStatusType type;
118};
119