[SNAPI] Fix JSON field naming mismatch in Soong API database queries

The GetModuleByInstallPath RPC was returning empty results even when
valid modules existed in the database.

The issue was caused by an inconsistency between the JSON field names
stored in SQLite and the path expressions used in SQL queries:
1. By default, com.google.protobuf.util.JsonFormat converts snake_case
   fields (e.g., install_files) into camelCase (e.g., installFiles)
   during the translation from Protobuf to JSON.
2. The SQLite json_each function is case-sensitive. It was searching
   for $.install_files, but the actual keys in the database were
   installFiles, resulting in zero matches.

Solution:
1. Loader Fix: Configured JsonFormat.Printer in SoongApiLoader.java with
   .preservingProtoFieldNames() to ensure JSON output maintains the
   original snake_case naming defined in the .proto file.
2. DAO Optimization: Refactored the SQL query in SoongApiDao.java to
   use an EXISTS clause with the correct $.install_files key. The
   EXISTS approach improves performance by short-circuiting once a match
   is found and ensures unique result sets.
3. Test Enhancement: Updated SoongApiLoaderTest.java to explicitly
   verify that the ingested JSON uses snake_case naming and does not
   regress to camelCase.

Bug: 471114931
Test: atest soong_api_tests --host
Change-Id: I09b70f0e6ed6ad80b4ea4a4d6797522bb198dba9
3 files changed
tree: 0be27a3e3b8da3fcbb403ad36faf1f0067a153c5
  1. backported_fixes/
  2. ci/
  3. common/
  4. core/
  5. packaging/
  6. target/
  7. teams/
  8. tests/
  9. tools/
  10. .gitignore
  11. Android.bp
  12. banchanHelp.sh
  13. buildspec.mk.default
  14. Changes.md
  15. CleanSpec.mk
  16. Deprecation.md
  17. envsetup.sh
  18. help.sh
  19. navbar.md
  20. OWNERS
  21. PREUPLOAD.cfg
  22. rbesetup.sh
  23. README.md
  24. shell_utils.sh
  25. tapasHelp.sh
  26. Usage.txt
README.md

Android Make Build System

This is the Makefile-based portion of the Android Build System.

For documentation on how to run a build, see Usage.txt

For a list of behavioral changes useful for Android.mk writers see Changes.md

For an outdated reference on Android.mk files, see build-system.html. Our Android.mk files look similar, but are entirely different from the Android.mk files used by the NDK build system. When searching for documentation elsewhere, ensure that it is for the platform build system -- most are not.

This Makefile-based system is in the process of being replaced with Soong, a new build system written in Go. During the transition, all of these makefiles are read by Kati, and generate a ninja file instead of being executed directly. That's combined with a ninja file read by Soong so that the build graph of the two systems can be combined and run as one.