From be6f81d61e25753eeecdb65bdf7dd2bb6d4c1a5c Mon Sep 17 00:00:00 2001 From: Justin Yun Date: Tue, 17 Dec 2024 21:15:59 +0900 Subject: Generic configuration for generic system modules. Config object includes a copy of itself for the generic configuration. The generic configuration replaces any product-specific configurations with the generic information. When a module context gets Config() object, it returns the generic configuration if the module sets use_generic_config to true. Otherwise, Config() returns the original config object as before. By adding `generic:""` annotation to the product variable, the variables will be initialized with the for the generic configs. If the is "unset", the variable will be unset. The generic modules can be included in the shared system image to be installed in multiple targets. Bug: 361816274 Test: m nothing --no-skip-soong-tests Change-Id: I15e4ade17ad1a8969f8e0e91d994b60545dc412f --- android/module.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'android/module.go') diff --git a/android/module.go b/android/module.go index a3fe837a5..87377cc75 100644 --- a/android/module.go +++ b/android/module.go @@ -128,6 +128,9 @@ type Module interface { // WARNING: This should not be used outside build/soong/fsgen // Overrides returns the list of modules which should not be installed if this module is installed. Overrides() []string + + // If this is true, the module must not read product-specific configurations. + UseGenericConfig() bool } // Qualified id for a module @@ -507,6 +510,10 @@ type commonProperties struct { // List of module names that are prevented from being installed when this module gets // installed. Overrides []string + + // Set to true if this module must be generic and does not require product-specific information. + // To be included in the system image, this property must be set to true. + Use_generic_config *bool } // Properties common to all modules inheriting from ModuleBase. Unlike commonProperties, these @@ -2588,6 +2595,10 @@ func (m *ModuleBase) Overrides() []string { return m.commonProperties.Overrides } +func (m *ModuleBase) UseGenericConfig() bool { + return proptools.Bool(m.commonProperties.Use_generic_config) +} + type ConfigContext interface { Config() Config } -- cgit v1.2.3-59-g8ed1b