Add a new API to start HDCP

When SurfaceFlinger detects a secure surface, it can call this
api to inform HWC to start HDCP negotiations.

Bug: 369161085
Test: manual
Change-Id: Idbc90d43a1f64a5457d3da0ca97c5843b0793337
diff --git a/graphics/common/aidl/android/hardware/graphics/common/DisplayHotplugEvent.aidl b/graphics/common/aidl/android/hardware/graphics/common/DisplayHotplugEvent.aidl
index c807ffd..f779105 100644
--- a/graphics/common/aidl/android/hardware/graphics/common/DisplayHotplugEvent.aidl
+++ b/graphics/common/aidl/android/hardware/graphics/common/DisplayHotplugEvent.aidl
@@ -23,23 +23,23 @@
 @Backing(type="int")
 enum DisplayHotplugEvent {
     /**
-     * Display is successfully connected.
-     * Connected may be called more than once and the behavior of subsequent
-     * calls is that SurfaceFlinger queries the display properties again.
+     * Display was successfully connected.
+     * CONNECTED may be emitted more than once and the behavior of subsequent
+     * events is that SurfaceFlinger queries the display properties again.
      */
     CONNECTED = 0,
 
-    /** Display is successfully disconnected */
+    /** Display was successfully disconnected */
     DISCONNECTED = 1,
 
-    /** Display is plugged in, but an unknown error occurred */
+    /** Unknown error occurred */
     ERROR_UNKNOWN = -1,
 
-    /** Display is plugged in, but incompatible cable error detected */
+    /** Display was plugged in, but incompatible cable error detected */
     ERROR_INCOMPATIBLE_CABLE = -2,
 
     /**
-     * Display is plugged in, but exceeds the max number of
+     * Display was plugged in, but exceeds the max number of
      * displays that can be simultaneously connected
      */
     ERROR_TOO_MANY_DISPLAYS = -3,
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl
index 55604a6..adbc344 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl
@@ -88,6 +88,7 @@
   android.hardware.graphics.composer3.DisplayConfiguration[] getDisplayConfigurations(long display, int maxFrameIntervalNs);
   oneway void notifyExpectedPresent(long display, in android.hardware.graphics.composer3.ClockMonotonicTimestamp expectedPresentTime, int frameIntervalNs);
   int getMaxLayerPictureProfiles(long display);
+  oneway void startHdcpNegotiation(long display, in android.hardware.drm.HdcpLevels levels);
   const int EX_BAD_CONFIG = 1;
   const int EX_BAD_DISPLAY = 2;
   const int EX_BAD_LAYER = 3;
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
index edbb988..b4d2e7f 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
@@ -16,6 +16,7 @@
 
 package android.hardware.graphics.composer3;
 
+import android.hardware.drm.HdcpLevels;
 import android.hardware.graphics.common.DisplayDecorationSupport;
 import android.hardware.graphics.common.Hdr;
 import android.hardware.graphics.common.HdrConversionCapability;
@@ -938,4 +939,21 @@
      * pipeline, a value of zero should be returned here.
      */
     int getMaxLayerPictureProfiles(long display);
+
+    /**
+     * Supports HDCP lazy activation.
+     *
+     * When SurfaceFlinger detects secure layers, this method is called to instruct HWC side that
+     * HDCP negotiation process can be started.
+     *
+     * When HDCP is successfully started or failed to start, HWC reports the HDCP levels via
+     * IComposerCallback.onHdcpLevelsChanged().
+     *
+     * @param display is the display whose HDCP negotiation can be started.
+     * @param levels is the desired HDCP levels.
+     *
+     * @see IComposerCallback.onHdcpLevelsChanged
+     *
+     */
+    oneway void startHdcpNegotiation(long display, in HdcpLevels levels);
 }