IBase.hal revision 1f6b31425030bf4d9527b833ac865e53b64172b5
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.hidl.base@1.0;
18
19/*
20 * The ancestor for all interfaces.
21 *
22 * All HAL files will have this interface implicitly imported. If an interface
23 * does not explicitly extend from another interface, it will implicitly extend
24 * from IBase. (This is like java.lang.Object in Java.)
25 *
26 * Methods defined here are shared by all interfaces (this is like
27 * java.lang.Object.notify(), for example.) However, the behavior of these
28 * functions cannot be overridden.
29 */
30interface IBase {
31
32    /*
33     * Provides run-time type information for this object.
34     * For example, for the following interface definition:
35     *     package android.hardware.foo@1.0;
36     *     interface IParent {};
37     *     interface IChild extends IParent {};
38     * Calling interfaceChain on an IChild object will yield the following:
39     *     ["android.hardware.foo@1.0::IChild",
40     *      "android.hardware.foo@1.0::IParent"
41     *      "android.hidl.base@1.0::IBase"]
42     *
43     * @return descriptors a vector of descriptors of the run-time type of the
44     *         object.
45     */
46    interfaceChain() generates (vec<string> descriptors);
47
48    /*
49     * Provides run-time type information for this object.
50     * For example, for the following interface definition:
51     *     package android.hardware.foo@1.0;
52     *     interface IParent {};
53     *     interface IChild extends IParent {};
54     * Calling interfaceDescriptor on an IChild object will yield
55     *     "android.hardware.foo@1.0::IChild"
56     *
57     * @return descriptor a descriptor of the run-time type of the
58     *         object (the first element of the vector returned by
59     *         interfaceChain())
60     */
61    interfaceDescriptor() generates (string descriptor);
62
63    /*
64     * This method notifies the interface that one or more system properties
65     * have changed. The default implementation calls
66     * (C++)  report_sysprop_change() in libcutils or
67     * (Java) android.os.SystemProperties.reportSyspropChanged,
68     * which in turn calls a set of registered callbacks (eg to update trace
69     * tags).
70     */
71    oneway notifySyspropsChanged();
72
73    /*
74     * Registers a death recipient, to be called when the process hosting this
75     * interface dies.
76     *
77     * @param recipient a hidl_death_recipient callback object
78     * @param cookie a cookie that must be returned with the callback
79     * @return success whether the death recipient was registered successfully.
80     */
81    linkToDeath(death_recipient recipient, uint64_t cookie) generates (bool success);
82
83    /*
84     * Unregisters a previously registered death recipient.
85     * @param recipient a previously registered hidl_death_recipient callback
86     * @return success whether the death recipient was unregistered successfully.
87     */
88    unlinkToDeath(death_recipient recipient) generates (bool success);
89
90    /*
91     * This method trigger the interface to enable/disable instrumentation based
92     * on system property hal.instrumentation.enable.
93     */
94    oneway setHALInstrumentation();
95
96};
97