Fix the logic of parsing profilebootclasspath flags.
There are two pieces of code that parse profilebootclasspath sysprops:
one in ZygoteInit.java
(https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/com/android/internal/os/ZygoteInit.java;l=359;drc=6cbc807a6f11f43054d0d0ff0221bb3e6ab35d1c)
and one in AndroidRuntime.cpp
(https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/jni/AndroidRuntime.cpp;l=704-714;drc=ff1ed5d78df2edaaf1e51e2434548a66cd124366).
Before this change, there are two inconsistencies between them:
1. AndroidRuntime.cpp prefers the "dalvik.vm" property, while
ZygoteInit.java prefers the phenotype flag.
2. AndroidRuntime.cpp only accepts "true", while ZygoteInit.java accepts
"1", "y", "yes", "on", and "true".
The device goes into a weird state when the flags are set in a way that
makes the two pieces of code disagree with each other.
This CL changes the logic in AndroidRuntime.cpp to make it the same as
the one in ZygoteInit.java.
Bug: 258486155
Test: -
1. adb shell setprop dalvik.vm.profilebootclasspath false
2. adb shell setprop dalvik.vm.profilesystemserver false
3. adb shell device_config set_sync_disabled_for_tests persistent
4. adb shell device_config put runtime_native_boot profilebootclasspath true
5. adb shell device_config put runtime_native_boot profilesystemserver true
6. adb shell stop && adb shell start
7. adb shell killall -USR1 system_server
8. adb shell profman --dump-only --profile-file=/data/misc/profiles/cur/0/android/primary.prof
9. See the boot image profile being properly generated.
Test: -
1. adb shell setprop dalvik.vm.profilebootclasspath 1
2. adb shell setprop dalvik.vm.profilesystemserver 1
3. adb shell stop && adb shell start
4. adb shell killall -USR1 system_server
5. adb shell profman --dump-only --profile-file=/data/misc/profiles/cur/0/android/primary.prof
6. See the boot image profile being properly generated.
Change-Id: Ifef5a45b47427bc16e0799046bdffc5ab1747e9a
1 file changed