IBase.hal revision 0dd8c3b50f1b197a9b40d30367c9f0705e702180
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 (with the exception of the "debug" method).
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     * Get debug information on references on this interface.
98     * @return info debugging information. See comments of DebugInfo.
99     */
100    getDebugInfo() generates (DebugInfo info);
101
102    /*
103     * Emit diagnostic information to the given file.
104     *
105     * Optionally overriden.
106     *
107     * @param fd      File descriptor to dump data to.
108     *                Must only be used for the duration of this call.
109     * @param options Arguments for debugging.
110     *                Must support empty for default debug information.
111     */
112    debug(handle fd, vec<string> options);
113};
114