From 2bd35f62c1cd84a015e5617f6407234c47fca4cc Mon Sep 17 00:00:00 2001 From: Michael Bestas Date: Thu, 24 Apr 2025 23:00:03 +0300 Subject: [PATCH] config: Move USB restrictions to select() Change-Id: I0dd6ccca2493ac50019d7d077c25302d62ea4ab3 --- build/soong/Android.bp | 27 --------------------------- config/BoardConfigSoong.mk | 22 ++++++++++++---------- 2 files changed, 12 insertions(+), 37 deletions(-) diff --git a/build/soong/Android.bp b/build/soong/Android.bp index 14d3ce9c..78f0eba7 100644 --- a/build/soong/Android.bp +++ b/build/soong/Android.bp @@ -111,33 +111,6 @@ gralloc_10_usage_bits { }, } -soong_config_module_type { - name: "trust_usb_control", - module_type: "cc_defaults", - config_namespace: "lineageGlobalVars", - value_variables: [ - "target_trust_usb_control_path", - "target_trust_usb_control_enable", - "target_trust_usb_control_disable", - ], - properties: ["cppflags"], -} - -trust_usb_control { - name: "trust_usb_control_defaults", - soong_config_variables: { - target_trust_usb_control_path: { - cppflags: ["-DUSB_CONTROL_PATH=\"%s\""], - }, - target_trust_usb_control_enable: { - cppflags: ["-DUSB_CONTROL_ENABLE=\"%s\""], - }, - target_trust_usb_control_disable: { - cppflags: ["-DUSB_CONTROL_DISABLE=\"%s\""], - }, - }, -} - soong_config_module_type { name: "bootloader_message_offset", module_type: "cc_defaults", diff --git a/config/BoardConfigSoong.mk b/config/BoardConfigSoong.mk index 9acac854..421093a7 100644 --- a/config/BoardConfigSoong.mk +++ b/config/BoardConfigSoong.mk @@ -30,10 +30,7 @@ SOONG_CONFIG_NAMESPACES += lineageGlobalVars SOONG_CONFIG_lineageGlobalVars += \ additional_gralloc_10_usage_bits \ bootloader_message_offset \ - camera_override_format_from_reserved \ - target_trust_usb_control_path \ - target_trust_usb_control_enable \ - target_trust_usb_control_disable + camera_override_format_from_reserved # Soong bool variables SOONG_CONFIG_lineageGlobalVars_camera_override_format_from_reserved := $(TARGET_CAMERA_OVERRIDE_FORMAT_FROM_RESERVED) @@ -42,16 +39,10 @@ SOONG_CONFIG_lineageGlobalVars_camera_override_format_from_reserved := $(TARGET_ BOOTLOADER_MESSAGE_OFFSET ?= 0 TARGET_ADDITIONAL_GRALLOC_10_USAGE_BITS ?= 0 TARGET_CAMERA_OVERRIDE_FORMAT_FROM_RESERVED ?= false -TARGET_TRUST_USB_CONTROL_PATH ?= /proc/sys/kernel/deny_new_usb -TARGET_TRUST_USB_CONTROL_ENABLE ?= 1 -TARGET_TRUST_USB_CONTROL_DISABLE ?= 0 # Soong value variables SOONG_CONFIG_lineageGlobalVars_additional_gralloc_10_usage_bits := $(TARGET_ADDITIONAL_GRALLOC_10_USAGE_BITS) SOONG_CONFIG_lineageGlobalVars_bootloader_message_offset := $(BOOTLOADER_MESSAGE_OFFSET) -SOONG_CONFIG_lineageGlobalVars_target_trust_usb_control_path := $(TARGET_TRUST_USB_CONTROL_PATH) -SOONG_CONFIG_lineageGlobalVars_target_trust_usb_control_enable := $(TARGET_TRUST_USB_CONTROL_ENABLE) -SOONG_CONFIG_lineageGlobalVars_target_trust_usb_control_disable := $(TARGET_TRUST_USB_CONTROL_DISABLE) # Lineage Health HAL ifneq ($(TARGET_HEALTH_CHARGING_CONTROL_CHARGING_PATH),) @@ -90,6 +81,17 @@ ifneq ($(TARGET_POWERSHARE_DISABLED),) $(call soong_config_set,lineage_powershare,powershare_disabled,$(TARGET_POWERSHARE_DISABLED)) endif +# Lineage USB HAL +ifneq ($(TARGET_TRUST_USB_CONTROL_PATH),) + $(call soong_config_set,lineage_usb,usb_control_path,$(TARGET_TRUST_USB_CONTROL_PATH)) +endif +ifneq ($(TARGET_TRUST_USB_CONTROL_ENABLE),) + $(call soong_config_set,lineage_usb,usb_control_enabled,$(TARGET_TRUST_USB_CONTROL_ENABLE)) +endif +ifneq ($(TARGET_TRUST_USB_CONTROL_DISABLE),) + $(call soong_config_set,lineage_usb,usb_control_disabled,$(TARGET_TRUST_USB_CONTROL_DISABLE)) +endif + # Power HAL ifneq ($(TARGET_POWER_LIBPERFMGR_MODE_EXTENSION_LIB),) $(call soong_config_set,power_libperfmgr,mode_extension_lib,$(TARGET_POWER_LIBPERFMGR_MODE_EXTENSION_LIB))