From 2ae7fb6e5528bcca8b1f11c75fefa10d1bbbd04b Mon Sep 17 00:00:00 2001 From: Huihong Luo Date: Fri, 27 Sep 2024 18:15:51 +0000 Subject: [PATCH] Separate hdcp levels into a base interface Both media drm and HWC can share this common base code. Run the following commands to freeze the aidl: (1) m android.hardware.drm.common-update-api && m android.hardware.drm.common-freeze-api (2) system/tools/aidl/build/hash_gen.sh hardware/interfaces/drm/aidl/aidl_api/android.hardware.drm/1 latest-version hardware/interfaces/drm/aidl/aidl_api/android.hardware.drm/1/.hash Bug: 293945485 Test: manual (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5ed36814bb242bf5da663b1360eb096bc34f0e79) Merged-In: I9e90ada03144b49245dc6b55a0fb2fa2eb6f3893 Change-Id: I9e90ada03144b49245dc6b55a0fb2fa2eb6f3893 --- drm/aidl/Android.bp | 6 +- .../aidl_api/android.hardware.drm/1/.hash | 1 + .../android/hardware/drm/EventType.aidl | 10 +-- .../android/hardware/drm/KeyRequestType.aidl | 12 +-- .../android/hardware/drm/KeyStatusType.aidl | 12 +-- .../current/android/hardware/drm/KeyType.aidl | 6 +- .../android/hardware/drm/LogPriority.aidl | 16 ++-- .../hardware/drm/OfflineLicenseState.aidl | 6 +- .../android/hardware/drm/SecurityLevel.aidl | 14 ++-- .../current/android/hardware/drm/Status.aidl | 80 +++++++++---------- drm/aidl/vts/Android.bp | 11 ++- drm/common/aidl/Android.bp | 35 ++++++++ .../android.hardware.drm.common/1/.hash | 1 + .../1/android/hardware/drm/HdcpLevel.aidl | 16 ++-- .../1/android/hardware/drm/HdcpLevels.aidl | 0 .../android/hardware/drm/HdcpLevel.aidl | 16 ++-- .../android/hardware/drm/HdcpLevels.aidl | 0 .../aidl/android/hardware/drm/HdcpLevel.aidl | 0 .../aidl/android/hardware/drm/HdcpLevels.aidl | 0 19 files changed, 145 insertions(+), 97 deletions(-) create mode 100644 drm/common/aidl/Android.bp create mode 100644 drm/common/aidl/aidl_api/android.hardware.drm.common/1/.hash rename drm/{aidl/aidl_api/android.hardware.drm => common/aidl/aidl_api/android.hardware.drm.common}/1/android/hardware/drm/HdcpLevel.aidl (92%) rename drm/{aidl/aidl_api/android.hardware.drm => common/aidl/aidl_api/android.hardware.drm.common}/1/android/hardware/drm/HdcpLevels.aidl (100%) rename drm/{aidl/aidl_api/android.hardware.drm => common/aidl/aidl_api/android.hardware.drm.common}/current/android/hardware/drm/HdcpLevel.aidl (92%) rename drm/{aidl/aidl_api/android.hardware.drm => common/aidl/aidl_api/android.hardware.drm.common}/current/android/hardware/drm/HdcpLevels.aidl (100%) rename drm/{ => common}/aidl/android/hardware/drm/HdcpLevel.aidl (100%) rename drm/{ => common}/aidl/android/hardware/drm/HdcpLevels.aidl (100%) diff --git a/drm/aidl/Android.bp b/drm/aidl/Android.bp index afcb603db7..99780dc6bd 100644 --- a/drm/aidl/Android.bp +++ b/drm/aidl/Android.bp @@ -14,6 +14,7 @@ aidl_interface { stability: "vintf", imports: [ "android.hardware.common-V2", + "android.hardware.drm.common-V1", ], backend: { cpp: { @@ -30,7 +31,10 @@ aidl_interface { versions_with_info: [ { version: "1", - imports: ["android.hardware.common-V2"], + imports: [ + "android.hardware.common-V2", + "android.hardware.drm.common-V1", + ], }, ], diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/.hash b/drm/aidl/aidl_api/android.hardware.drm/1/.hash index 886e28c0cb..9a735e93d6 100644 --- a/drm/aidl/aidl_api/android.hardware.drm/1/.hash +++ b/drm/aidl/aidl_api/android.hardware.drm/1/.hash @@ -1 +1,2 @@ 7b4b0a0f36a7a6bb22d2016375e4a9d4a033592f +3a0197fb44863256da9034c26e721b1eee12d1be diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/EventType.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/EventType.aidl index 80ebb285ae..f09eadd127 100644 --- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/EventType.aidl +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/EventType.aidl @@ -34,9 +34,9 @@ package android.hardware.drm; @Backing(type="int") @VintfStability enum EventType { - PROVISION_REQUIRED = 0, - KEY_NEEDED = 1, - KEY_EXPIRED = 2, - VENDOR_DEFINED = 3, - SESSION_RECLAIMED = 4, + PROVISION_REQUIRED, + KEY_NEEDED, + KEY_EXPIRED, + VENDOR_DEFINED, + SESSION_RECLAIMED, } diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyRequestType.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyRequestType.aidl index 34b9615c55..556ee3863f 100644 --- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyRequestType.aidl +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyRequestType.aidl @@ -34,10 +34,10 @@ package android.hardware.drm; @Backing(type="int") @VintfStability enum KeyRequestType { - INITIAL = 0, - RENEWAL = 1, - RELEASE = 2, - UNKNOWN = 3, - NONE = 4, - UPDATE = 5, + INITIAL, + RENEWAL, + RELEASE, + UNKNOWN, + NONE, + UPDATE, } diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyStatusType.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyStatusType.aidl index 261516f8ef..5a46552541 100644 --- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyStatusType.aidl +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyStatusType.aidl @@ -34,10 +34,10 @@ package android.hardware.drm; @Backing(type="int") @VintfStability enum KeyStatusType { - USABLE = 0, - EXPIRED = 1, - OUTPUT_NOT_ALLOWED = 2, - STATUS_PENDING = 3, - INTERNAL_ERROR = 4, - USABLE_IN_FUTURE = 5, + USABLE, + EXPIRED, + OUTPUT_NOT_ALLOWED, + STATUS_PENDING, + INTERNAL_ERROR, + USABLE_IN_FUTURE, } diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyType.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyType.aidl index 7a9d633578..e677c8692f 100644 --- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyType.aidl +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/KeyType.aidl @@ -34,7 +34,7 @@ package android.hardware.drm; @Backing(type="int") @VintfStability enum KeyType { - OFFLINE = 0, - STREAMING = 1, - RELEASE = 2, + OFFLINE, + STREAMING, + RELEASE, } diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/LogPriority.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/LogPriority.aidl index 83362c359f..b77ddf6134 100644 --- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/LogPriority.aidl +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/LogPriority.aidl @@ -34,12 +34,12 @@ package android.hardware.drm; @Backing(type="int") @VintfStability enum LogPriority { - UNKNOWN = 0, - DEFAULT = 1, - VERBOSE = 2, - DEBUG = 3, - INFO = 4, - WARN = 5, - ERROR = 6, - FATAL = 7, + UNKNOWN, + DEFAULT, + VERBOSE, + DEBUG, + INFO, + WARN, + ERROR, + FATAL, } diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/OfflineLicenseState.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/OfflineLicenseState.aidl index 629564d706..be0e822720 100644 --- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/OfflineLicenseState.aidl +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/OfflineLicenseState.aidl @@ -34,7 +34,7 @@ package android.hardware.drm; @Backing(type="int") @VintfStability enum OfflineLicenseState { - UNKNOWN = 0, - USABLE = 1, - INACTIVE = 2, + UNKNOWN, + USABLE, + INACTIVE, } diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SecurityLevel.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SecurityLevel.aidl index 65b2b9d2ae..87b3641909 100644 --- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SecurityLevel.aidl +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SecurityLevel.aidl @@ -34,11 +34,11 @@ package android.hardware.drm; @Backing(type="int") @VintfStability enum SecurityLevel { - UNKNOWN = 0, - SW_SECURE_CRYPTO = 1, - SW_SECURE_DECODE = 2, - HW_SECURE_CRYPTO = 3, - HW_SECURE_DECODE = 4, - HW_SECURE_ALL = 5, - DEFAULT = 6, + UNKNOWN, + SW_SECURE_CRYPTO, + SW_SECURE_DECODE, + HW_SECURE_CRYPTO, + HW_SECURE_DECODE, + HW_SECURE_ALL, + DEFAULT, } diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Status.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Status.aidl index c64068958f..a3ba6c3e7d 100644 --- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Status.aidl +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/Status.aidl @@ -34,44 +34,44 @@ package android.hardware.drm; @Backing(type="int") @VintfStability enum Status { - OK = 0, - ERROR_DRM_NO_LICENSE = 1, - ERROR_DRM_LICENSE_EXPIRED = 2, - ERROR_DRM_SESSION_NOT_OPENED = 3, - ERROR_DRM_CANNOT_HANDLE = 4, - ERROR_DRM_INVALID_STATE = 5, - BAD_VALUE = 6, - ERROR_DRM_NOT_PROVISIONED = 7, - ERROR_DRM_RESOURCE_BUSY = 8, - ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION = 9, - ERROR_DRM_DEVICE_REVOKED = 10, - ERROR_DRM_DECRYPT = 11, - ERROR_DRM_UNKNOWN = 12, - ERROR_DRM_INSUFFICIENT_SECURITY = 13, - ERROR_DRM_FRAME_TOO_LARGE = 14, - ERROR_DRM_SESSION_LOST_STATE = 15, - ERROR_DRM_RESOURCE_CONTENTION = 16, - CANNOT_DECRYPT_ZERO_SUBSAMPLES = 17, - CRYPTO_LIBRARY_ERROR = 18, - GENERAL_OEM_ERROR = 19, - GENERAL_PLUGIN_ERROR = 20, - INIT_DATA_INVALID = 21, - KEY_NOT_LOADED = 22, - LICENSE_PARSE_ERROR = 23, - LICENSE_POLICY_ERROR = 24, - LICENSE_RELEASE_ERROR = 25, - LICENSE_REQUEST_REJECTED = 26, - LICENSE_RESTORE_ERROR = 27, - LICENSE_STATE_ERROR = 28, - MALFORMED_CERTIFICATE = 29, - MEDIA_FRAMEWORK_ERROR = 30, - MISSING_CERTIFICATE = 31, - PROVISIONING_CERTIFICATE_ERROR = 32, - PROVISIONING_CONFIGURATION_ERROR = 33, - PROVISIONING_PARSE_ERROR = 34, - PROVISIONING_REQUEST_REJECTED = 35, - RETRYABLE_PROVISIONING_ERROR = 36, - SECURE_STOP_RELEASE_ERROR = 37, - STORAGE_READ_FAILURE = 38, - STORAGE_WRITE_FAILURE = 39, + OK, + ERROR_DRM_NO_LICENSE, + ERROR_DRM_LICENSE_EXPIRED, + ERROR_DRM_SESSION_NOT_OPENED, + ERROR_DRM_CANNOT_HANDLE, + ERROR_DRM_INVALID_STATE, + BAD_VALUE, + ERROR_DRM_NOT_PROVISIONED, + ERROR_DRM_RESOURCE_BUSY, + ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION, + ERROR_DRM_DEVICE_REVOKED, + ERROR_DRM_DECRYPT, + ERROR_DRM_UNKNOWN, + ERROR_DRM_INSUFFICIENT_SECURITY, + ERROR_DRM_FRAME_TOO_LARGE, + ERROR_DRM_SESSION_LOST_STATE, + ERROR_DRM_RESOURCE_CONTENTION, + CANNOT_DECRYPT_ZERO_SUBSAMPLES, + CRYPTO_LIBRARY_ERROR, + GENERAL_OEM_ERROR, + GENERAL_PLUGIN_ERROR, + INIT_DATA_INVALID, + KEY_NOT_LOADED, + LICENSE_PARSE_ERROR, + LICENSE_POLICY_ERROR, + LICENSE_RELEASE_ERROR, + LICENSE_REQUEST_REJECTED, + LICENSE_RESTORE_ERROR, + LICENSE_STATE_ERROR, + MALFORMED_CERTIFICATE, + MEDIA_FRAMEWORK_ERROR, + MISSING_CERTIFICATE, + PROVISIONING_CERTIFICATE_ERROR, + PROVISIONING_CONFIGURATION_ERROR, + PROVISIONING_PARSE_ERROR, + PROVISIONING_REQUEST_REJECTED, + RETRYABLE_PROVISIONING_ERROR, + SECURE_STOP_RELEASE_ERROR, + STORAGE_READ_FAILURE, + STORAGE_WRITE_FAILURE, } diff --git a/drm/aidl/vts/Android.bp b/drm/aidl/vts/Android.bp index 5139036493..27ce0d7816 100644 --- a/drm/aidl/vts/Android.bp +++ b/drm/aidl/vts/Android.bp @@ -47,6 +47,7 @@ cc_test { ], static_libs: [ "android.hardware.drm@1.0-helper", + "android.hardware.drm.common-V1-ndk", "android.hardware.drm-V1-ndk", "android.hardware.common-V2-ndk", "libaidlcommonsupport", @@ -59,13 +60,19 @@ cc_test { data: [":libvtswidevine-arm-prebuilts"], }, arm64: { - data: [":libvtswidevine-arm64-prebuilts", ":libvtswidevine-arm-prebuilts"], + data: [ + ":libvtswidevine-arm64-prebuilts", + ":libvtswidevine-arm-prebuilts", + ], }, x86: { data: [":libvtswidevine-x86-prebuilts"], }, x86_64: { - data: [":libvtswidevine-x86_64-prebuilts", ":libvtswidevine-x86-prebuilts"], + data: [ + ":libvtswidevine-x86_64-prebuilts", + ":libvtswidevine-x86-prebuilts", + ], }, }, test_suites: [ diff --git a/drm/common/aidl/Android.bp b/drm/common/aidl/Android.bp new file mode 100644 index 0000000000..1e4b8e0cc4 --- /dev/null +++ b/drm/common/aidl/Android.bp @@ -0,0 +1,35 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +aidl_interface { + name: "android.hardware.drm.common", + vendor_available: true, + srcs: ["android/hardware/drm/*.aidl"], + stability: "vintf", + backend: { + cpp: { + enabled: false, + }, + java: { + sdk_version: "module_current", + }, + ndk: { + min_sdk_version: "34", + }, + }, + double_loadable: true, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + frozen: true, + +} diff --git a/drm/common/aidl/aidl_api/android.hardware.drm.common/1/.hash b/drm/common/aidl/aidl_api/android.hardware.drm.common/1/.hash new file mode 100644 index 0000000000..66690e1a7e --- /dev/null +++ b/drm/common/aidl/aidl_api/android.hardware.drm.common/1/.hash @@ -0,0 +1 @@ +1b5e9159609b3aa05e2c7158f3a1488fda2250d1 diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/HdcpLevel.aidl b/drm/common/aidl/aidl_api/android.hardware.drm.common/1/android/hardware/drm/HdcpLevel.aidl similarity index 92% rename from drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/HdcpLevel.aidl rename to drm/common/aidl/aidl_api/android.hardware.drm.common/1/android/hardware/drm/HdcpLevel.aidl index 5704fb0726..118bef68c3 100644 --- a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/HdcpLevel.aidl +++ b/drm/common/aidl/aidl_api/android.hardware.drm.common/1/android/hardware/drm/HdcpLevel.aidl @@ -34,12 +34,12 @@ package android.hardware.drm; @Backing(type="int") @VintfStability enum HdcpLevel { - HDCP_UNKNOWN = 0, - HDCP_NONE = 1, - HDCP_V1 = 2, - HDCP_V2 = 3, - HDCP_V2_1 = 4, - HDCP_V2_2 = 5, - HDCP_NO_OUTPUT = 6, - HDCP_V2_3 = 7, + HDCP_UNKNOWN, + HDCP_NONE, + HDCP_V1, + HDCP_V2, + HDCP_V2_1, + HDCP_V2_2, + HDCP_NO_OUTPUT, + HDCP_V2_3, } diff --git a/drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/HdcpLevels.aidl b/drm/common/aidl/aidl_api/android.hardware.drm.common/1/android/hardware/drm/HdcpLevels.aidl similarity index 100% rename from drm/aidl/aidl_api/android.hardware.drm/1/android/hardware/drm/HdcpLevels.aidl rename to drm/common/aidl/aidl_api/android.hardware.drm.common/1/android/hardware/drm/HdcpLevels.aidl diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/HdcpLevel.aidl b/drm/common/aidl/aidl_api/android.hardware.drm.common/current/android/hardware/drm/HdcpLevel.aidl similarity index 92% rename from drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/HdcpLevel.aidl rename to drm/common/aidl/aidl_api/android.hardware.drm.common/current/android/hardware/drm/HdcpLevel.aidl index 5704fb0726..118bef68c3 100644 --- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/HdcpLevel.aidl +++ b/drm/common/aidl/aidl_api/android.hardware.drm.common/current/android/hardware/drm/HdcpLevel.aidl @@ -34,12 +34,12 @@ package android.hardware.drm; @Backing(type="int") @VintfStability enum HdcpLevel { - HDCP_UNKNOWN = 0, - HDCP_NONE = 1, - HDCP_V1 = 2, - HDCP_V2 = 3, - HDCP_V2_1 = 4, - HDCP_V2_2 = 5, - HDCP_NO_OUTPUT = 6, - HDCP_V2_3 = 7, + HDCP_UNKNOWN, + HDCP_NONE, + HDCP_V1, + HDCP_V2, + HDCP_V2_1, + HDCP_V2_2, + HDCP_NO_OUTPUT, + HDCP_V2_3, } diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/HdcpLevels.aidl b/drm/common/aidl/aidl_api/android.hardware.drm.common/current/android/hardware/drm/HdcpLevels.aidl similarity index 100% rename from drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/HdcpLevels.aidl rename to drm/common/aidl/aidl_api/android.hardware.drm.common/current/android/hardware/drm/HdcpLevels.aidl diff --git a/drm/aidl/android/hardware/drm/HdcpLevel.aidl b/drm/common/aidl/android/hardware/drm/HdcpLevel.aidl similarity index 100% rename from drm/aidl/android/hardware/drm/HdcpLevel.aidl rename to drm/common/aidl/android/hardware/drm/HdcpLevel.aidl diff --git a/drm/aidl/android/hardware/drm/HdcpLevels.aidl b/drm/common/aidl/android/hardware/drm/HdcpLevels.aidl similarity index 100% rename from drm/aidl/android/hardware/drm/HdcpLevels.aidl rename to drm/common/aidl/android/hardware/drm/HdcpLevels.aidl