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 way to determine if interface is running without requesting 34 * any functionality. 35 */ 36 ping(); 37 38 /* 39 * Provides run-time type information for this object. 40 * For example, for the following interface definition: 41 * package android.hardware.foo@1.0; 42 * interface IParent {}; 43 * interface IChild extends IParent {}; 44 * Calling interfaceChain on an IChild object must yield the following: 45 * ["android.hardware.foo@1.0::IChild", 46 * "android.hardware.foo@1.0::IParent" 47 * "android.hidl.base@1.0::IBase"] 48 * 49 * @return descriptors a vector of descriptors of the run-time type of the 50 * object. 51 */ 52 interfaceChain() generates (vec<string> descriptors); 53 54 /* 55 * Provides run-time type information for this object. 56 * For example, for the following interface definition: 57 * package android.hardware.foo@1.0; 58 * interface IParent {}; 59 * interface IChild extends IParent {}; 60 * Calling interfaceDescriptor on an IChild object must yield 61 * "android.hardware.foo@1.0::IChild" 62 * 63 * @return descriptor a descriptor of the run-time type of the 64 * object (the first element of the vector returned by 65 * interfaceChain()) 66 */ 67 interfaceDescriptor() generates (string descriptor); 68 69 /* 70 * This method notifies the interface that one or more system properties 71 * have changed. The default implementation calls 72 * (C++) report_sysprop_change() in libcutils or 73 * (Java) android.os.SystemProperties.reportSyspropChanged, 74 * which in turn calls a set of registered callbacks (eg to update trace 75 * tags). 76 */ 77 oneway notifySyspropsChanged(); 78 79 /* 80 * Registers a death recipient, to be called when the process hosting this 81 * interface dies. 82 * 83 * @param recipient a hidl_death_recipient callback object 84 * @param cookie a cookie that must be returned with the callback 85 * @return success whether the death recipient was registered successfully. 86 */ 87 linkToDeath(death_recipient recipient, uint64_t cookie) generates (bool success); 88 89 /* 90 * Unregisters the registered death recipient. If this service was registered 91 * multiple times with the same exact death recipient, this unlinks the most 92 * recently registered one. 93 * 94 * @param recipient a previously registered hidl_death_recipient callback 95 * @return success whether the death recipient was unregistered successfully. 96 */ 97 unlinkToDeath(death_recipient recipient) generates (bool success); 98 99 /* 100 * This method trigger the interface to enable/disable instrumentation based 101 * on system property hal.instrumentation.enable. 102 */ 103 oneway setHALInstrumentation(); 104 105 /* 106 * Get debug information on references on this interface. 107 * @return info debugging information. See comments of DebugInfo. 108 */ 109 getDebugInfo() generates (DebugInfo info); 110 111 /* 112 * Emit diagnostic information to the given file. 113 * 114 * Optionally overriden. 115 * 116 * @param fd File descriptor to dump data to. 117 * Must only be used for the duration of this call. 118 * @param options Arguments for debugging. 119 * Must support empty for default debug information. 120 */ 121 debug(handle fd, vec<string> options); 122 123 /* 124 * Returns hashes of the source HAL files that define the interfaces of the 125 * runtime type information on the object. 126 * For example, for the following interface definition: 127 * package android.hardware.foo@1.0; 128 * interface IParent {}; 129 * interface IChild extends IParent {}; 130 * Calling interfaceChain on an IChild object must yield the following: 131 * [(hash of IChild.hal), 132 * (hash of IParent.hal) 133 * (hash of IBase.hal)]. 134 * 135 * SHA-256 is used as the hashing algorithm. Each hash has 32 bytes 136 * according to SHA-256 standard. 137 * 138 * @return hashchain a vector of SHA-1 digests 139 */ 140 getHashChain() generates (vec<uint8_t[32]> hashchain); 141}; 142