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