Commit graph

8475 commits

Author SHA1 Message Date
Treehugger Robot
b25e443bc5 Merge "Respect framework partition set while merging meta files" into main 2023-09-15 17:52:17 +00:00
Dennis Song
36ce326f95 Respect framework partition set while merging meta files
The framework_partition_set would be generated from
framework_item_list and we should respect this partition
set while merging META/ab_partitions.txt.

This is to handle the case when we use a complete merged
target files package as the framework-target-files, where
its ab_partitions.txt may have non-framework partitions.
So we need to filter them out to prevent from the merged
meta file has some partitions that don't exist.

Test: merge_target_files &&
        add_img_to_target_files &&
	img_from_target_files &&
	flash device
Bug: 300193612
Change-Id: I0a76d706a20dcaffa2533278db7383563f03ec02
2023-09-15 06:20:19 +00:00
Zhi Dou
c20d115562 Merge "aconfig: throw exception if reading from DeviceConfig fails" into main 2023-09-14 19:28:16 +00:00
Dennis Shen
a1de8fd435 aconfig: Fix missing header in the generated c/cpp code
Test: atest aconfig.test
Change-Id: I0c23299ad366cb5c61b84b738dd9e6bf3428435c
2023-09-14 17:40:13 +00:00
Zhi Dou
73a34ce10a aconfig: throw exception if reading from DeviceConfig fails
Reading value from DeviceConfig may fail if the provider is not ready.
Since DeciceConfig, and Settings class are static wrapper on top of
the provider, it won't cause the instance  initialization issue.
Thus when the issue happens it means the provider is not initialized.

Test: atest aconfig.test.java and manually make a change in the
framework and check the exception message
Bug: 299471646

Change-Id: Ic08d7a9cd32a8810a7274b6d93c249abccb50b9e
2023-09-14 13:00:45 +00:00
Cole Faust
386470f7d7 Merge "Change default logging level to WARNING" into main 2023-09-13 20:22:22 +00:00
Mårten Kongstad
fb10840da5 aconfig: explicitly @hide FLAG_ constants
Because of a bug in metalava [1], the flag constants are incorrectly
considered not-hidden when metalava generates the API signature files.
This means the FLAG_ constant name will be used, instead of the FLAG_
constant value, which is what we want.

While waiting for b/300211291 to be fixed, explicitly mark the FLAG_
constants as hidden (and keep marking the classes as such).

This CL can be reverted when b/300211291 is fixed.

1. Item.isHiddenOrRemoved does not check if its parent item is hidden,
   tracked in b/300211291

Bug: 297881670
Test: atest aconfig.test aconfig.test.java
Change-Id: I05de8344ccb424bee51c39f9609489ad312397ce
2023-09-13 10:15:01 +02:00
Cole Faust
98142f8446 Change default logging level to WARNING
To avoid spam in the build.

Test: Presubmits
Change-Id: I45db6cd92babda7f83582fd438210cae02c54708
2023-09-12 17:39:47 -07:00
Daniel Zheng
d6178ee812 Merge "Turn on fastboot-info for img_from_target_files" into main 2023-09-11 21:05:36 +00:00
Cole Faust
548775d247 Merge "Clean staging dirs in build_image.py" into main 2023-09-11 17:25:19 +00:00
Daniel Zheng
89a85ba933 Turn on fastboot-info for img_from_target_files
Use fastboot-info for fastboot update

Test: m update_package
Bug: 299854419
Change-Id: I9f7c93f8309a2c136ee81cad1391f93b2feb8156
2023-09-11 09:58:32 -07:00
Mårten Kongstad
72c3b38a1d Merge "Revert "Revert "aconfig: @hide generated Java code""" into main 2023-09-11 14:08:55 +00:00
Treehugger Robot
1ee8f4d232 Merge "aconfig: remove unnecessary clones" into main 2023-09-11 12:51:17 +00:00
Mårten Kongstad
65efa27f71 Revert "Revert "aconfig: @hide generated Java code""
This reverts commit c0e8ffea41.

Reason for revert: The detected build breakage was unrelated to the aconfig change. Details in b/297881670#comment11.

