Commit graph

8666 commits

Author SHA1 Message Date
Zhi Dou
3dea629a9e aconfig: cache flag value in generated java code
This change add cache in generated jave code to improve the performance.

The cache is a DeviceConfig.Properties. One Properties contains all
flag values from the given namesapce.

The Properties for a given namespace is initialized as null, and the
first call for any flags in that Properties will trigger the call to
fetch all the values. After the first call, the flag values are stored
in the Properties, so the following calls will directly get the value
from the Properties instead from the backup storage.

Test: atest aconfig.test.java
Bug: 307511846
Change-Id: Ic43626101c28099199b6faa419cf1945bd53b15d
2023-10-27 23:53:09 +00:00
Kelvin Zhang
2ab6986dd9 Make non-ab code path compatible with extracted target files
Bug: 296485685
Test: ota_from_target_files -v -i non_ab.zip non_ab.zip ota.zip
Change-Id: I13ed54bfe7d14d2d1e87f45564da465a77bc2d1d
2023-10-27 11:01:27 -07:00
Kelvin Zhang
160762a276 Use deterministic salt for AVB footer of prebuilt boot img
When target specified a prebuilt boot.img, current build system will add
avb hash footer to it with a random salt. Use a deterministic salt
instead for more reproducible builds. To stay consistent with
non-prebuilt boot.img code path, we extract the kernel image from
prebuilt boot.img and uses sha256sum of kernel image as the salt.

Test: th
Bug: 293313353
Change-Id: I988999ddc4f18e0b8677b05a3165c847b6a11b52
2023-10-25 13:28:11 -07:00
Kelvin Zhang
9d74128194 Allow -v option to change log level
Setting logging level to 'NOTSET' would tell logging module to inherit
logging level from handlers. Since the verbosity of handlers is
controlled by -v option, this allows sign_apex.py to give verbose output
if -v is specified.

Test: th
Bug: 307191956
Change-Id: I9c1db107cf4eae80ab570d892b0465b3902298fd
2023-10-24 21:58:28 -07:00
Wei Li
420d7d5878 Merge "Initial implementation of layoutlib SBOM generation." into main 2023-10-24 17:11:20 +00:00
Zhi Dou
79a45fa178 Merge "overrideflags: change local override list name" into main 2023-10-23 20:55:15 +00:00
Zhi Dou
b66973688e overrideflags: change local override list name
Change local override list name to "ACONFIG_VALUES_LIST_LOCAL".

Bug: 298692416
Test: source build/envsetup.sh && overrideflags, and then check the
output

Change-Id: I6c2b8dcf6291a1fd7012e714fa91ca6bf0b47cf2
2023-10-23 18:19:29 +00:00
Kelvin Zhang
9e348cfc6b Merge "Allow OEMs to bypass the on device SPL downgrade check" into main 2023-10-23 18:17:59 +00:00
Kelvin Zhang
d51332c82f Allow OEMs to bypass the on device SPL downgrade check
Certain OEMs bootloader implementation allow SPL downgrade. Allow on
device SPL downgrade check to be bypassed.

Test: th
Bug: 306271739
Change-Id: Iba991e12d36291e2d0547c94ef54c750d87f35fb
2023-10-23 10:10:33 -07:00
Zhi Dou
8817eed1af change path to shell_utils.sh
Bug: 298692416
Test: source build/envsetup.sh && overrideflags, and then check the
output

Change-Id: Idf254b66da17079db2d08e98a9914e1c2f9f6097
2023-10-23 13:41:07 +00:00
LaMont Jones
6aa030026c Merge "add script to help override flag value locally" into main 2023-10-20 22:24:24 +00:00
Zhi Dou
77c9f0c9cb add script to help override flag value locally
Add a script to help to create flag value building rules.

The script will only extract necessary information from the value file
but it will not validate the file. The validation will defer to building
system.

For input

```
flag_value {
    package: "com.android.aconfig.test"
    name: "disabled_ro"
    state: DISABLED
    permission: READ_ONLY
}
flag_value {
    package: "com.android.demoapp.test"
    name: "enabled_ro"
    state: DISABLED
    permission: READ_WRITE
}
flag_value {
    package: "com.android.aconfig.test"
    name: "enabled_rw"
    state: ENABLED
    permission: READ_WRITE
}
```

