Skip to content

Commit

Permalink
Only enable Pre-reboot Dexopt if version >= 2.
Browse files Browse the repository at this point in the history
Version 2 contains a fix to make umount succeed.

Bug: 346869873
Test: -
  1. Turn on system tracing (Settings -> System -> Developer options -> System Tracing -> Record CPU profile).
  2. system/update_engine/scripts/update_device.py <ota-package-zip>
Change-Id: Ie255217bb3a14648d94197020bb733d01f0733b4
  • Loading branch information
jiakaiz-g committed Jun 14, 2024
1 parent 86719bf commit ad291ba
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions cmds/installd/otapreopt_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,27 @@ function infinite_source {
done
}

# Delegate to Pre-reboot Dexopt, a feature of ART Service.
# ART Service decides what to do with this request:
# - If Pre-reboot Dexopt is disabled or unsupported, the command returns
# non-zero. This is always the case if the current system is Android 14 or
# earlier.
# - If Pre-reboot Dexopt is enabled in synchronous mode, the command blocks
# until Pre-reboot Dexopt finishes, and returns zero no matter it succeeds or
# not. This is the default behavior if the current system is Android 15.
# - If Pre-reboot Dexopt is enabled in asynchronous mode, the command schedules
# an asynchronous job and returns 0 immediately. The job will then run by the
# job scheduler when the device is idle and charging.
if infinite_source | pm art on-ota-staged --slot "$TARGET_SLOT_SUFFIX"; then
# Handled by Pre-reboot Dexopt.
exit 0
PR_DEXOPT_JOB_VERSION="$(pm art pr-dexopt-job --version)"
if (( $? == 0 )) && (( $PR_DEXOPT_JOB_VERSION >= 2 )); then
# Delegate to Pre-reboot Dexopt, a feature of ART Service.
# ART Service decides what to do with this request:
# - If Pre-reboot Dexopt is disabled or unsupported, the command returns
# non-zero. This is always the case if the current system is Android 14 or
# earlier.
# - If Pre-reboot Dexopt is enabled in synchronous mode, the command blocks
# until Pre-reboot Dexopt finishes, and returns zero no matter it succeeds or
# not. This is the default behavior if the current system is Android 15.
# - If Pre-reboot Dexopt is enabled in asynchronous mode, the command schedules
# an asynchronous job and returns 0 immediately. The job will then run by the
# job scheduler when the device is idle and charging.
if infinite_source | pm art on-ota-staged --slot "$TARGET_SLOT_SUFFIX"; then
# Handled by Pre-reboot Dexopt.
exit 0
fi
echo "Pre-reboot Dexopt not enabled. Fall back to otapreopt."
else
echo "Pre-reboot Dexopt is too old. Fall back to otapreopt."
fi
echo "Pre-reboot Dexopt not enabled. Fall back to otapreopt."

if [ "$(/system/bin/otapreopt_chroot --version)" != 2 ]; then
# We require an updated chroot wrapper that reads dexopt commands from stdin.
Expand Down

0 comments on commit ad291ba

Please sign in to comment.