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

Commit 6b424755 authored by Yifei Zhang's avatar Yifei Zhang
Browse files

Introduce new endpoint lifecycle interfaces for ContextHub v4

Test: build
Flag: N/A
Bug: 361830233
Change-Id: Iaf187213998807407a8dde38d2a6916ab44a4716
parent 87a65103
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@
package android.hardware.contexthub;
@VintfStability
interface IEndpointCallback {
  void onEndpointStarted(in android.hardware.contexthub.EndpointInfo[] endpointInfos);
  void onEndpointStopped(in android.hardware.contexthub.EndpointId[] endpointIds, android.hardware.contexthub.Reason reason);
  void onMessageReceived(int sessionId, in android.hardware.contexthub.Message msg);
  void onMessageDeliveryStatusReceived(int sessionId, in android.hardware.contexthub.MessageDeliveryStatus msgStatus);
  void onEndpointSessionOpenRequest(int sessionId, in android.hardware.contexthub.EndpointId destination, in android.hardware.contexthub.EndpointId initiator, in @nullable String serviceDescriptor);
+1 −0
Original line number Diff line number Diff line
@@ -41,5 +41,6 @@ enum Reason {
  CLOSE_ENDPOINT_SESSION_REQUESTED,
  ENDPOINT_INVALID,
  ENDPOINT_GONE,
  ENDPOINT_CRASHED,
  HUB_RESET,
}
+28 −0
Original line number Diff line number Diff line
@@ -25,6 +25,34 @@ import android.hardware.contexthub.Service;

@VintfStability
interface IEndpointCallback {
    /**
     * Lifecycle event notification for endpoint starting from remote side. There is no need to
     * report already started endpoint prior to the registration of an EndpointLifecycleCallbacks
     * object. The EndpointInfo reported here should be consistent with values from getEndpoints().
     *
     * Endpoints added by registerEndpoint should not be included. registerEndpoint() should not
     * cause this call.
     *
     * @param endpointInfos An array of EndpointInfo representing endpoints that just started.
     */
    void onEndpointStarted(in EndpointInfo[] endpointInfos);

    /**
     * Lifecycle event notification for endpoint stopping from remote side. There is no need to
     * report already stopped endpoint prior to the registration of an EndpointLifecycleCallbacks
     * object. The EndpointId reported here should represent a previously started Endpoint.
     *
     * When a hub crashes or restart, events should be batched into be a single call (containing all
     * the EndpointId that were impacted).
     *
     * Endpoints added by registerEndpoint should not be included. unregisterEndpoint() should not
     * cause this call.
     *
     * @param endpointIds An array of EndpointId representing endpoints that just stopped.
     * @param reason The reason for why the endpoints stopped.
     */
    void onEndpointStopped(in EndpointId[] endpointIds, Reason reason);

    /**
     * Invoked when an endpoint sends message to another endpoint (on host) on the (currently open)
     * session.
+5 −0
Original line number Diff line number Diff line
@@ -54,6 +54,11 @@ enum Reason {
     */
    ENDPOINT_GONE,

    /**
     * Endpoint crashed.
     */
    ENDPOINT_CRASHED,

    /**
     * Hub was reset or is resetting.
     */