The output Android.bp file will be like
```
VALUE_LIST_LIST = [
    aconfig-local-com.android.demoapp.test,
    aconfig-local-com.android.aconfig.test
]

aconfig_values {
    name: "aconfig-local-com.android.demoapp.test",
    package: "com.android.demoapp.test",
    srcs: [
        "override_values.textproto",
    ]
}

aconfig_values {
    name: "aconfig-local-com.android.aconfig.test",
    package: "com.android.aconfig.test",
    srcs: [
        "override_values.textproto",
    ]
}
```

Bug: 298692416
Test: source build/envsetup.sh && overrideflags, and then check the
output

Change-Id: Ife4063e079811e0b29046be7a6bc127cad668ed0
2023-10-20 21:04:00 +00:00
Juan Yescas
4d136f5265 Merge "16k: Sign the APKs to support 4k/16k page sizes" into main 2023-10-20 04:09:43 +00:00
Juan Yescas
5c6b6f24a3 16k: Sign the APKs to support 4k/16k page sizes
The page agnostic targets have to support 4k/16k page sizes. For
these targets, the APKs have to be aligned at 16k boundaries.

Bug: 302343940
Test: source build/envsetup.sh
      lunch aosp_cf_arm64_phone_pgagnostic
      m
      launch_cvd -userdata_format=ext4
Change-Id: Ia0e39a90c0d6a3e62d450157fdfd5e3ee36d346e
2023-10-20 03:13:39 +00:00
Wei Li
ee7365981e Merge "Support third_party.identifier in METADATA files of external packages." into main 2023-10-20 01:48:33 +00:00
Thiébaud Weksteen
ed5abbdea4 Merge "Revert "Add sign_sepolicy_path for a binary to sign sepolicy.apex."" into main 2023-10-19 22:48:25 +00:00
Sandeep Dhavale
cc1a560241 Merge "Add support for specifying erofs blocksize" into main 2023-10-19 21:46:58 +00:00
Wei Li
427dacb239 Support third_party.identifier in METADATA files of external packages.
Bug: 303688820
Test: CIs
Test: "m sbom" after lunch
Change-Id: Ic329d87cdcfbe4152b0fe6a8fd71c4867593b674
2023-10-18 16:45:31 -07:00
Sandeep Dhavale
d7cc7e8f9a Add support for specifying erofs blocksize
This change allows us to specify erofs filesystem block size
which will be used to create erofs image.

Either it can be specified at board level using
BOARD_EROFS_BLOCKSIZE. Or per read only partition image
using BOARD_<PARTITION>IMAGE_EROFS_BLOCKSIZE.

Examples:
BOARD_EROFS_BLOCKSIZE := 16384 OR
BOARD_PRODUCTIMAGE_EROFS_BLOCKSIZE := 16384

