The return value of ClassItem.allInterfaces will sometimes include the
interface itself (e.g.
android.accessibilityservice.BrailleDisplayController). It is unclear
when this happens; it doesn't happen for the unit test.
Update the logic to record the interfaces for a class to filter out
interfaces named the same as the class.
Bug: 334870672
Test: atest --host check-flagged-apis-test
Test: croot && ./build/tools/check-flagged-apis/check-flagged-apis.sh
Change-Id: I8d93c230dfedde30e8d43fefd560a47944085d3a
Extend ClassSymbol with a list of the interfaces that class implements.
This will be used in a follow-up CL to improve the logic that checks if
a class member exists in the api-versions.xml data.
Bug: 334870672
Test: atest --host check-flagged-apis-test
Change-Id: I4db7ff47c3ce40ca892cb872810dd559426dfcb8
Change Symbol from a wrapper around a String to a more fleshed out data
class; symbols now encode if they represent a class, or a class member
(including a reference to the containing class).
Bug: 334870672
Test: atest --host check-flagged-apis-test
Test: croot && ./build/tools/check-flagged-apis/check-flagged-apis.sh # with and without this CL; the output should be the same
Change-Id: I003535c721c45d559d00fb3e008325e1db0e18c0
The constructor of a nested class is represented as follows in
api-versions.xml:
<class name="android/Clazz$Foo$Bar" since="1">
<method name="<init>()V"/>
</class>
The nested dollar signs are not replaced by forward slashes before the
parsing logic uses `split("/")` to find the name of the inner-most
class, incorrectly resulting in `Class$Foo$Bar` instead of `Bar`. Fix
this by immediately replacing dollar signs with forward slashes after
extracting the package and class.
Also clean up the following call of `Symbol.create`.
Bug: 334870672
Test: atest --host check-flagged-apis-test
Change-Id: I8c0619faae90ded7eb14dcc20ecb94a086a1c764
Note that not all partitions are moved to Soong. Soong doesn't yet
support *_dlkm partitions and the oem partition.
This change also removes dead code for support VNDK snapshot.
Finally, as a minor clean up, the leading '_' is dropped from the module
names _fs_config_*. There's no need to hide the module names.
Bug: 337993745
Test: m
Change-Id: I5beec5c6734291b9361f870fc1a8dba19def062e
Return a pointer of MappedStorageFile/MutableMappedStorageFile instead
of an object of MappedStorageFile/MutableMappedStorageFile. Now added
destructor for MappedStorageFile/MutableMappedStorageFile to unmap the
in memory file to free up memory.
Bug: b/321077378
Test: atest -c
Change-Id: Iaa02696feb07ff383f0c7e46b645d82e57c38254
Previously, the check-flagged-apis.sh script used `api-versions.xml`
for `module-lib` and `system-server` which did not include the
latest up-to-date information about updatable modules or historical
information about sdk extensions which lead to false positives for
APIs from those updatable modules. This changes switches to use the
`api-versions.xml` produced by the new `api_versions_*_complete`
modules which does include that information.
Bug: 337836752
Test: Run script before and after applying this change to make sure
that flagged APIs from updatable modules are no longer
reported as missing.
Change-Id: If09e89a4595a19d9f00390fb5fbd24330ec11be5
Instead of building the entire SDK, explicitly build the
api-versions.xml files.
Bug: 334870672
Test: croot && build/tools/check-flagged-apis/check-flagged-apis.sh
Change-Id: Ib165c0acd4766ad3000aaf17220050d5e66ddf2c
The path to the generated API signature files used with --api-signature
in the check-flagged-apis.sh script are different based on the lunch
target used: sometimes it's under $ANDROID_PRODUCT_OUT, other times
under out/target/product/mainline_x86.
Teach check-flagged-apis.sh to dynamically find the correct path by
querying ninja.
Bug: 334870672
Test: croot && build/tools/check-flagged-apis/check-flagged-apis.sh
Change-Id: I1b0b41ef3ad1bc7113a3b31323d81251e7e65933
Switch the internal format to represent Symbols to (something close to)
the format described in section 4.3.2 of the JVM spec, i.e.
com/android/SomeClass/someMethod(II[Ljava/lang/String;)Z
This will make parsing method parameters from api-versions.xml easier,
as that file already uses this format, and converting API signature
files to the same format is less painful than going in the other
direction.
Bug: 334870672
Test: atest --host check-flagged-apis-test
Change-Id: I1e1fb8fe208cd51cce2cc129f5aa1cb495672c16
Bug: 336189540
Test: m out/soong/.intermediates/all-event-log-tags.txt
Test: m out/target/common/obj/all-event-log-tags
Change-Id: Iae336a05bb2f27564b0bf8d4ea3753a30be89e90
added a new function called list_flag_with_info to list all the flags
given all four storage files (package.map, flag.map, flag.val, flag.info).
also exported this api thru cxx interface so aconfigd can use it.
Bug: b/312444587
Test: atest -c
Change-Id: Ibbfe657b980d40e25e5e28962b930338192e2d98
Allow forward slash characters (/) in Symbol names: when adding support
for method arguments, this will be needed.
The current implementation does not change; forward slash conversions to
dots still happen, but now explicitly at the call site of Symbol.create.
Bug: 334870672
Test: atest --host check-flagged-apis-test
Change-Id: Ia860d7b0c8703fcc56fec6ea722cf995ccf20cd0
Implement a binary that logs tool events to Clearcut. The binary is designed to be eventually called by the `run_tool_with_logging` script in the `envsetup.sh` script that sets up the build environment.
Only start and stop events are currently logged for each invocation.
Test: atest tool_event_logger_test
bug: 331638854
Change-Id: I9268e4cb986975ceda171204e6ce8ef1732eaeea
Teach check-flagged-apis to parse methods. The implementation is only
half done: method signatures that accept parameters are ignored. A
follow-up CL will add support for these.
check-flagged-apis treats constructors and regular methods the same.
Bug: 334870672
Test: atest --host check-flagged-apis-test
Change-Id: Ie98db767289ac2a35aa85371f60ecb3970170d86
Read from the new aconfig storage backing in C++ aconfig codegen, for
READ_ONLY flags. Log if there is a match with the legacy storage, or a
mismatch, or a failure.
Only enabled if instrumentation is enabled, which will be enabled by a
build flag in a follow-up CL.
Test: m && cargo t
Bug: 328444881
Change-Id: I691dfad8860d8f917e93c5d56dac19f8791de943
Restrict the set of exported symbols to those in the aconfig_storage
namespace by way of a version script. This shrinks the shared lib size
by ~75%, from ~800KB to <200KB.
Bug: 336657207
Test: m
Change-Id: I56044fe667a713cf1d94f96c992f379a5725850f
If boot_variable_file is not found locally, look for it inside
input_target_files.
Bug: 335732867
Test: generate OTA with file in target-files.zip and verify metadata
Change-Id: I2e61f50850e82a3795f2e0e1aefcaf2329a8cfb1
Simplify storage write api so that we don't need the storage records pb
file.
Bug: b/312444587
Test: atest -c
Change-Id: I7e336b1d7766983364715dae15786b91b0c0743f
Passing "*" to --products is equivalent to passing the all_named_producs
build variable
Passing "*" to --modules passes the contents of
PRODUCT_OUT/all_modules.txt
The total length of the text of all_modules can easily exceed the
maximum argument size for the OS. The proper solution is likely to call
getconf ARG_MAX, then concatenate the command to be executed to check
against the limit. Instead, the modules are processed in batches of 40k
modules. As long as module names don't get extremely long, this should
keep us under the ARG_MAX limit. In testing, using --modules "*" gets
split into two batches.
Test: build/make/tools/whichgit --modules "*"
Test: build/make/tools/whichgit --modules "*" --unused
Test: build/make/tools/whichgit --modules "*" --products "*"
Existing use-cases should remain unchanged:
TEST: build/make/tools/whichgit --modules framework
Change-Id: Ifa947daea2d439df0145e6def92637b67a8b5d22
The --unused parameter inverts the output of whichgit, reporting which
git projects are not used for a given build target.
Test: build/make/tools/whichgit --unused
Test: build/make/tools/whichgit --unused --modules framework
Existing use-cases should remain unchanged:
Test: build/make/tools/whichgit --modules framework
Change-Id: Ia4e55a5cb0331d522fed76821fe813ef98c25a67
Occasionally sourcing the script would close my overall shell when it
hit an error. By having it just be an executable script, this prevents
it from impacting a user's normal shell environment and can depend on it
always being bash, rather than whatever shell people happen to be using.
Bug: 334870672
Test: tools/check-flagged-apis/check-flagged-apis.sh
Change-Id: Ic46cb4fefdea8d51be018d4f7a92b0d9ca7e57b3
Update the map in soong instead of that in bazel
Bug: 315353489
Test: manual
Merged-In: I3a51be1119109d2a6cf3959bdc8a48192872580f
Change-Id: Ia61a17be4a7d85c00d2e9758ea2409019d451dfd
No need for cache filtering based on container anymore. This is now
performed by build system automatically. The caches feed into storage
generation command are automatically filtered based on owning
container.
Bug: b/312444587
Test: atest aconfig.test
Change-Id: I44f3ac03d50b77a191a82ff7ed4d02766012492d
previously we store three bits per flag: is sticky, is read write, has
override. so when a local override arrives, is sticky bit as well has
override bit are set to true. this becomes problematic when the local
override is removed. we are not sure if we should remove has override
bit as well (server override could still be in place).
therefore restructuring the flag info for each flag into new three bits:
is read write, has server override and has local override. so now server
override and local override bits are independent from each other.
Bug: b/312444587
Test: atest -c
Change-Id: I03b2bb7312480773236c95f2b39f2589fee41924
Create one library for reading protos from all containers, instead of
having numerous libraries perform the same logic. For Java, we will
create a similar library reusing the same
partition_aconfig_flags_paths.txt.
Bug: 324436145
Test: adb shell aflags list # Confirm that various containers appear
Change-Id: I924e281a50f9a609e1c07c03267eebe3dce52752
Add a script to make it easier to check-flagged-apis for the public APIs
and the three flavours of @FlaggedApi.
Bug: 334870672
Test: lunch sdk-next-eng && source check-flagged-apis.sh
Change-Id: I8b5e2642ade84560c5c61ae49d8c0dcdedb841ca
Replace the current unit test runner DeviceJUnit4ClassRunner with JUnit4
and replace the (larger) dependency tradefed with the (smaller)
dependency junit.
This has no impact other than minimizing the unit test static_libs.
Bug: 334870672
Test: atest --host check-flagged-apis-test
Change-Id: I0520ab0feeea5ea2ed15905136ba2647f86162cb
Teach check-flagged-apis to cross-check the data from its three input
sources. This allows the tool to detect
- @FlaggedApi references to non-existent flags
- @FlaggedApi APIs present in the build artifacts even though the flag
is disabled
- @FlaggedApi APIs not present in the build artifacts even though the
flag is enabled
By passing in different sources, the tool can detect these errors for
any of the API surfaces (public, @SystemApi(MODULE_LIBRARIES), etc).
Note: the tool assumes that a disabled flag means that the @FlaggedApi
should not be present in the build output. This is currently true, but
won't be once metalava starts reverting @FlaggedApis to their previous
SDK snapshot.
Bug: 334870672
Test: atest --host check-flagged-apis-test
Test: check-flagged-apis --api-signature out/target/product/mainline_x86/obj/ETC/frameworks-base-api-current.txt_intermediates/frameworks-base-api-current.txt --flag-values out/soong/.intermediates/all_aconfig_declarations.pb --api-versions out/dist/data/api-versions.xml
Change-Id: I790234865f831af7d45895def14d1d6740365622
Teach check-flagged-apis to parse API versions XML; this represents the
APIs after metalava has processed the source and kept APIs as is, or
reverted them to the previous SDK snapshot, according to their
@FlaggedApi flags.
As with the API signature parser, limit support to fields to keep things
simple; support for classes and methods will be added in later CLs.
Note: `m sdk dist` will generate an API versions XML file.
Bug: 334870672
Test: atest --host check-flagged-apis-test
Test: check-flagged-apis --api-signature out/target/product/mainline_x86/obj/ETC/frameworks-base-api-current.txt_intermediates/frameworks-base-api-current.txt --flag-values out/soong/.intermediates/all_aconfig_declarations.pb --api-versions out/dist/data/api-versions.xml
Change-Id: I779a0d0cdb8a50536d3fc8d517fa38ba4b0dcd1c
Teach check-flagged-apis to parse the parsed_flags protobuf generated by
aconfig.
Note: `m all_aconfig_declarations` generates a protobuf file that
contains all info about all flags.
Bug: 334870672
Test: atest --host check-flagged-apis-test
Test: check-flagged-apis --api-signature out/target/product/mainline_x86/obj/ETC/frameworks-base-api-current.txt_intermediates/frameworks-base-api-current.txt --flag-values out/soong/.intermediates/all_aconfig_declarations.pb
Change-Id: I397b32ae2a373b429ef6ce22e0a06a0f15202b91
Teach check-flagged-apis to extract flagged APIs from API signature files.
To keep things simple, only consider fields for now: support for classes
and methods will be added in a later CL.
Note: `m frameworks-base-api-current.txt` will generate an API signature
file that includes both the platform and mainline APIs.
Bug: 334870672
Test: atest --host check-flagged-apis-test
Test: check-flagged-apis --api-signature out/target/product/mainline_x86/obj/ETC/frameworks-base-api-current.txt_intermediates/frameworks-base-api-current.txt
Change-Id: Ic244b896672569f44af793796189b34c1f9d0c36
1, add a new field in storage metadata proto, for each container, there
is a local override file.
2, update write api to expose the api to map a writable file given the
specific path. the cannonical api will require a storage metadata proto,
and then find the right file path and map it.
3, minor update to make the proto lib cc_library instead of
cc_library_static
Bug: b/312444587
Test: atest -c
Change-Id: Iaf0aff44c1ca3ad4bffc5e06bb99bb276b9069c5
Add a value class to represent Flag names. We could use plain Strings
but having a dedicated class (with no overhead compared to String) makes
the intent of the code much clearer.
Bug: 334870672
Test: m check-flagged-apis && check-flagged-apis
Change-Id: Icdd4fb97d3fd49e507b7559504ea173a3dc52dea
check-flagged-apis will read contents from various sources, which use
different formats to represent the same piece information (e.g.
"class#field" or "<class><field>").
Introduce a Symbol value class to represent any API (i.e. a class, field
or method) in a unified format.
Bug: 334870672
Test: m check-flagged-apis && check-flagged-apis
Change-Id: Id9404294a87b23a9d43e5e13ce39ea5a92608e33
ro.product.first_api_level looks like the value we actually want to read
to since it inherits from $PRODUCT_SHIPPING_API_LEVEL. Other variables
we attempted to look at were giving other values (e.g 202504 for pixel
watch)
Bug: 331202590
Test: th
Change-Id: Ied3da247cba45611132db6c9e3cdefb447891f96
Use clikt as the command line options parser library.
Bug: 334870672
Test: m check-flagged-apis && check-flagged-apis
Change-Id: I7c406456b00e29293294dcdbef411d2543a1e8d5
Add a new CLI to verify that the build artifacts contain the right set
of @FlaggedApi APIs, based on the value of the corresponding aconfig
flag.
This CLI will act as an end-to-end test of Soong and metalava.
This CL only adds the project scaffolding; later CLs will add the
implementation.
Bug: 334870672
Test: m check-flagged-apis && check-flagged-apis
Change-Id: Ib00653f2a549217da2b0058867c711f35efd5760
The order of items in `partitions` map is non-deterministic. To make
sure that builds are hermetic, sort the map before use.
Test: th
Bug: 332550989
Change-Id: I76c7037ef9f03904899339813819fcf985a7c893
Currently flag info query api is called get_boolean_flag_attribute, in
this change, we switched it over to a flag value type generic
implementation get_flag_attribute. So in the future we want to add more flag value types, this api can stay the same.
Bug: b/312444587
Test: atest -c
Change-Id: I2b272f3fa3cb1d0edc8b77a44bf37752ffe95925
Add keys to the dict `partitions` in serial to have a deterministic
insertion order.
This guarantees the generated vbmeta.img is always the same on the same
input, fixing image consistency issues.
Reference:
https://android-review.googlesource.com/c/platform/build/+/2585397
Bug: 332550989
Test: Generate vbmeta several times, confirm identical result.
Change-Id: I39da5844045f497fdc89e6477a7e32ddacb70764