Commit graph

31 commits

Author SHA1 Message Date
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
Justin Yun
23d52435f3 Define BOARD_API_LEVEL and BOARD_API_LEVEL_FROZEN
BOARD_API_LEVEL and BOARD_API_LEVEL_FROZEN are set by the release
flags.
BOARD_API_LEVEL sets ro.board.api_level that shows the API level of
the vendor API surface.
BOARD_API_LEVEL_FROZEN sets ro.board.api_frozen that shows if the
ro.board.api_level is finalized.

Bug: 295269182
Test: getprop ro.board.api_level
Change-Id: Ie57c57b6c9f1fc0c98968195843059a48da8e512
2023-11-10 16:31:04 +09:00
Justin Yun
870ea2e188 Allow setting future api level before REL
At the dev stage, devices may set ro.board.(first_)api_level to the
future API level

Bug: 276927022
Test: test_post_process_props.py
Change-Id: I85c29af74ed8daa780278f64b023480bb6659781
2023-04-10 15:37:19 +09:00
Albert Wang
6b7769358f Revert "Turn off adb on user builds."
This reverts commit 8ad4bb16a0.

Bug: 184103246
Test: forrest test build
Change-Id: I9111ae2d6150dfed86c785e6db205c64e4c8d5e0
2022-01-27 00:52:01 +00:00
Justin Yun
48aa78ed3c Remove grf_required_api_level
As we don't fix the grf window, we may not calculate the grf
expiration date and the required api level.
The verification of this will be covered by the tests at run time.

Bug: 176950752
Test: atest --host post_process_props_unittest
Change-Id: I1205f0d9a9da5bc508a49acbcbb7da581800bf45
2021-04-13 17:58:59 +09:00
Justin Yun
07ceaa71c1 Use BOARD_API_LEVEL to define ro.board.api_level
GRF devices must define the API level of which the SoC is first
shipped by setting BOARD_SHIPPING_API_LEVEL. As this is a permanent
value, vendors may not change this value even if they implement new
features under the GRF policy.

BOARD_API_LEVEL can be optionally defined in this case to manually
set the api level of the vendor implementation.
The current api level will be set to `ro.board.api_level` property.

Bug: 176950752
Test: atest --host post_process_props_unittest
Change-Id: Ib126c1a622ded9848650f3f60c0f15005867272d
2021-04-06 16:33:07 +09:00
Jiyong Park
24d9cad563 Handle the case when non-optional props have the same value
foo=true
foo=true
foo?=false

Consider the above case: Then the duplication of foo is allowed because
they have the same value (true). However, there was a bug that the
optional assirgnment foo?=false is left unmodified.

This fixes the bug by commenting such optional assignments.

Exempt-From-Owner-Approval: fixes a broken build

Bug: 117892318
Bug: 158735147
Test: atest test_post_process_props
Test: m out/target/product/vsoc_x86/vendor/build.prop for  cf_x86_auto

Exempt-From-Owner-Approval: cherry-pick from master

Merged-In: Iba9b61d9779d93e86d9bead2286f945f8d51ab1d
(cherry picked from commit 9a32636759)
Change-Id: Iba9b61d9779d93e86d9bead2286f945f8d51ab1d
2020-06-30 18:44:51 +09:00
Jiyong Park
0b4fccb66d BUILD_BROKEN_DUP_SYSPROP as escape hatch for the new sysprop restriction
As the final step for the refactoring of sysprop configuration, this
change adds BUILD_BROKEN_DUP_SYSPROP which is the escape hatch for
the new restriction. When it is turned on, the new syntax `a ?= b`
collapses to the old syntax `a = b`, duplicated assignments are allowed,
and the dups are resolved following the legacy rule of preferring the
first.

This change also summarizes all the user-facing changes to the Change.md
file.

Lastly, post_process_prop.py is refactored to accept new argument
'--allow-dup' which when turned on allowes duplicated sysprops.

Bug: 117892318
Bug: 158735147
Test: atest --host post_process_prop_unittest

Exempt-From-Owner-Approval: cherry-pick from master

Merged-In: I7bdfffd47d50aad66a78e28a30c3dad7ebac080c
(cherry picked from commit b302cdf6a4)
Change-Id: I7bdfffd47d50aad66a78e28a30c3dad7ebac080c
2020-06-30 18:44:40 +09:00
Jiyong Park
d721e870bc Support optional prop assignments
This CL adds a number of changes to make the assignment of system
properties to be less confusing.

1. Added `a ?= b` syntax, which is called optional prop assignments. The
prop `a` gets the value `b` only when there is no non-optional prop
assignment for `a` such as `a = c`. This is useful for props that
provide some reasonable default values as fallback.