Bug: 303316443
Test: m and file ${ANDROID_PRODUCT_OUT}/*.img

Change-Id: I9bf3d299ae02165d0bffc62f474a302408d8b9b9
Signed-off-by: Sandeep Dhavale <dhavale@google.com>
2023-10-18 08:23:36 -07:00
Wei Li
c134b76375 Initial implementation of layoutlib SBOM generation.
1) Build/dist build.prop, resource files
2) Generate layoutlib SBOM that includes build.prop, resource files,
   font files and font configuration files
3) Generate SBOM of framework_res.jar with placeholders for substitution
   in release_layoutlib.sh

Bug: 303903787
Bug: 303904046
Bug: 303904808
Bug: 303905932
Bug: 303906000
Bug: 303906275
Test: lunch sdk_phone64_arm64-userdebug && m layoutlib dist
Change-Id: Ib004e199e740ccc901e93b11201db2477464be1d
2023-10-17 23:52:30 -07:00
Thiébaud Weksteen
62865caf1b Revert "Add sign_sepolicy_path for a binary to sign sepolicy.apex."
This reverts commit e0a977affd.

Test: atest --host releasetools_test
Bug: 297794885
Change-Id: I951277e4aa3ae1f90474a1f7a036fc8693453c53
2023-10-18 11:41:25 +11:00
Wei Li
6437bae07c Add zip2zip as a data dependency of releasetools_common so it is built with releasetools_common and other python_binary_host modules depend on releasetools_common.
Bug: 303082945
Test: CIs
Test: "m dev_sign_bundle" on internal udc branch and check zip2zip is built too.
Change-Id: Iad5aa401de39516876714c854dc07aeba2f234e5
2023-10-17 21:05:53 +00:00
Dennis Shen
4f358fd443 Merge "aconfig: support api behind a macro flag in c/cpp" into main 2023-10-17 17:09:09 +00:00
Dennis Shen
7c124e035f aconfig: support api behind a macro flag in c/cpp
Bug: b/299673148
Test: atest aconfig.test
Change-Id: I54011de7b8eb52c97a84a93aa1cb955a9eb02706
2023-10-17 13:58:22 +00:00
Yu Liu
3cfde0e5dd Change the sdk_version to core_current.
Bazel currently can't build core_platform yet and needs this lib to
build some java_aconfig_library.

Bug: 305255550
Test: CI
Change-Id: Ic94efe7888e35099618e2fdbbbb481168ed2bcf2
2023-10-13 18:16:52 +00:00
Treehugger Robot
0968914e2c Merge "Revert "Add a check that the staging directories don't..."" into main 2023-10-13 05:32:56 +00:00
Cole Faust
be5e391055 Revert "Add a check that the staging directories don't..."
Revert submission 2773149-partition_file_list_check

Reason for revert: b/305103467, b/305103783, b/305103468
Reverted changes: /q/submissionid:2773149-partition_file_list_check

Change-Id: I2fab3b4d7d24af4488e777ad84e12e280c42dcc0
2023-10-13 02:51:10 +00:00
Kelvin Zhang
d7924a5311 Add missing AB partitions to img.zip
Add all AB partitions to img.zip, so that we can verify integrity of a
build by running avbtool on img.zip .

Bug: 274923679
Test: img_from_target_files on a pixel build. Unzip the generated img
zip, run avbtool verify_image --follow_chain_partitions --image
vbmeta.img, make sure result is successful.

Change-Id: I7d586a6f2ad87d8ebf87b788947055339b1121a2
2023-10-12 10:31:44 -07:00
Cole Faust
80fad16d14 Add a check that the staging directories don't...
...contain extra files after an installclean.

Bug: 205632228
Test: m installclean && m
Change-Id: Ib021465d1089a21bc4f43306b1441348baf71f9c
2023-10-11 17:42:34 -07:00
Alex Buynytskyy
9ef1caabed Merge "Fix sepolicy finalization build error" into main 2023-10-11 15:31:43 +00:00
Dennis Shen
268e445503 Merge "aconfig: add missing string header to template" into main 2023-10-11 14:01:46 +00:00
Dennis Shen
da07fea741 aconfig: add missing string header to template
Bug: 304338314
Test: atest aconfig.test
Change-Id: I97e62ebd9df18d260fd272a8f63a004ba627de9b
2023-10-11 14:00:48 +00:00
Inseob Kim
4b11cd1a1c Fix sepolicy finalization build error
Bug: 304532197
Test: manually run finalization script
Change-Id: I29f62d7c703081302f1133e881e33fa2ff7d16bf
2023-10-11 22:57:58 +09:00
Treehugger Robot
dcbe60977c Merge "printflags: improve protobuf decode error message" into main 2023-10-11 13:05:02 +00:00
Zhi Dou
22a90f4f10 aconfig: add @UnsupportedAppUsage to methods in generated flags
The java generated flags are marked as @hide which breaks CTS. To
unblock CTS test add @UnsupportedAppUsage to expose the methods.

Test: atest aconfig.test.flags
Bug: 301272559
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:64ad75f50ae96f9a8b57a9e8f88ae9a53d3c1044)
Merged-In: I897573c054e70fc6e093869ba6d416c38f81e28f
Change-Id: I897573c054e70fc6e093869ba6d416c38f81e28f
2023-10-10 13:55:06 +00:00
Mårten Kongstad
6e61f84fd6 printflags: improve protobuf decode error message
Include the file path and first bytes of file in the error message in
case aconfig fails to parse one of the protobuf files.

Example output:

  $ adb shell printflags
  Error: failed to parse /vendor/etc/aconfig_flags.pb ([0a], 1 byte(s))

  Caused by:
      Unexpected EOF

Bug: 304278614
Test: atest printflags.test
Change-Id: I18ff88bd25d72dd477c4b11a32505e75884906ee
2023-10-10 10:12:29 +02:00
Kelvin Zhang
7d1b29bd5d Run validation on user specified vabc_compression_param
During OTA generation, we check the vabc compression param specified by
target files, and override compression param to gz if the specified
compression method is unsupported. Run the same validation on
compression param passed by --vabc_compression_param as well.

Test: th
Change-Id: If855a2ee8c3c280c74efd5a67df229ab6c5709c5
2023-10-09 16:47:19 -07:00
Treehugger Robot
050073eaab Merge "Add zip2zip as a required module of releasetools_common." into main am: 44a7f9ccb3
Original change: https://android-review.googlesource.com/c/platform/build/+/2772848

Change-Id: I8bfe04fed26bcb3a82c94958c535f0989961046d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-05 07:18:30 +00:00
Treehugger Robot
44a7f9ccb3 Merge "Add zip2zip as a required module of releasetools_common." into main 2023-10-05 06:46:26 +00:00
Wei Li
9e37cf263b Add zip2zip as a required module of releasetools_common.
zip2zip is used in function ZipDelete in common.py.

Bug: 303082945
Test: CIs
Change-Id: I7ff1189122aac4915d411b50a6cc76bd76d658f6
2023-10-04 22:23:13 -07:00
Dennis Song
a503a56283 Merge "Resolve conflict AVB rollback index location" into main am: 764585118f
Original change: https://android-review.googlesource.com/c/platform/build/+/2769020

Change-Id: I4f6d2278efb2f5553201d2ae15dfc9b176575972
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-04 17:48:05 +00:00
Treehugger Robot
006c13c27b Merge "Use deterministic salt for boot image avb footer" into main am: 2b181f9aa1
Original change: https://android-review.googlesource.com/c/platform/build/+/2768202

Change-Id: I834cfd2b29a2eb66f2f339108bfe9c511e6038f8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-04 17:47:15 +00:00
Dennis Song
764585118f Merge "Resolve conflict AVB rollback index location" into main 2023-10-04 17:16:11 +00:00
Dennis Song
4aae62ee77 Resolve conflict AVB rollback index location
Add an `--avb-resolve-rollback-index-location-conflict`
option in merge_target_files. When this option is set,
the merge tool will resolve conflicting index locations
by assigning the smallest unused index location.

This is to support merging system and vendor target files
from two different targets. In this case, the two target
files may have conflict rollback index location because
they were built independently.

Test: atest releasetools_test
Test: validate_target_files *-target_files-*.zip
Test: merge_target_files &&
        add_img_to_target_files &&
        img_from_target_files &&
        flash device
Bug: 300604688
Change-Id: Ibd18ef2a9f3784157fe17966f5364c3c81c9bd9f
2023-10-04 06:45:15 +00:00
Kelvin Zhang
de53f7df43 Use deterministic salt for boot image avb footer
avbtool by default generates a random salt everytime, this makes builds
less reproducible. Use sha256 checksum of kernel image as the hex to
make the build reproducible.

Test: th
Bug: 293313353

Change-Id: I959b3dee77654098ab9fde475f11eaee8d40c790
2023-10-03 12:26:08 -07:00
Zhi Dou
77cb4d4606 Merge "aconfig: change Map.of to Map.ofEntries in FakeFeatureFlagsImp" into main am: d61f2efdbb
Original change: https://android-review.googlesource.com/c/platform/build/+/2768479

Change-Id: I82bc0386acaf7effd4a2890deb7148570d739d91
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-03 18:33:05 +00:00
Zhi Dou
d61f2efdbb Merge "aconfig: change Map.of to Map.ofEntries in FakeFeatureFlagsImp" into main 2023-10-03 17:58:22 +00:00
Dennis Song
de693db329 Merge "Minor refactor tools/releasetools/common.py" into main am: 50e5fbd688
Original change: https://android-review.googlesource.com/c/platform/build/+/2769023

Change-Id: Ia0fdef30d550535aec9bd368535596198e2c6a9d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-03 06:58:00 +00:00
Dennis Song
6e5e44df72 Minor refactor tools/releasetools/common.py
- Sort the import modules in alphabetical order.
- Define module variables for avbtool arguments name.

Test: atest releasetools_test
Bug: 300604688
Change-Id: I7990b94cfc1d7b3e977ceb0a3dc2317689891229
2023-10-03 02:46:51 +00:00
Zhi Dou
b095acbc57 aconfig: change Map.of to Map.ofEntries in FakeFeatureFlagsImp
Map.of can only take 10 entries. Map.ofEntries uses variable arguments.

Bug: 303045451
Test: atest AconfigJavaHostTest
Change-Id: I26a3fa0b8a731f9203934d4a800a5c695cfc730f
2023-10-02 23:57:10 +00:00