aboutsummaryrefslogtreecommitdiff
path: root/en/devices/architecture
diff options
context:
space:
mode:
Diffstat (limited to 'en/devices/architecture')
-rw-r--r--en/devices/architecture/hidl-java/index.html12
-rw-r--r--en/devices/architecture/hidl/services.html4
-rw-r--r--en/devices/architecture/hidl/threading.html24
3 files changed, 28 insertions, 12 deletions
diff --git a/en/devices/architecture/hidl-java/index.html b/en/devices/architecture/hidl-java/index.html
index c4218160..45eefc7d 100644
--- a/en/devices/architecture/hidl-java/index.html
+++ b/en/devices/architecture/hidl-java/index.html
@@ -68,8 +68,9 @@ The static version of the library is also available as
<pre class="prettyprint">
import android.hardware.foo.V1_0.IFoo;
...
-IFoo server = IFoo.getService(); // throws exception if not available
-IFoo anotherServer = IFoo.getService("second_impl");
+// retry to wait until the service starts up if it is in the manifest
+IFoo server = IFoo.getService(true /* retry */); // throws NoSuchElementException if not available
+IFoo anotherServer = IFoo.getService("second_impl", true /* retry */);
server.doSomething(&hellip;);
</pre>
</li>
@@ -82,6 +83,9 @@ callbacks from HALs.</p>
<p class=warning><strong>Warning</strong>: Do not implement a driver (HAL) in
Java. We strongly recommend you implement drivers in C++.</p>
+<p class=warning><strong>Warning</strong>: Java drivers must be in a separate
+process from their clients (same process communication is not supported).</p>
+
<p>For interface <code>IFooCallback</code> in version 1.0 of package
<code>android.hardware.foo</code>, you can implement your interface in Java
using the following steps:</p>
@@ -142,7 +146,7 @@ class FooCallback extends IFooCallback.Stub {
....
// Get the service you will be receiving callbacks from.
// This also starts the threadpool for your callback service.
-IFoo server = IFoo.getService(); // throws exception if not available
+IFoo server = IFoo.getService(true /* retry */); // throws NoSuchElementException if not available
....
// This must be a persistent instance variable, not local,
// to avoid premature garbage collection.
@@ -173,7 +177,7 @@ interface IBetterFoo extends IFoo {
extended interface:</p>
<pre class="prettyprint">
-IFoo baseService = Foo.getService();
+IFoo baseService = IFoo.getService(true /* retry */); // throws NoSuchElementException if not available
IBetterFoo extendedService = IBetterFoo.castFrom(baseService);
if (extendedService != null) {
// The service implements the extended interface.
diff --git a/en/devices/architecture/hidl/services.html b/en/devices/architecture/hidl/services.html
index 805bc800..1d2deccb 100644
--- a/en/devices/architecture/hidl/services.html
+++ b/en/devices/architecture/hidl/services.html
@@ -53,10 +53,10 @@ 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");
+sp&lt;V1_1::IFooService&gt; alternateService = V1_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 */);
+V1_1.IFooService; alternateService = V1_1.IFooService.getService("another", true /* retry */);
</pre>
<p>Each version of a HIDL interface is treated as a separate interface. Thus,
diff --git a/en/devices/architecture/hidl/threading.html b/en/devices/architecture/hidl/threading.html
index 5b8fa038..26c2cc12 100644
--- a/en/devices/architecture/hidl/threading.html
+++ b/en/devices/architecture/hidl/threading.html
@@ -48,11 +48,11 @@ available, it blocks until one is available.</p>
<p>If the server has only one thread, then calls into the server are completed
in order. A server with more than one thread may complete calls out of order
-even if the client has only one thread. As <code>oneway</code> calls do not
-block the client, multiple <code>oneway</code> calls may be processed
-simultaneously or out of order by a server with more than one thread, and
-<code>oneway</code> calls may be processed concurrently with a subsequent
-blocking call.</p>
+even if the client has only one thread. However, for a given interface object,
+<code>oneway</code> calls are guaranteed to be ordered (see
+<a href="#model">Server threading model</a>). For a multi-threaded server that
+hosts multiple interfaces, <code>oneway</code> calls to different interfaces
+may be processed concurrently with each other or other blocking calls.</p>
<p>Multiple nested calls will be sent on the same hwbinder thread. For instance,
if a process (A) makes a synchronous call from a hwbinder thread into process (B),
@@ -160,7 +160,19 @@ server returns a <code>Return&lt;void&gt;</code> object.</p>
<h3 id=oneway>Oneway calls</h3>
<p>When a function is marked <code>oneway</code>, the client returns immediately
-and does not wait for the server to complete its function call invocation.</p>
+and does not wait for the server to complete its function call invocation. At the
+surface (and in aggregate), this means the function call takes half the
+time because it is executing half the code, but when writing implementations that
+are performance sensitive, this has some scheduling implications. Normally,
+using a oneway call causes the callee to continue to be scheduled whereas
+using a normal synchronous call causes the scheduler to immediately transfer
+from the callee to the caller process. This is a performance optimization in
+binder. For services where the oneway call must be executed in the target process
+with a high priority, the scheduling policy of the receiving service can be
+changed. In C++, using <code>libhidltransport</code>'s method
+<code>setMinSchedulerPolicy</code> with the scheduler priorities and policies
+defined in <code>sched.h</code> ensures that all calls into the service run at
+least at the set scheduling policy and priority.</p>
</body>
</html>