cec: use vendor property for device & remove unneeded properties

* Use vendor property to allow labeling it for SELinux.
* Remove unneeded properties to set version and vendor id. Using the
  default values in any case.
This commit is contained in:
Konsta
2025-03-22 01:48:55 +02:00
parent 47a329c4e4
commit 3022586712
6 changed files with 10 additions and 19 deletions

View File

@@ -29,9 +29,7 @@
#include "HdmiCec.h"
#define PROPERTY_CEC_DEVICE "persist.hdmi.cec_device"
#define PROPERTY_CEC_VERSION "ro.hdmi.cec_version"
#define PROPERTY_VENDOR_ID "ro.hdmi.vendor_id"
#define PROPERTY_CEC_DEVICE "persist.vendor.hdmi.cec_device"
using android::base::GetProperty;
using ndk::ScopedAStatus;
@@ -75,8 +73,8 @@ ScopedAStatus HdmiCec::addLogicalAddress(CecLogicalAddress addr, Result* _aidl_r
return ScopedAStatus::ok();
}
cecLogAddrs.cec_version = getCecVersion();
cecLogAddrs.vendor_id = getVendorId();
cecLogAddrs.cec_version = CEC_OP_CEC_VERSION_1_4;
cecLogAddrs.vendor_id = 0x000c03; // HDMI LLC vendor ID
unsigned int logAddrType = CEC_LOG_ADDR_TYPE_UNREGISTERED;
unsigned int allDevTypes = 0;
@@ -166,12 +164,8 @@ ScopedAStatus HdmiCec::enableAudioReturnChannel(int32_t portId __unused, bool en
return ScopedAStatus::ok();
}
int32_t HdmiCec::getCecVersion() {
return property_get_int32(PROPERTY_CEC_VERSION, CEC_OP_CEC_VERSION_1_4);
}
ScopedAStatus HdmiCec::getCecVersion(int32_t* _aidl_return) {
*_aidl_return = getCecVersion();
*_aidl_return = CEC_OP_CEC_VERSION_1_4;
return ScopedAStatus::ok();
}
@@ -189,12 +183,8 @@ ScopedAStatus HdmiCec::getPhysicalAddress(int32_t* _aidl_return) {
return ScopedAStatus::ok();
}
uint32_t HdmiCec::getVendorId() {
return property_get_int32(PROPERTY_VENDOR_ID, 0x000c03 /* HDMI LLC vendor ID */);
}
ScopedAStatus HdmiCec::getVendorId(int32_t* _aidl_return) {
*_aidl_return = getVendorId();
*_aidl_return = 0x000c03; // HDMI LLC vendor ID
return ScopedAStatus::ok();
}

View File

@@ -89,9 +89,6 @@ struct HdmiCec : public BnHdmiCec {
*/
bool mCecControlEnabled;
int32_t getCecVersion();
uint32_t getVendorId();
std::shared_ptr<IHdmiCecCallback> mCallback;
};

View File

@@ -1 +1,2 @@
allow hal_tv_hdmi_cec_default cec_device:chr_file rw_file_perms;
get_prop(hal_tv_hdmi_cec_default, vendor_hdmi_config_prop)

1
sepolicy/property.te Normal file
View File

@@ -0,0 +1 @@
vendor_internal_prop(vendor_hdmi_config_prop)

View File

@@ -0,0 +1,2 @@
# CEC
persist.vendor.hdmi.cec_device u:object_r:vendor_hdmi_config_prop:s0

View File

@@ -38,7 +38,7 @@ media.settings.xml=/vendor/etc/media_profiles_V1_0.xml
ro.hardware.camera=libcamera
# CEC
persist.hdmi.cec_device=cec0
persist.vendor.hdmi.cec_device=cec0
ro.hdmi.device_type=4
# Chipset