aboutsummaryrefslogtreecommitdiff
path: root/en/devices/architecture/hidl
diff options
context:
space:
mode:
Diffstat (limited to 'en/devices/architecture/hidl')
-rw-r--r--en/devices/architecture/hidl/services.html14
1 files changed, 14 insertions, 0 deletions
diff --git a/en/devices/architecture/hidl/services.html b/en/devices/architecture/hidl/services.html
index 647555b7..75933ec9 100644
--- a/en/devices/architecture/hidl/services.html
+++ b/en/devices/architecture/hidl/services.html
@@ -51,8 +51,12 @@ into the server.</p>
version, calling <code>getService</code> on the desired HAL class:</p>
<pre class="prettyprint">
+// C++
sp&lt;V1_1::IFooService&gt; service = V1_1::IFooService::getService();
sp&lt;V1_1::IFooService&gt; alternateService = 1_1::IFooService::getService("another_foo_service");
+// Java
+V1_1.IFooService; service = V1_1.IFooService.getService(true /* retry */);
+V1_1.IFooService; alternateService = 1_1.IFooService.getService("another", true /* retry */);
</pre>
<p>Each version of a HIDL interface is treated as a separate interface. Thus,
@@ -69,6 +73,16 @@ returned interface. For an interface <code>IFoo</code> in package
<code>android.hardware.foo</code> in the device manifest if the entry exists;
and if the transport method is not available, nullptr is returned.</p>
+<p> In some cases, it may be necessary to continue immediately even without
+getting the service. This can happen (for instance) when a client wants to
+manage service notifications itself or in a diagnostic program (such as
+<code>atrace</code>) which needs to get all hwservices and retrieve them. In
+this case, additional APIs are provided such as <code>tryGetService</code> in C++ or
+<code>getService("instance-name", false)</code> in Java. The legacy API
+<code>getService</code> provided in Java also must be used with service
+notifications. Using this API does not avoid the race condition where a server
+registers itself after the client requests it with one of these no-retry APIs.</p>
+
<h2 id=death>Service death notifications</h2>
<p>Clients who want to be notified when a service dies can receive death
notifications delivered by the framework. To receive notifications, the client