Change-Id: Ia32bc2e796ed3de7fa049c2c2db340f4325a2853
2023-09-11 12:17:25 +00:00
Mårten Kongstad
4afc5d7b2b Merge "Revert "aconfig: @hide generated Java code"" into main 2023-09-11 11:06:14 +00:00
Mårten Kongstad
c0e8ffea41 Revert "aconfig: @hide generated Java code"
This reverts commit 379e09d157.

Reason for revert: Seems to have broken the build. Reverting while investigating.

Change-Id: I37c9a065853ef07b1f1c18355205a2f49dd816c4
2023-09-11 11:00:42 +00:00
Mårten Kongstad
fd6cd13947 Merge "aconfig: @hide generated Java code" into main 2023-09-11 10:44:23 +00:00
Mårten Kongstad
b5133f6ad4 aconfig: remove unnecessary clones
Improve performance slightly: remove unnecessary clone operations, or
use references where a new object is not needed.

Bug: 283910447
Test: atest aconfig.test
Change-Id: I75205ffa1723dd2654039baac882c225d2653c86
2023-09-11 11:10:21 +02:00
Mårten Kongstad
379e09d157 aconfig: @hide generated Java code
Flagged APIs are annotated using `@FlaggedApi(Flags.FLAG_NAME)`, where
Flags.FLAG_NAME was auto-generated by aconfig.

When metalava generates an API signature file, it can either

  a) insert the value of the constant ("com.foo.bar.flag_name"), or
  b) insert the name of the constant (FLAG.NAME)

In the case of @FlaggedApi, we want a). This requires that

  x) metlava has access to the definition of the constant while generating the API signature file, and
  y) the constant is not part of the API surface of the API signature file

x) is handled by the build system, y) is handled by the aconfig code
generation.

This CL @hide:s all generated Java code, to make sure it is accessible
within the platform, but never part of any API surface.

Bug: 297881670
Test: atest aconfig.test aconfig.test.java
Change-Id: I328ed1a652a4e5e293f2f4b11f916d29fc2fbcbd
2023-09-11 10:31:46 +02:00
Cole Faust
152cdfab7c Clean staging dirs in build_image.py
build_image.py now accepts a --input-directory-filter-file argument
that contains a list of files to consider from the input directory.
A new, temporary input directory will be created, and only the
considered files will be copied to it.

This removes most of the need for `m installclean`, as old files or
files built manually will no longer end up on the partition.

Bug: 205632228
Test: Presubmits
Change-Id: I07e0bf8e840abf0b51a2fdf67b758905fb3c5b5b
2023-09-08 16:24:26 -07:00
Treehugger Robot
6f0db025d0 Merge "Add per partition timestamp to 16K boot OTA" into main 2023-09-08 22:25:29 +00:00
Firman Prayoga
44d86b138b Merge "Revert "Clean staging dirs in build_image.py"" into main 2023-09-08 04:06:57 +00:00
Firman Prayoga
df21706765 Revert "Clean staging dirs in build_image.py"
Revert submission 2736954-proper_installclean

Reason for revert: Potential culprit for build breakage b/299545346

Reverted changes: /q/submissionid:2736954-proper_installclean

Change-Id: I2b0671bd40b7a74ef02923a777ec899401691454
2023-09-08 01:24:45 +00:00
Treehugger Robot
05a03698b7 Merge "[zip] Set all entry times before 1980 to 1980-01-01" into main 2023-09-07 18:54:47 +00:00
Cole Faust
c383825953 Merge "Clean staging dirs in build_image.py" into main 2023-09-07 16:41:45 +00:00
Mark Punzalan
0d7190b413 [zip] Set all entry times before 1980 to 1980-01-01
Before this change, entry times before 1980 had the year changed to 1980
but the month/day/hour/minutes/seconds were all kept as-is.

Bug: 277978832
Test: atest zipalign_tests
Change-Id: I9f87e98a6b985002578490b87c654fee86c65d62
2023-09-06 21:44:40 +00:00
Kelvin Zhang
b5661d6ef5 Add per partition timestamp to 16K boot OTA
update_engine requiers per partition timestamp if this partition's build
prop includes build.date.utc.

