Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84f02c13 authored by Anthony Stange's avatar Anthony Stange
Browse files

Add APIs for Contexthub NAN support

With current hardware limitations, WiFi chips are unable to support NAN
session initialization without assistance of the WiFi framework.

Update the Contexthub HAL APIs to allow Contexthubs to request the
framework enable a NAN session on their behalf so they can make low
power NAN requests to the initialized session without waking the main
CPU.

Bug: 229888878
Test: Update Contexthub HAL
Change-Id: I47a6a1b0512099727c7343542c2aff814dc0d59a
parent fb317fdd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -46,5 +46,6 @@ interface IContextHub {
  void onHostEndpointConnected(in android.hardware.contexthub.HostEndpointInfo hostEndpointInfo);
  void onHostEndpointDisconnected(char hostEndpointId);
  long[] getPreloadedNanoappIds();
  void onNanSessionStateChanged(in boolean state);
  const int EX_CONTEXT_HUB_UNSPECIFIED = -1;
}
+2 −0
Original line number Diff line number Diff line
@@ -38,4 +38,6 @@ interface IContextHubCallback {
  void handleContextHubMessage(in android.hardware.contexthub.ContextHubMessage msg, in String[] msgContentPerms);
  void handleContextHubAsyncEvent(in android.hardware.contexthub.AsyncEventType evt);
  void handleTransactionResult(in int transactionId, in boolean success);
  void handleNanSessionRequest(in boolean enable);
  const int CONTEXTHUB_NAN_TRANSACTION_TIMEOUT_MS = 10000;
}
+13 −0
Original line number Diff line number Diff line
@@ -203,6 +203,19 @@ interface IContextHub {
     */
    long[] getPreloadedNanoappIds();

    /**
     * Invoked when the state of the NAN session requested through handleNanSessionRequest()
     * changes. This function may be invoked without a corresponding handleNanSessionRequest to
     * indicate if a NAN session was terminated without a request due to resource limitations.
     *
     * If the state becomes disabled without an explicit request from the HAL, the HAL MUST
     * explicitly invoke handleNanSessionRequest() at a later point in time to attempt to
     * re-enable NAN.
     *
     * @param state True if the NAN session is currently enabled.
     */
    void onNanSessionStateChanged(in boolean state);

    /**
     * Error codes that are used as service specific errors with the AIDL return
     * value EX_SERVICE_SPECIFIC.
+21 −0
Original line number Diff line number Diff line
@@ -74,4 +74,25 @@ interface IContextHubCallback {
     *
     */
    void handleTransactionResult(in int transactionId, in boolean success);

    /**
     * This callback is passed by the Contexthub service to the HAL implementation to allow the HAL
     * to request a WiFi NAN session is created to allow the Contexthub to be able to utilize NAN
     * functionality.
     *
     * onNanSessionStateChanged() will be invoked asynchronously after the NAN session request has
     * been completed. This must be done within CONTEXTHUB_NAN_TRANSACTION_TIMEOUT_MS. If the
     * request times out, onNanSessionStateChanged() will be invoked with the state that the session
     * was previously in.
     *
     * @param enable Whether the NAN session should be enabled or disabled depending on whether the
     *        Contexthub needs access to NAN.
     */
    void handleNanSessionRequest(in boolean enable);

    /**
     * Amount of time, in milliseconds, that a handleNanSessionRequest can be pending before the
     * Contexthub service must respond.
     */
    const int CONTEXTHUB_NAN_TRANSACTION_TIMEOUT_MS = 10000;
}