IBase.hal 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. package [email protected];
  17. /*
  18. * The ancestor for all interfaces.
  19. *
  20. * All HAL files will have this interface implicitly imported. If an interface
  21. * does not explicitly extend from another interface, it will implicitly extend
  22. * from IBase. (This is like java.lang.Object in Java.)
  23. *
  24. * Methods defined here are shared by all interfaces (this is like
  25. * java.lang.Object.notify(), for example.) However, the behavior of these
  26. * functions cannot be overridden (with the exception of the "debug" method).
  27. */
  28. interface IBase {
  29. /*
  30. * Provides way to determine if interface is running without requesting
  31. * any functionality.
  32. */
  33. ping();
  34. /*
  35. * Provides run-time type information for this object.
  36. * For example, for the following interface definition:
  37. * package [email protected];
  38. * interface IParent {};
  39. * interface IChild extends IParent {};
  40. * Calling interfaceChain on an IChild object must yield the following:
  41. * ["[email protected]::IChild",
  42. * "[email protected]::IParent"
  43. * "[email protected]::IBase"]
  44. *
  45. * @return descriptors a vector of descriptors of the run-time type of the
  46. * object.
  47. */
  48. interfaceChain() generates (vec<string> descriptors);
  49. /*
  50. * Provides run-time type information for this object.
  51. * For example, for the following interface definition:
  52. * package [email protected];
  53. * interface IParent {};
  54. * interface IChild extends IParent {};
  55. * Calling interfaceDescriptor on an IChild object must yield
  56. * "[email protected]::IChild"
  57. *
  58. * @return descriptor a descriptor of the run-time type of the
  59. * object (the first element of the vector returned by
  60. * interfaceChain())
  61. */
  62. interfaceDescriptor() generates (string descriptor);
  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. * Registers a death recipient, to be called when the process hosting this
  74. * interface dies.
  75. *
  76. * @param recipient a hidl_death_recipient callback object
  77. * @param cookie a cookie that must be returned with the callback
  78. * @return success whether the death recipient was registered successfully.
  79. */
  80. linkToDeath(death_recipient recipient, uint64_t cookie) generates (bool success);
  81. /*
  82. * Unregisters the registered death recipient. If this service was registered
  83. * multiple times with the same exact death recipient, this unlinks the most
  84. * recently registered one.
  85. *
  86. * @param recipient a previously registered hidl_death_recipient callback
  87. * @return success whether the death recipient was unregistered successfully.
  88. */
  89. unlinkToDeath(death_recipient recipient) generates (bool success);
  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. * Get debug information on references on this interface.
  97. * @return info debugging information. See comments of DebugInfo.
  98. */
  99. getDebugInfo() generates (DebugInfo info);
  100. /*
  101. * Emit diagnostic information to the given file.
  102. *
  103. * Optionally overriden.
  104. *
  105. * @param fd File descriptor to dump data to.
  106. * Must only be used for the duration of this call.
  107. * @param options Arguments for debugging.
  108. * Must support empty for default debug information.
  109. */
  110. debug(handle fd, vec<string> options);
  111. /*
  112. * Returns hashes of the source HAL files that define the interfaces of the
  113. * runtime type information on the object.
  114. * For example, for the following interface definition:
  115. * package [email protected];
  116. * interface IParent {};
  117. * interface IChild extends IParent {};
  118. * Calling interfaceChain on an IChild object must yield the following:
  119. * [(hash of IChild.hal),
  120. * (hash of IParent.hal)
  121. * (hash of IBase.hal)].
  122. *
  123. * SHA-256 is used as the hashing algorithm. Each hash has 32 bytes
  124. * according to SHA-256 standard.
  125. *
  126. * @return hashchain a vector of SHA-1 digests
  127. */
  128. getHashChain() generates (vec<uint8_t[32]> hashchain);
  129. };