2. With the introduction of the optional prop assignment syntax,
duplicated non-optional assignments is prohibited; e.g., the follwing
now triggers a build-time error:

a = b
a = c

, but the following doesn't:

a ?= b
a = c

Note that the textual order between the optional and non-optional
assignments doesn't matter. The non-optional assignment eclipses the
optional assignment even when the former appears 'before' the latter.

a = c
a ?= b

In the above, `a` gets the value `c`

When there are multiple optional assignments without a non-optional
assignments as shown below, the last one wins:

a ?= b
a ?= c

`a` becomes `c`. Specifically, the former assignment is commented out
and the latter is converted to a non-optional assignment.

3. post_process_props.py is modified so that when a prop assignment is
deleted, changed, or added, the changes are recorded as comments. This
is to aid debugging. Previously, it was often difficult to find out why
a certain sysprop assignment is missing or is added.

4. post_process_prop.py now has a unittest

Bug: 117892318
Bug: 158735147
Test: atest --host post_process_prop_unittest

Exempt-From-Owner-Approval: cherry-pick from master

Merged-In: I9c073a21c8257987cf2378012cadaeeeb698a4fb
(cherry picked from commit 7aeb8de74e)
Change-Id: I9c073a21c8257987cf2378012cadaeeeb698a4fb
2020-06-30 18:44:01 +09:00
Jiyong Park
cc49c6b8cd Leave a comment when removing a prop
post_process_prop.py doesn't simply drop a line when deleting a prop.
Instead, it makes the line as comment and leave a comment to clearly
mark that the prop was force removed. This is to aid the debugging.

Bug: 117892318
Test: m

Change-Id: I53c05800ff71d431a56dc370bcfe8bfc95c03bfc
2020-06-08 10:09:12 +09:00
Jiyong Park
ae55638f75 Refactor post_process_props.py
The script is refactored to not parse lines everytime a prop is looked
up or updated.

Also it is now built using python_binary_host.

Bug: 117892318
Test: m

Change-Id: I1677ca5aa919c54b7b0740fdc52e1399009f9a12
2020-05-27 12:52:44 +09:00
Jiyong Park
58dd353a07 remove code for default.prop
default.prop files are gone. Remove the code in post_process_prop.py
that handles the file.

Bug: 1313599
Test: m

Change-Id: I3b4ff4adac57a406b70300d34ece7028cb52eb2d
2020-05-27 12:52:43 +09:00
Tom Cherry
47b3003e9b Merge "Allow ro. properties to have arbitrary lengths"
am: 1d6e8e31d0

Change-Id: I4a3872a59ba39289bf58741e19ca05b9b9c7bbee
2017-10-17 22:42:04 +00:00
Tom Cherry
47c4eb4680 Allow ro. properties to have arbitrary lengths
Bug: 23102347
Bug: 34954705
Test: provide a fingerprint >92 characters long and see that it
      successfully works

Change-Id: Ida9ffd5266acb3b432b208780804a08e8f7391b4
2017-10-12 09:21:48 -07:00
Hung-ying Tyan
f829b40c48 Move /default.prop to /system/etc/prop.default
This patch tries to fix the problem where the default properties need
to go with the system image especially on non-AB devices where
/default.prop is on the ramdisk image. A symlink is created at
/default.prop for backward compatibility.

