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 17 package 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 */ 30 interface 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 (at) 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 (at) 1.0::IChild", 46 * "android.hardware.foo (at) 1.0::IParent" 47 * "android.hidl.base (at) 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 (at) 1.0; 58 * interface IParent {}; 59 * interface IChild extends IParent {}; 60 * Calling interfaceDescriptor on an IChild object must yield 61 * "android.hardware.foo (at) 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 a previously registered death recipient. 91 * @param recipient a previously registered hidl_death_recipient callback 92 * @return success whether the death recipient was unregistered successfully. 93 */ 94 unlinkToDeath(death_recipient recipient) generates (bool success); 95 96 /* 97 * This method trigger the interface to enable/disable instrumentation based 98 * on system property hal.instrumentation.enable. 99 */ 100 oneway setHALInstrumentation(); 101 102 /* 103 * Get debug information on references on this interface. 104 * @return info debugging information. See comments of DebugInfo. 105 */ 106 getDebugInfo() generates (DebugInfo info); 107 108 /* 109 * Emit diagnostic information to the given file. 110 * 111 * Optionally overriden. 112 * 113 * @param fd File descriptor to dump data to. 114 * Must only be used for the duration of this call. 115 * @param options Arguments for debugging. 116 * Must support empty for default debug information. 117 */ 118 debug(handle fd, vec<string> options); 119 120 /* 121 * Returns hashes of the source HAL files that define the interfaces of the 122 * runtime type information on the object. 123 * For example, for the following interface definition: 124 * package android.hardware.foo (at) 1.0; 125 * interface IParent {}; 126 * interface IChild extends IParent {}; 127 * Calling interfaceChain on an IChild object must yield the following: 128 * [(hash of IChild.hal), 129 * (hash of IParent.hal) 130 * (hash of IBase.hal)]. 131 * 132 * SHA-256 is used as the hashing algorithm. Each hash has 32 bytes 133 * according to SHA-256 standard. 134 * 135 * @return hashchain a vector of SHA-1 digests 136 */ 137 getHashChain() generates (vec<uint8_t[32]> hashchain); 138 }; 139