1/*
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.cas@1.0;
17
18import android.hardware.cas@1.0::ICas;
19import android.hardware.cas@1.0::ICasListener;
20import android.hardware.cas@1.0::IDescramblerBase;
21
22/**
23 * IMediaCasService is the main entry point for interacting with a vendor's
24 * cas HAL to create cas and descrambler plugin instances. A cas plugin instance
25 * opens cas sessions which are used to obtain keys for a descrambler session,
26 * which can in turn be used to descramble protected video content.
27 */
28interface IMediaCasService {
29    /**
30     * List all available CA systems on the device.
31     *
32     * @return descriptors an array of descriptors for the available CA systems.
33     */
34    enumeratePlugins() generates (vec<HidlCasPluginDescriptor> descriptors);
35
36    /**
37     * Query if a certain CA system is supported on this device.
38     *
39     * @param CA_system_id the id of the CA system.
40     * @return result whether the specified CA system is supported on this device.
41     */
42    isSystemIdSupported(int32_t CA_system_id) generates (bool result);
43
44    /**
45     * Construct a new instance of a CasPlugin given a CA_system_id.
46     *
47     * @param CA_system_id the id of the CA system.
48     * @param listener the event listener to receive events coming from the CasPlugin.
49     * @return cas the newly created CasPlugin interface.
50     */
51    createPlugin(int32_t CA_system_id, ICasListener listener) generates (ICas cas);
52
53    /**
54     * Query if the descrambling scheme for a CA system is supported on this device.
55     *
56     * @param CA_system_id the id of the CA system.
57     * @return result whether the specified descrambling scheme is supported on this device.
58     */
59    isDescramblerSupported(int32_t CA_system_id) generates (bool result);
60
61    /**
62     * Construct a new instance of a DescramblerPlugin given a CA_system_id.
63     *
64     * @param CA_system_id the id of the CA system.
65     * @return descrambler the newly created plugin interface.
66     */
67    createDescrambler(int32_t CA_system_id) generates (IDescramblerBase descrambler);
68};
69