1/**
2 * Copyright (C) 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package android.hardware.drm@1.4;
17
18import @1.0::Status;
19import @1.0::SessionId;
20import @1.1::SecurityLevel;
21import @1.2::IDrmPlugin;
22import @1.4::LogMessage;
23import @1.4::Status;
24
25/**
26 * IDrmPlugin is used to interact with a specific drm plugin that was
27 * created by IDrmFactory::createPlugin. A drm plugin provides methods for
28 * obtaining drm keys to be used by a codec to decrypt protected video
29 * content.
30 */
31interface IDrmPlugin extends @1.2::IDrmPlugin {
32
33    /**
34     * Check if the specified mime-type & security level require a secure decoder
35     * component.
36     *
37     * @param mime The content mime-type
38     * @param level the requested security level
39     * @return secureRequired must be true if and only if a secure decoder is required
40     * for the specified mime-type & security level
41     */
42    requiresSecureDecoder(string mime, @1.1::SecurityLevel level) generates (bool secureRequired);
43
44    /**
45     * Check if the specified mime-type requires a secure decoder component
46     * at the highest security level supported on the device.
47     *
48     * @param mime The content mime-type
49     * @return secureRequired must be true if and only if a secure decoder is required
50     * for the specified mime-type
51     */
52    requiresSecureDecoderDefault(string mime) generates (bool secureRequired);
53
54    /**
55     * Set playback id of a drm session. The playback id can be used to join drm session metrics
56     * with metrics from other low level media components, e.g. codecs, or metrics from the high
57     * level player.
58     *
59     * @param sessionId drm session id
60     * @param playbackId high level playback id
61     * @return status the status of the call. The status must be OK on success, or
62     *     ERROR_DRM_SESSION_NOT_OPENED if the drm session cannot be found
63     */
64    setPlaybackId(SessionId sessionId, string playbackId) generates (@1.0::Status status);
65
66    /**
67     * @return logMessages latest plugin level log messages. Can be used
68     *     by apps in diagnosis of errors.
69     * @return status the status of the call. The status must be:
70     *     OK on success;
71     *     GENERAL_OEM_ERROR on OEM-provided, low-level component failures;
72     *     GENERAL_PLUGIN_ERROR on unexpected plugin-level errors.
73     */
74    getLogMessages() generates (@1.4::Status status, vec<LogMessage> logMessages);
75
76};
77