blob: f14b983ef8f758b05d49a0e19d91923602c4cf42 [file] [log] [blame]
Jeff Tinker1637e002017-12-07 19:20:12 -08001/**
2 * Copyright (C) 2017 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 */
16package android.hardware.drm@1.1;
17
18import @1.0::IDrmPlugin;
19import @1.0::IDrmPluginListener;
Rahul Frias173d4fb2018-01-22 23:32:36 -080020import @1.0::KeyedVector;
21import @1.0::KeyType;
Jeff Tinker1637e002017-12-07 19:20:12 -080022import @1.0::Status;
23import @1.1::HdcpLevel;
Rahul Frias173d4fb2018-01-22 23:32:36 -080024import @1.1::KeyRequestType;
Jeff Tinker1637e002017-12-07 19:20:12 -080025import @1.1::SecurityLevel;
26
27/**
28 * IDrmPlugin is used to interact with a specific drm plugin that was created by
29 * IDrm::createPlugin. A drm plugin provides methods for obtaining drm keys that
30 * may be used by a codec to decrypt protected video content.
31 */
32interface IDrmPlugin extends @1.0::IDrmPlugin {
33 /**
Rahul Frias173d4fb2018-01-22 23:32:36 -080034 * A key request/response exchange occurs between the app and a License
35 * Server to obtain the keys required to decrypt the content.
36 * getKeyRequest_1_1() is used to obtain an opaque key request blob that is
37 * delivered to the license server.
38 *
39 * getKeyRequest_1_1() only differs from getKeyRequest() in that additional
40 * values are returned in 1.1::KeyRequestType as compared to
41 * 1.0::KeyRequestType
42 *
43 * @param scope may be a sessionId or a keySetId, depending on the
44 * specified keyType. When the keyType is OFFLINE or STREAMING,
45 * scope should be set to the sessionId the keys will be provided
46 * to. When the keyType is RELEASE, scope should be set to the
47 * keySetId of the keys being released.
48 * @param initData container-specific data, its meaning is interpreted
49 * based on the mime type provided in the mimeType parameter.
50 * It could contain, for example, the content ID, key ID or
51 * other data obtained from the content metadata that is
52 * required to generate the key request. initData may be empty
53 * when keyType is RELEASE.
54 * @param mimeType identifies the mime type of the content
55 * @param keyType specifies if the keys are to be used for streaming,
56 * offline or a release
57 * @param optionalParameters included in the key request message to
58 * allow a client application to provide additional message
59 * parameters to the server.
60 * @return status the status of the call. The status must be OK or one of
61 * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the
62 * session is not opened, ERROR_DRM_NOT_PROVISIONED if the device
63 * requires provisioning before it can generate a key request,
64 * ERROR_DRM_CANNOT_HANDLE if getKeyRequest is not supported
65 * at the time of the call, BAD_VALUE if any parameters are
66 * invalid or ERROR_DRM_INVALID_STATE if the HAL is in a
67 * state where a key request cannot be generated.
68 * @return request if successful, the opaque key request blob is returned
69 * @return requestType indicates type information about the returned
70 * request. The type may be one of INITIAL, RENEWAL, RELEASE,
71 * NONE or UPDATE. An INITIAL request is the first key request
72 * for a license. RENEWAL is a subsequent key request used to
73 * refresh the keys in a license. RELEASE corresponds to a
74 * keyType of RELEASE, which indicates keys are being released.
75 * NONE indicates that no request is needed because the keys are
76 * already loaded. UPDATE indicates that the keys need to be
77 * refetched after the initial license request.
78 * @return defaultUrl the URL that the request may be sent to, if
79 * provided by the drm HAL. The app may choose to override this URL.
80 */
81 getKeyRequest_1_1(vec<uint8_t> scope, vec<uint8_t> initData,
82 string mimeType, KeyType keyType, KeyedVector optionalParameters)
83 generates (Status status, vec<uint8_t> request,
84 KeyRequestType requestType, string defaultUrl);
85
86 /**
Jeff Tinker1637e002017-12-07 19:20:12 -080087 * Return the currently negotiated and max supported HDCP levels.
88 *
89 * The current level is based on the display(s) the device is connected to.
90 * If multiple HDCP-capable displays are simultaneously connected to
91 * separate interfaces, this method returns the lowest negotiated HDCP level
92 * of all interfaces.
93 *
94 * The maximum HDCP level is the highest level that can potentially be
95 * negotiated. It is a constant for any device, i.e. it does not depend on
96 * downstream receiving devices that could be connected. For example, if
97 * the device has HDCP 1.x keys and is capable of negotiating HDCP 1.x, but
98 * does not have HDCP 2.x keys, then the maximum HDCP capability would be
99 * reported as 1.x. If multiple HDCP-capable interfaces are present, it
100 * indicates the highest of the maximum HDCP levels of all interfaces.
101 *
102 * This method should only be used for informational purposes, not for
103 * enforcing compliance with HDCP requirements. Trusted enforcement of HDCP
104 * policies must be handled by the DRM system.
105 *
106 * @return status the status of the call. The status must be OK or
107 * ERROR_DRM_INVALID_STATE if the HAL is in a state where the HDCP
108 * level cannot be queried.
109 * @return connectedLevel the lowest HDCP level for any connected
110 * displays
111 * @return maxLevel the highest HDCP level that can be supported
112 * by the device
113 */
114 getHdcpLevels() generates (Status status, HdcpLevel connectedLevel,
115 HdcpLevel maxLevel);
116
117 /**
118 * Return the current number of open sessions and the maximum number of
119 * sessions that may be opened simultaneosly among all DRM instances for the
120 * active DRM scheme.
121 *
122 * @return status the status of the call. The status must be OK or
123 * ERROR_DRM_INVALID_STATE if the HAL is in a state where number of
124 * sessions cannot be queried.
125 * @return currentSessions the number of currently opened sessions
126 * @return maxSessions the maximum number of sessions that the device
127 * can support
128 */
129 getNumberOfSessions() generates (Status status, uint32_t currentSessions,
130 uint32_t maxSessions);
131
132 /**
133 * Return the current security level of a session. A session has an initial
134 * security level determined by the robustness of the DRM system's
135 * implementation on the device.
136 *
137 * @param sessionId the session id the call applies to
138 * @return status the status of the call. The status must be OK or one of
139 * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the
140 * session is not opened, BAD_VALUE if the sessionId is invalid or
141 * ERROR_DRM_INVALID_STATE if the HAL is in a state where the
142 * security level cannot be queried.
143 * @return level the current security level for the session
144 */
145 getSecurityLevel(vec<uint8_t> sessionId) generates(Status status,
146 SecurityLevel level);
147
148 /**
149 * Set the security level of a session. This can be useful if specific
150 * attributes of a lower security level are needed by an application, such
151 * as image manipulation or compositing which requires non-secure decoded
152 * frames. Reducing the security level may limit decryption to lower content
153 * resolutions, depending on the license policy.
154 *
155 * @param sessionId the session id the call applies to
156 * @param level the requested security level
157 * @return status the status of the call. The status must be OK or one of
158 * the following errors: ERROR_DRM_SESSION_NOT_OPENED if the session
159 * is not opened, BAD_VALUE if the sessionId or security level is
160 * invalid or ERROR_DRM_INVALID_STATE if the HAL is in a state where
161 * the security level cannot be set.
162 */
163 setSecurityLevel(vec<uint8_t> sessionId, SecurityLevel level)
164 generates(Status status);
165};