Test: th
Bug: 293313353
Change-Id: I6bf3de8e855f0830b26bdbe2cbdc78ba891662a7
2023-09-06 13:02:19 -07:00
Cole Faust
48b81e7386 Clean staging dirs in build_image.py
build_image.py now accepts a --input-directory-filter-file argument
that contains a list of files to consider from the input directory.
A new, temporary input directory will be created, and only the
considered files will be copied to it.

This removes most of the need for `m installclean`, as old files or
files built manually will no longer end up on the partition.

Bug: 205632228
Test: Presubmits
Change-Id: I4c82ac7f1ed49a37271755749c8f72afeeb7f295
2023-09-06 11:51:13 -07:00
Treehugger Robot
2462269f1f Merge "Use localtime_r() on Windows too." into main 2023-09-06 18:12:22 +00:00
Zhi Dou
deafa792eb aconfig: flag java lib enable optimization
This change adds annotation in the generated code. If the flag is read
only, annotations @com.android.aconfig.annotations.AssumeTrueForR8 or
@com.android.aconfig.annotations.AssumeFalseForR8 will be added in to
the corresponding methods in the interface FeatureFlags, and class
Flags.

Test: atest aconfig aconfig.test.java
Bug: 295328116
Change-Id: Ic1b62a86f0945a5e72ae2c4987cce77fe3f172e9
2023-09-06 12:55:09 +00:00
Elliott Hughes
16caa44298 Use localtime_r() on Windows too.
I don't know why I didn't clean these up when I learned about this
trick.

Test: treehugger
Change-Id: I16e7d92fd79c2dfc006612442bbb924b35a5f213
2023-09-05 21:37:01 +00:00
Treehugger Robot
6c4627369e Merge changes from topic "aconfig-misc-fixes-2023-09-04" into main
* changes:
  aconfig: add invariant checks for `is_fixed_read_only`
  aconfig: re-enable development with cargo
2023-09-05 17:21:22 +00:00
Mårten Kongstad
21717e744e aconfig: add invariant checks for is_fixed_read_only
Update parsed_flag::verify_fields to verify that the invariant "if a
parsed flag is_fixed_read_only, its permission must be READ_ONLY".

Note: commands.rs will ensure that no value files are used to create an
invalid parsed flag when flag declarations and values are parsed, but
the invariant check should still be added for completeness sake, and to
make sure no invalid hand-crafted test data exists.

Also fix invalid test data found by adding this invariant.

Bug: 298935897
Test: atest aconfig.test
Change-Id: I8cea5c4d28c458525b7034d78ecb34dd09272771
2023-09-04 20:25:59 +02:00
Mårten Kongstad
5cfad6abd2 aconfig: re-enable development with cargo
The integration tests introduced in 906405f5c9 depend on libraries
auto-generated by running aconfig. This works fine for the Android build
system, but breaks `cargo t`.

Disable the tests when using `cargo t` for local development. Cargo can
be used for rapid local development, including running unit tests;
integration tests should be run using atest.

Bug: 298904077
Test: cargo t
Test: atest aconfig.test_mode.test.rust aconfig.prod_mode.test.rust
Change-Id: Ifcd374fa6efdc121cbfd4c4ac4fb43cf9cacc192
2023-09-04 13:22:28 +02:00
Kelvin Zhang
dfa0c85705 Merge "Use seek() instead of writing 0s" into main 2023-09-01 17:00:52 +00:00
Treehugger Robot
145ca3034f Merge "Mark boot OTAs as partial OTAs" into main 2023-09-01 16:58:26 +00:00
Kelvin Zhang
8aa6525ad7 Use seek() instead of writing 0s
test_ZipWrite_large_file need to write a 4GB file to zipfile for
testing. Instead of writing sequence of 0s to the test file, use seek().

Test: th
Bug: 298138109
Change-Id: I886bfa0c3f21664e529ba7de9688909518148f61
2023-08-31 12:17:14 -07:00
Kelvin Zhang
c4f737406a Mark boot OTAs as partial OTAs
Boot partition only OTA must be marked as "partial". This is required
for update_engine to correctly copy non-updated partitions to the target
slot.

