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

Commit cf23435a authored by Anthony Stange's avatar Anthony Stange Committed by Android (Google) Code Review
Browse files

Merge changes from topic "ctx_hal_update"

* changes:
  Add support for new APIs in default/vts code
  Add APIs for Contexthub NAN support
parents 06c97aa8 7344af9e
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;
}
+4 −0
Original line number Diff line number Diff line
@@ -87,6 +87,10 @@ ScopedAStatus ContextHub::getPreloadedNanoappIds(std::vector<int64_t>* out_prelo
    return ndk::ScopedAStatus::ok();
}

ScopedAStatus ContextHub::onNanSessionStateChanged(bool /*sin_state*/) {
    return ndk::ScopedAStatus::ok();
}

ScopedAStatus ContextHub::registerCallback(int32_t in_contextHubId,
                                           const std::shared_ptr<IContextHubCallback>& in_cb) {
    if (in_contextHubId == kMockHubId) {
Loading