1/*
2 * Copyright (C) 2016 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 android.hardware.drm@1.0;
18
19import android.hardware.drm@1.0::types;
20
21/**
22 * Ref: frameworks/native/include/media/drm/DrmAPI.h:DrmPluginListener
23 */
24
25/**
26 * IDrmPluginListener is a listener interface for Drm events sent from an
27 * IDrmPlugin instance.
28 */
29interface IDrmPluginListener {
30
31    /**
32     * Legacy event sending method, it sends events of various types using a
33     * single overloaded set of parameters. This form is deprecated.
34     *
35     * @param eventType the type of the event
36     * @param sessionId identifies the session the event originated from
37     * @param data event-specific data blob
38     */
39    oneway sendEvent(EventType eventType, SessionId sessionId,
40            vec<uint8_t> data);
41
42    /**
43     * Send a license expiration update to the listener. The expiration
44     * update indicates how long the current keys are valid before they
45     * need to be renewed.
46     *
47     * @param sessionId identifies the session the event originated from
48     * @param expiryTimeInMS the time when the keys need to be renewed.
49     * The time is in milliseconds, relative to the Unix epoch. A time
50     * of 0 indicates that the keys never expire.
51     */
52    oneway sendExpirationUpdate(SessionId sessionId, int64_t expiryTimeInMS);
53
54    /**
55     * Send a keys change event to the listener. The keys change event
56     * indicates the status of each key in the session. Keys can be
57     * indicated as being usable, expired, outputnotallowed or statuspending.
58     *
59     * @param sessionId identifies the session the event originated from
60     * @param keyStatusList indicates the status for each key ID in the
61     * session.
62     * @param hasNewUsableKey indicates if the event includes at least one
63     * key that has become usable.
64     */
65    oneway sendKeysChange(SessionId sessionId, vec<KeyStatus> keyStatusList,
66            bool hasNewUsableKey);
67};
68