Optional modules need a module specific soong config variable

Optional modules, i.e. those modules which may be provided by Google or
vendors depending on the vendor, need to have its own Soong config
variable that controls whether prebuilts are used or not. Without that
the build will always attempt to use the Google prebuilt module instead
of the vendor provided module.

This change:
1. Adds support for specifying which modules are optional and will
   generate a module specific soong_config_module_type that uses a
   module specific Soong config variable.

2. Generates the soong_config_module_type for optional modules inline
   in the snapshot Android.bp file (instead of importing from a
   manually curated definitions files). That simplifies the cost of
   adding optional modules.

3. Adds some extra tests to ensure that S and Tiramisu behave the
   same way.

Bug: 233965247
Test: atest mainline_modules_sdks_test
      packages/modules/common/build/mainline_modules_sdks.sh
      # Check the output to ensure that wifi uses the wifi specific
      # Soong config but ipsec (as a non-optional module) does not.
      # Unpack the wifi snapshot into prebuilts/module_sdk/Wifi
Change-Id: I6a85b6f9877fc251010ff2bbee75fe8fa99db9b4
(cherry picked from commit d20edd6c69cf07dc357d674463233c95aaa664ac)
Merged-In: I6a85b6f9877fc251010ff2bbee75fe8fa99db9b4
4 files changed
tree: 90fdd9dd79f57a2b4b5712e2b80710f3b2d6038d
  1. build/
  2. java/
  3. javatests/
  4. proguard/
  5. proto/
  6. sdk/
  7. tools/
  8. Android.bp
  9. generate_ml_bundle.sh
  10. MODULES_OWNERS
  11. OWNERS
  12. PREBUILTS_MODULE_OWNERS
  13. PREUPLOAD.cfg
  14. README.md
README.md

packages/modules/common

This project includes mainline build and other utility code. Any library code intended for use by modules should go in frameworks/libs/modules-utils instead.

java code

This project uses a single source path for java code. All java code should go in the java directory with subdirectories corresponding to the java package. Android.bp files should go alongside the java source files, and should only include java source for a single java package to encourage good code hygiene.

Tests for java code should go in the javatests directory and follow the same structure.