sm6150-common: livedisplay: Make supported interfaces configurable

Change-Id: I2949134f978d3c9b619ae55d3ac41a9b62e65d9c
This commit is contained in:
Arian 2023-08-21 22:53:01 +02:00
parent 87ab8162d7
commit 5d9b716f90
6 changed files with 64 additions and 7 deletions

View File

@ -161,6 +161,14 @@ include device/qcom/sepolicy_vndr-legacy-um/SEPolicy.mk
SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS += $(COMMON_PATH)/sepolicy/private
BOARD_VENDOR_SEPOLICY_DIRS += $(COMMON_PATH)/sepolicy/vendor
# Soong
SOONG_CONFIG_NAMESPACES += xiaomiSm6150Vars
SOONG_CONFIG_xiaomiSm6150Vars += \
livedisplay_support_anti_flicker \
livedisplay_support_sunlight_enhancement
SOONG_CONFIG_xiaomiSm6150Vars_livedisplay_support_anti_flicker ?= false
SOONG_CONFIG_xiaomiSm6150Vars_livedisplay_support_sunlight_enhancement ?= true
# Trust
TARGET_TRUST_USB_CONTROL_PATH := /sys/devices/platform/soc/a600000.ssusb/usb_data_enabled
TARGET_TRUST_USB_CONTROL_ENABLE := 0

View File

@ -13,9 +13,44 @@
// See the License for the specific language governing permissions and
// limitations under the License.
soong_config_module_type {
name: "livedisplay_supported_interfaces",
module_type: "cc_defaults",
config_namespace: "xiaomiSm6150Vars",
bool_variables: [
"livedisplay_support_anti_flicker",
"livedisplay_support_sunlight_enhancement",
],
properties: [
"cflags",
"vintf_fragments",
],
}
livedisplay_supported_interfaces {
name: "livedisplay_supported_interfaces_defaults",
soong_config_variables: {
livedisplay_support_anti_flicker: {
cflags: ["-DSUPPORT_ANTI_FLICKER"],
vintf_fragments: [
"vendor.lineage.livedisplay@2.1_IAntiFlicker.xml",
],
},
livedisplay_support_sunlight_enhancement: {
cflags: ["-DSUPPORT_SUNLIGHT_ENHANCEMENT"],
vintf_fragments: [
"vendor.lineage.livedisplay@2.1_ISunlightEnhancement.xml",
],
},
},
}
cc_binary {
name: "vendor.lineage.livedisplay@2.1-service.xiaomi_sm6150",
defaults: ["hidl_defaults"],
defaults: [
"hidl_defaults",
"livedisplay_supported_interfaces_defaults",
],
vintf_fragments: ["vendor.lineage.livedisplay@2.1-service.xiaomi_sm6150.xml"],
init_rc: ["vendor.lineage.livedisplay@2.1-service.xiaomi_sm6150.rc"],
relative_install_path: "hw",

View File

@ -32,27 +32,29 @@ using ::vendor::lineage::livedisplay::V2_1::implementation::AntiFlicker;
using ::vendor::lineage::livedisplay::V2_1::implementation::SunlightEnhancement;
int main() {
android::sp<IAntiFlicker> antiFlicker = new AntiFlicker();
android::sp<ISunlightEnhancement> sunlightEnhancement = new SunlightEnhancement();
std::shared_ptr<SDMController> controller = std::make_shared<SDMController>();
android::sp<PictureAdjustment> pictureAdjustment = new PictureAdjustment(controller);
android::hardware::configureRpcThreadpool(1, true /*callerWillJoin*/);
#ifdef SUPPORT_ANTI_FLICKER
android::sp<IAntiFlicker> antiFlicker = new AntiFlicker();
if (antiFlicker->registerAsService() != android::OK) {
LOG(ERROR) << "Cannot register anti flicker HAL service.";
return 1;
}
#endif
if (pictureAdjustment->registerAsService() != android::OK) {
LOG(ERROR) << "Cannot register picture adjustment HAL service.";
return 1;
}
#ifdef SUPPORT_SUNLIGHT_ENHANCEMENT
android::sp<ISunlightEnhancement> sunlightEnhancement = new SunlightEnhancement();
if (sunlightEnhancement->registerAsService() != android::OK) {
LOG(ERROR) << "Cannot register sunlight enhancement HAL service.";
return 1;
}
#endif
LOG(INFO) << "LiveDisplay HAL service is ready.";
android::hardware::joinRpcThreadpool();

View File

@ -3,7 +3,5 @@
<name>vendor.lineage.livedisplay</name>
<transport>hwbinder</transport>
<fqname>@2.0::IPictureAdjustment/default</fqname>
<fqname>@2.1::IAntiFlicker/default</fqname>
<fqname>@2.1::ISunlightEnhancement/default</fqname>
</hal>
</manifest>

View File

@ -0,0 +1,7 @@
<manifest version="1.0" type="device">
<hal format="hidl">
<name>vendor.lineage.livedisplay</name>
<transport>hwbinder</transport>
<fqname>@2.1::IAntiFlicker/default</fqname>
</hal>
</manifest>

View File

@ -0,0 +1,7 @@
<manifest version="1.0" type="device">
<hal format="hidl">
<name>vendor.lineage.livedisplay</name>
<transport>hwbinder</transport>
<fqname>@2.1::ISunlightEnhancement/default</fqname>
</hal>
</manifest>