Test: th
Bug: 293313353
Change-Id: Ic89d03f214e12fa43f686d37854d6fed1d78a6a3
2023-08-31 12:17:14 -07:00
Treehugger Robot
c20ef7ca4a Merge "Avoid calling MergeUpdateEngineConfig for non-ab target" into main 2023-08-31 14:30:17 +00:00
Joe Onorato
cede86dd28 make fake_device_config buildable on host
Test: treehugger
Bug: 277916185
Change-Id: I002669bbb605b7968b81c66d1cbf0ff3caa0c699
Merged-In: I002669bbb605b7968b81c66d1cbf0ff3caa0c699
2023-08-30 11:39:29 -07:00
Kelvin Zhang
506a30851e Add timestamp to 16K boot OTA
Test: th
Bug: 297536338
Change-Id: Id4919d2437079e36899cd4c56da011a29aa0b470
2023-08-29 19:38:19 -07:00
Jerry Jia
e40f2800af Merge "Add libaconfig_python_proto target for Mobly host-based tests" into main 2023-08-29 22:33:32 +00:00
Zhi Dou
401be560de Merge "aconfig: generate full fakefeatureflagsimpl in prod mode" into main 2023-08-29 13:29:31 +00:00
Jooyung Han
ccec6ad2ec ota_from_target_files requires apexd_host
apexd_host is invoked in check_target_files_vintf.py
to prepare the apex directory before invoking checkvintf. ota_from_target_files uses check_target_files_vintf.py via (python_library) releasetools_check_target_files_vintf.

Since soong doesn't inherit "required:" property from library to binary, adding the dependency manually to ota_from_target_files.

Bug: n/a
Test: $ m ota_from_target_files # should build apexd_host
Change-Id: Ie7e6c3acf376c23960f242294f5a9bf99fec26aa
2023-08-29 01:28:40 +00:00
Zhi Dou
06a448fac7 aconfig: generate full fakefeatureflagsimpl in prod mode
This change will generate full fakefeatureflagsimpl in prod mode.
FakeFeatureFlagsImp will be the same in test mode and the prod mode.
FeatureFlagsImpl will be all unimplemented in test mode. setFlag,
resetAll are added into the interface FeatureFlags.

The reason to make this change is for project using injection pattern,
the project doesn't have to use test mode to test the flag guarded code.
The project can directly use the FakeFeatureFlagsImpl for testing.

Bug: 294838180
Test: atest AconfigJavaHostTest --host AND atest aconfig.test.java
Change-Id: Ib6d40fd3a9ef872e01594fd4f8d6c4cb10bb173a
2023-08-28 16:54:15 +00:00
Kelvin Zhang
f6fe0a9c9c Reduce OTA tools's dependency on brillo_update_payload
brillo_update_payload is thin bash wrapper for delta_generator, and
OTA tools are wrappers around brillo_update_payload. This is
inconveinent, as adding a new flag requires changing 3 places. Since
brillo_update_payload is really thin, skip it and invoke delta_generator
directly.

Test: th
Bug: 293313353
Change-Id: I2fd5af95c571ea45aea62f9eec475f0f4e864953
2023-08-25 13:49:09 -07:00
Zhi Dou
feac202f19 Merge "aconfig: add fixed read only flag" into main 2023-08-25 13:37:37 +00:00
Cole Faust
1f89cbb484 Fixes for python 3.11
Bazel previously had a bug where the source directory of the entrypoint
python script would be added to the path. They added PYTHONSAFEPATH
to the enviornment to fix it, which was introduced in python 3.11.

Now that python is being updated to 3.11, the fix is in, which breaks
some scripts that don't properly specify import folders.

Add the import folders where required.

Bug: 278602456
Test: ./build/bazel/ci/bp2build.sh
Change-Id: I5b87f83247dfdfcb8bdb4f962466cbf522cc29c6
2023-08-24 17:44:01 -07:00
Xianyuan Jia
3a070a634e Add libaconfig_python_proto target for Mobly host-based tests
Bug: 297431521
Test: unit tests (mobly_device_flags_test)
Change-Id: Ic377cb7c6f651033145a14c83c987e6d779cca6b
2023-08-24 16:49:38 -07:00
Kalesh Singh
78ecdf05c4 Merge changes I890db067,I4150dbd4 into main
* changes:
  zipalign: Allow specifiying the target page size
  zipalign: Fix pageAlignSharedLibs arg in tests
2023-08-24 22:59:42 +00:00