Introduce new endpoint lifecycle interfaces for ContextHub v4
Test: build
Flag: N/A
Bug: 361830233
Change-Id: Iaf187213998807407a8dde38d2a6916ab44a4716
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IEndpointCallback.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IEndpointCallback.aidl
index 53194b8..c0bb744 100644
--- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IEndpointCallback.aidl
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IEndpointCallback.aidl
@@ -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);
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/Reason.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/Reason.aidl
index 6aa81b6..a315438 100644
--- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/Reason.aidl
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/Reason.aidl
@@ -41,5 +41,6 @@
CLOSE_ENDPOINT_SESSION_REQUESTED,
ENDPOINT_INVALID,
ENDPOINT_GONE,
+ ENDPOINT_CRASHED,
HUB_RESET,
}
diff --git a/contexthub/aidl/android/hardware/contexthub/IEndpointCallback.aidl b/contexthub/aidl/android/hardware/contexthub/IEndpointCallback.aidl
index ee2a4ee..972853b 100644
--- a/contexthub/aidl/android/hardware/contexthub/IEndpointCallback.aidl
+++ b/contexthub/aidl/android/hardware/contexthub/IEndpointCallback.aidl
@@ -26,6 +26,34 @@
@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.
*
diff --git a/contexthub/aidl/android/hardware/contexthub/Reason.aidl b/contexthub/aidl/android/hardware/contexthub/Reason.aidl
index cb82822..65d9f8a 100644
--- a/contexthub/aidl/android/hardware/contexthub/Reason.aidl
+++ b/contexthub/aidl/android/hardware/contexthub/Reason.aidl
@@ -55,6 +55,11 @@
ENDPOINT_GONE,
/**
+ * Endpoint crashed.
+ */
+ ENDPOINT_CRASHED,
+
+ /**
* Hub was reset or is resetting.
*/
HUB_RESET,