From 6e4a22068fc53e89c213aa70ff2d2aa6d80e157b Mon Sep 17 00:00:00 2001 From: Brian Stack Date: Tue, 11 Dec 2018 13:39:07 -0800 Subject: [PATCH] Update documentation for initialize() Updates the documentation for the initialize() function and defines the requirements for using the Event FMQ's writeBlocking function which requires both a read and write notification. Also adds requirement for the Sensors HAL to cleanup active sensor requests and direct connections whenever initialize is called. Bug: 120857563 Test: Builds Change-Id: I11c8f7404d27e9ab21f9314523faebc1970b9f0c --- sensors/2.0/ISensors.hal | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/sensors/2.0/ISensors.hal b/sensors/2.0/ISensors.hal index 939bf73715..1685a0a11c 100644 --- a/sensors/2.0/ISensors.hal +++ b/sensors/2.0/ISensors.hal @@ -77,11 +77,20 @@ interface ISensors { * framework. The Event FMQ is created using the eventQueueDescriptor. * Data may only be written to the Event FMQ. Data must not be read from * the Event FMQ since the framework is the only reader. Upon receiving - * sensor events, the HAL should write the sensor events to the Event FMQ. + * sensor events, the HAL writes the sensor events to the Event FMQ. + * * Once the HAL is finished writing sensor events to the Event FMQ, the HAL - * must call the Event FMQ's EventFlag wake() function with the - * EventQueueFlagBits::READ_AND_PROCESS mask which notifies the framework - * that sensor events are available to be read and processed. + * must notify the framework that sensor events are available to be read and + * processed. This is accomplished by either: + * 1) Calling the Event FMQ’s EventFlag::wake() function with + EventQueueFlagBits::READ_AND_PROCESS + * 2) Setting the write notification in the Event FMQ’s writeBlocking() + * function to EventQueueFlagBits::READ_AND_PROCESS. + * + * If the Event FMQ’s writeBlocking() function is used, the read + * notification must be set to EventQueueFlagBits::EVENTS_READ in order to + * be notified and unblocked when the framework has successfully read events + * from the Event FMQ. * * The Wake Lock FMQ is used by the framework to notify the HAL when it is * safe to release its wake_lock. When the framework receives WAKE_UP events @@ -110,6 +119,10 @@ interface ISensors { * any outstanding wake_locks held as a result of WAKE_UP events should be * released. * + * All active sensor requests and direct channels must be closed and + * properly cleaned up when initialize is called in order to ensure that the + * HAL and framework's state is consistent (e.g. after a runtime restart). + * * initialize must be thread safe and prevent concurrent calls * to initialize from simultaneously modifying state. *