Introduce new endpoint lifecycle interfaces for ContextHub v4

Test: build
Flag: N/A
Bug: 361830233
Merged-In: Iaf187213998807407a8dde38d2a6916ab44a4716
Change-Id: Iaf187213998807407a8dde38d2a6916ab44a4716
This commit is contained in:
Yifei Zhang
2024-10-18 13:28:45 -07:00
committed by Brian Duddie
parent 9563436f27
commit c377627143
4 changed files with 36 additions and 0 deletions

View File

@@ -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);

View File

@@ -41,5 +41,6 @@ enum Reason {
CLOSE_ENDPOINT_SESSION_REQUESTED,
ENDPOINT_INVALID,
ENDPOINT_GONE,
ENDPOINT_CRASHED,
HUB_RESET,
}

View File

@@ -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.

View File

@@ -54,6 +54,11 @@ enum Reason {
*/
ENDPOINT_GONE,
/**
* Endpoint crashed.
*/
ENDPOINT_CRASHED,
/**
* Hub was reset or is resetting.
*/