Bug: 37815285
Test: Tested with ag/2416542. Booted pixel phones, checked the location
      of prop.default, verified the symlink, checked a few properties
      (via adb shell getprop) and manually tested a few apps (Camera,
      Maps etc).
      sign_target_files_apks.py was tested with:
      sign_target_files_apks -o -e DynamiteLoader.apk= -e DynamiteModulesA.apk= \
          -e DynamiteModulesB.apk= -e DynamiteModulesC.apk= -e DynamiteModulesD.apk= \
          -e GoogleCertificates.apk= out/dist/*-target_files-*.zip signed-target_files.zip
      Booted to recovery and ran 'adb sideload' successfully.
Change-Id: I1a9a2ba49c8252afc13ced3dea71253afbd3091e
2017-06-27 15:05:17 +08:00
Elliott Hughes
41232ebd5c Merge "There's no longer a limit on property names." am: dda91dbef8 am: daac92eb51
am: 319fcc7668

Change-Id: Idb24042310fa9de8f534e9988285a16b714daf10
2017-02-28 20:22:56 +00:00
Elliott Hughes
05c1a2a55c There's no longer a limit on property names.
Bug: http://b/33926793
Test: boots
Change-Id: I12cdae782090fb0856171e5c90a268e91ba2ae1a
2017-02-28 10:04:23 -08:00
Jaekyun Seok
8bee120006 Split vendor's system prop overrides into vendor partition
If ENABLE_TREBLE and early mount of vendor partition are enabled,
overrides in PRODUCT_DEFAULT_PROPERTY_OVERRIDES will be stored in
vendor/default.prop.

If ENABLE_TREBLE and vendor partition are enabled, overrides in
PRODUCT_PROPERTY_OVERRIDES will be stored in vendor/build.prop.

default.prop of recovery image will include all the contents of
vendor/default.prop and vendor/build.prop additionally.

ENABLE_EARLY_MOUNT is added to specify whether early mount is enabled
or not, but it should be removed later when early mount becomes
default for all ENABLE_TREBLE products.

Test: building succeeded, and verified on bullhead.
Bug: 34116668
Change-Id: Ic2eb8882ae71921a76c02b3d62d3289c45949295
2017-02-03 12:42:33 +09:00
Jerry Zhang
1695653bb2 Revert "Remove automatic adding of adb into default.prop"
This reverts commit 3c51c2bc48.

Bug: 32223614
Change-Id: I1addc93b175e9442d9fc2f5e7a557fe818201a27
2016-10-18 00:01:27 +00:00
Jerry Zhang
3c51c2bc48 Remove automatic adding of adb into default.prop
Default.prop can interfere with UsbDeviceManager's management of usb state.
Adb is now enabled for userdebug and eng builds directly from UsbDeviceManager.

Bug: 31814300
Test: Manually verified that logcat is not kicked
Change-Id: I69c998c0dd184f9440cc236d82cc2f25f36e8734
2016-10-13 17:18:03 -07:00
Oreste Salerno
420e341a36 Do not add 'adb' to persist.sys.usb.config if already there
The 'adb' configuration might have already been added by a
device-specific Makefile, so add it only if it's not already there.

Change-Id: I6f96645f44c96f6f827cc8c842a8b769f92be13a
2015-05-29 07:46:40 +00:00
Ying Wang
38df101343 Fail even dev build when property value exceeds length limit.
Let developers know the issue earlier when they set up new
products.

Change-Id: I3f2ecbc3a833c1a8a84bd75407a5c035e5fea70a
2015-02-04 15:10:59 -08:00
Brian Carlstrom
4a5a11e416 resolved conflicts for merge of a8138028 to lmp-dev-plus-aosp
Change-Id: I5573d097d741f4922b791b33de5c941af08127c6
2014-07-30 09:53:12 -07:00
Brian Carlstrom
dad2ab4df4 Add PROP_NAME_MAX validation
Change-Id: I49179c83ae163de6f6fb398c5de60c5d296ca009
2014-07-29 16:13:18 -07:00
Ying Wang
5a7ad0338b Accomodate to the import syntax in build.prop.
Bug: 14024566
Change-Id: I70b8d3c8cfc968a7f039728375f3f7f341cdc11a
2014-04-15 12:37:13 -07:00
Jeff Sharkey
26d22f7139 Import OEM build properties, if defined.
Certain products can define a list of system properties that should be
delegated to the OEM.  Since these properties may be ro.*, we give
them first shot at defining.

Also support blacklist of properties that should never be defined by
build.prop, used to delegate to runtime fingerprint generation.

Bug: 13367676
Change-Id: I3f00db732f485818205a7b76b31edbdc3a89aac0
2014-03-21 13:22:54 -07:00
Ying Wang
351232107e Refactor a little bit and do the validation on also default.prop.
Change-Id: I76c2344d9033eadede7048689a879c9a69a05b7f
2014-02-12 10:32:47 -08:00
Yu Liu
115c66bd74 A build property's value is returned empty in runtime when its length
exceeds 92 symbols (91 valid symbols + \0). It is better to catch that
issue on earlier stage, i.e. fail the build with an appropriate message.

For developer's build, show warning message instead of failing the build
(in the latter case, as developers do not usually care about build properties
too much).

Change-Id: I03ced7b486d43a71b1921e0a9c48b43aa30727c7
2014-02-11 15:31:49 -08:00
Joe Onorato
8ad4bb16a0 Turn off adb on user builds.
Tungsten is the first device we have done since post_process_props.py
and UsbDeviceManager were added that by default has no services running
on usb. Everything else has mtp.  This makes it so we always populate
the property with something.

Change-Id: Ic24f52462ed8866e87499c715dd21937e5b1128d
2012-05-02 14:36:57 -07:00
Mike Lockwood
5b65ee4974 post_process_props: Write mangled properties back to file instead of stdout
Change-Id: I78b642400c46019165f12d409a238344ca6e09dd
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-08 19:06:43 -07:00
Joe Onorato
9197a487b4 post process the system properties
Change-Id: Ib78fe238d90dd4523326e4fa088d9333edc9e299
2011-06-08 16:04:14 -07:00