Commit graph

4 commits

Author SHA1 Message Date
Alyssa Ketpreechasawat
74dabedcb3 Use build flag to control the apex boot jars to be excluded.
Different prebuilts might have different contents and thus, different
boot jars to be removed from the existing apex boot jar lists e.g. next
using U prebuilts would need to remove framework-pdf while ap31 with V
prebuilts must not remove such. The existing mechanism will always
remove framework-pdf whenever prebuilts are enabled regardless of
release config, which is not correct in context of multiple prebuilt
support.

Ignore-AOSP-First: for successful build, we need to submit this togther with ag/26332775. this cl will get cp'ed into aosp later on
Bug: 327022391
Test: build device in next and trunk
Merged-In: I9949fb7075ab6c207a292f13fd75e010a4958f87
Change-Id: I9949fb7075ab6c207a292f13fd75e010a4958f87
2024-02-29 02:26:44 +00:00
Jiakai Zhang
53dd895407 Determine GC type based on BUILT_KERNEL_VERSION_FILE.
How it works:
1. build/make/core/Makefile generates a txt file with the kernel
   version, which is taken from an explicit BOARD_KERNEL_VERSION value,
   or extracted from the kernel image on the source tree, or extracted
   from the kernel image extracted from the prebuilt boot.img.
   The file is saved at
   $ANDROID_PRODUCT_OUT/obj/PACKAGING/check_vintf_all_intermediates/kernel_version.txt.
2. If PRODUCT_ENABLE_UFFD_GC is "default", meaning the GC type needs to
   be determined by the kernel version, build/make/core/Makefile copies
   kernel_version.txt to
   out/soong/dexpreopt/kernel_version_for_uffd_gc.txt.
3. build/soong/dexpreopt/config.go writes the the UFFD GC flag to
   out/soong/dexpreopt/uffd_gc_flag.txt. The flag is determined by an
   explicit PRODUCT_ENABLE_UFFD_GC value or by contruct_uffd_gc_flag.py,
   which reads kernel_version_for_uffd_gc.txt and determines the flag
   accordingly.
4. dex2oat takes the UFFD GC flag from uffd_gc_flag.txt.
5. post_process_props.py mangles ro.dalvik.vm.enable_uffd_gc based on
   the same logic.

Bug: 321751629
Bug: 319554951
Bug: 318763448
Bug: 319648491
Test: m --no-skip-soong-tests nothing
Test: atest uffd_gc_utils_test
Test: Build with `OVERRIDE_ENABLE_UFFD_GC=default m` for device with no
  UFFD support -
  1. Check the existence of `-Xgc:CMC` in
     out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm64/boot.invocation
     (dex2oat invocation for a boot image)
  2. Check the existence of `-Xgc:CMC` in
     out/soong/.intermediates/packages/apps/Settings/Settings/android_common/dexpreopt/Settings/oat/arm64/package.invocation
     (dex2oat invocation for an app defined in .bp)
  3. Check the existence of `-Xgc:CMC` in
     $ANDROID_PRODUCT_OUT/obj/APPS/Dialer_intermediates/oat/arm64/package.invocation
     (dex2oat invocation for an app defined in .mk)
  4. Check the value of ro.dalvik.vm.enable_uffd_gc in
     $ANDROID_PRODUCT_OUT/product/etc/build.prop
Test: Build with `OVERRIDE_ENABLE_UFFD_GC=default m` for device with
  UFFD support, and do the steps above.
Test: Build with `OVERRIDE_ENABLE_UFFD_GC=true m`, and do the steps
  above.
Test: Build with `OVERRIDE_ENABLE_UFFD_GC=false m`, and do the steps
  above.

Change-Id: I8df6e5be1644da05d2d5c57b3520f29601dfd7a4
2024-02-01 22:10:33 +08:00
Alyssa Ketpreechasawat
ba231d2084 Remove jars in PRODUCT_APEX_BOOT_JARS_FOR_SOURCE_BUILD_ONLY (e.g. framework-pdf in MP) from ApexBootJars when prebuilt is enabled.
framework-pdf is newly added framework jar which is not yet included in
the actual prebuilt apex. Thus, we add it PRODUCT_APEX_BOOT_JARS_FOR_SOURCE_BUILD_ONLY. The APEX_BOOT_JARS_EXCLUDED will be created based on PRODUCT_APEX_BOOT_JARS_FOR_SOURCE_BUILD_ONLY and will be removed from ApexBootJars.

Bug: 304719212
Test: lunch cf_x86_phone-next-userdebug & m
Test: lunch cf_x86_phone-trunk-userdebug & m
Change-Id: I9902131629900fbd629b8560a422ed8c2b06073c
2023-11-13 13:22:32 +00:00
Jiakai Zhang
d6c6e3a9f3 Determine whether to enable userfaultfd GC at build time.
This is determined by:
- a product config flag
- the vendor API level

It is then passed to the device as a system property
"ro.dalvik.vm.enable_uffd_gc".

This change is a no-op change. It doesn't enable userfaultfd GC by
default. OVERRIDE_ENABLE_UFFD_GC=default can be passed to the build
system to enable userfaultfd GC for testing purposes.

Bug: 242553398
Test: -
  1. lunch aosp_redfin-userdebug
  2. OVERRIDE_ENABLE_UFFD_GC=default build/soong/soong_ui.bash --dumpvars-mode --vars=ENABLE_UFFD_GC
  3. See "false" in the output
Test: -
  1. lunch aosp_oriole-userdebug
  2. OVERRIDE_ENABLE_UFFD_GC=default build/soong/soong_ui.bash --dumpvars-mode --vars=ENABLE_UFFD_GC
  3. See "true" in the output
Test: -
  1. lunch aosp_redfin-userdebug
  2. OVERRIDE_ENABLE_UFFD_GC=true build/soong/soong_ui.bash --dumpvars-mode --vars=ENABLE_UFFD_GC
  3. See "true" in the output
Test: -
  1. lunch aosp_oriole-userdebug
  2. OVERRIDE_ENABLE_UFFD_GC=false build/soong/soong_ui.bash --dumpvars-mode --vars=ENABLE_UFFD_GC
  3. See "false" in the output
Change-Id: Ifd6e6cddb502315912ff949619a5b526ae0d73ff
2022-11-17 16:33:44 +00:00