Add a new api to support HDCP

A special HDCP level change callback is reported.

Bug: 293945485
Test: manual
Change-Id: I096554a9e1f69c3dba7c7da58917f2b498ae8726
This commit is contained in:
Huihong Luo
2023-12-13 10:07:22 -08:00
parent e5e76c734e
commit 3a42a8a09d
8 changed files with 32 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ package {
aidl_interface {
name: "android.hardware.drm.common",
host_supported: true,
vendor_available: true,
srcs: ["android/hardware/drm/*.aidl"],
stability: "vintf",
@@ -22,6 +23,9 @@ aidl_interface {
ndk: {
min_sdk_version: "34",
},
rust: {
enabled: true,
},
},
double_loadable: true,
versions_with_info: [

View File

@@ -53,6 +53,7 @@ cc_defaults {
cc_defaults {
name: "android.hardware.graphics.composer3-ndk_static",
static_libs: [
"android.hardware.drm.common-V1-ndk",
"android.hardware.graphics.composer3-V4-ndk",
],
}
@@ -60,6 +61,7 @@ cc_defaults {
cc_defaults {
name: "android.hardware.graphics.composer3-ndk_shared",
shared_libs: [
"android.hardware.drm.common-V1-ndk",
"android.hardware.graphics.composer3-V4-ndk",
],
}

View File

@@ -37,6 +37,7 @@ aidl_interface {
imports: [
"android.hardware.graphics.common-V5",
"android.hardware.common-V2",
"android.hardware.drm.common-V1",
],
backend: {
cpp: {

View File

@@ -45,4 +45,5 @@ interface IComposerCallback {
oneway void onVsyncIdle(long display);
oneway void onRefreshRateChangedDebug(in android.hardware.graphics.composer3.RefreshRateChangedDebugData data);
void onHotplugEvent(long display, android.hardware.graphics.common.DisplayHotplugEvent event);
oneway void onHdcpLevelsChanged(long display, in android.hardware.drm.HdcpLevels levels);
}

View File

@@ -16,6 +16,7 @@
package android.hardware.graphics.composer3;
import android.hardware.drm.HdcpLevels;
import android.hardware.graphics.common.DisplayHotplugEvent;
import android.hardware.graphics.composer3.RefreshRateChangedDebugData;
import android.hardware.graphics.composer3.VsyncPeriodChangeTimeline;
@@ -139,4 +140,12 @@ interface IComposerCallback {
* @param event is the type of event that occurred.
*/
void onHotplugEvent(long display, DisplayHotplugEvent event);
/**
* Notify the client the HDCP levels of the display changed.
*
* @param display is the display whose HDCP levels have changed.
* @param levels is the new HDCP levels.
*/
oneway void onHdcpLevelsChanged(long display, in HdcpLevels levels);
}

View File

@@ -66,6 +66,7 @@ cc_test {
"android.hardware.graphics.common@1.2",
"android.hardware.common-V2-ndk",
"android.hardware.common.fmq-V1-ndk",
"android.hardware.drm.common-V1-ndk",
"libaidlcommonsupport",
"libarect",
"libbase",

View File

@@ -208,4 +208,15 @@ int32_t GraphicsComposerCallback::getInvalidRefreshRateDebugEnabledCallbackCount
}
}
::ndk::ScopedAStatus GraphicsComposerCallback::onHdcpLevelsChanged(
int64_t in_display, const ::aidl::android::hardware::drm::HdcpLevels&) {
std::scoped_lock lock(mMutex);
const auto it = std::find(mDisplays.begin(), mDisplays.end(), in_display);
if (it != mDisplays.end()) {
mHdcpLevelChangedCount++;
}
return ::ndk::ScopedAStatus::ok();
}
} // namespace aidl::android::hardware::graphics::composer3::vts

View File

@@ -65,6 +65,8 @@ class GraphicsComposerCallback : public BnComposerCallback {
const RefreshRateChangedDebugData&) override;
virtual ::ndk::ScopedAStatus onHotplugEvent(int64_t in_display,
common::DisplayHotplugEvent) override;
virtual ::ndk::ScopedAStatus onHdcpLevelsChanged(
int64_t in_display, const ::aidl::android::hardware::drm::HdcpLevels&) override;
mutable std::mutex mMutex;
// the set of all currently connected displays
@@ -88,6 +90,7 @@ class GraphicsComposerCallback : public BnComposerCallback {
int32_t mInvalidVsyncPeriodChangeCount GUARDED_BY(mMutex) = 0;
int32_t mInvalidSeamlessPossibleCount GUARDED_BY(mMutex) = 0;
int32_t mInvalidRefreshRateDebugEnabledCallbackCount GUARDED_BY(mMutex) = 0;
int32_t mHdcpLevelChangedCount GUARDED_BY(mMutex) = 0;
};
} // namespace aidl::android::hardware::graphics::composer3::vts