Android: Fix Android 16 emulator CI start problems

This patch updates the fully booted check for Android.

Old logic used init.svc.bootanim property and it's status
"stopped", but since Android 16 forward the status is kept
empty "" if "-no-boot-anim" emulator startup parameter is used.

The new logic simplifies old and relies only to two values:
sys.boot_completed and dev.bootcomplete. These work similary
from Android 9 to 16.

Task-number: QTQAINFRA-7399
Task-number: QTQAINFRA-7298
Pick-to: 6.8
Change-Id: I62efb0b05cd9792f92040dcb98a37f4bf14022e6
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Elias Toivola <elias.toivola@qt.io>
(cherry picked from commit 0eb085f93d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 9f42f33194)
This commit is contained in:
Rami Potinkara 2025-09-02 12:34:22 +03:00
parent 1072961496
commit 414316f8ee
1 changed files with 8 additions and 10 deletions

View File

@ -25,13 +25,12 @@ function check_for_android_device
}
# WARNING: On the very first boot of the emulator it happens that the device
# "finishes" booting and getprop shows bootanim=stopped and
# boot_completed=1. But sometimes not all packages have been installed (`pm
# list packages` shows only 16 packages installed), and after around half a
# minute the boot animation starts spinning (bootanim=running) again despite
# boot_completed=1 all the time. After some minutes the boot animation stops
# again and the list of packages contains 80 packages. Only then the device is
# fully booted, and only then is dev.bootcomplete=1.
# "finishes" booting and getprop shows boot_completed=1. But sometimes not all
# packages have been installed (`pm list packages` shows only 16 packages
# installed), and after around half a minute the boot animation starts spinning
# again despite boot_completed=1 all the time. After some minutes the boot
# animation stops again and the list of packages contains 80 packages.
# Only then the device is fully booted, and only then is dev.bootcomplete=1.
#
# To reproduce the emulator booting as the first time, you have to delete the
# cached images found inside $HOME/.android/avd/{avd_name}.avd/ especially the
@ -39,11 +38,10 @@ function check_for_android_device
function check_if_fully_booted
{
# The "getprop" command separates lines with \r\n so we trim them
bootanim=$( timeout 1 "$ADB_EXEC" shell getprop init.svc.bootanim | tr -d '\r\n')
boot_completed=$(timeout 1 "$ADB_EXEC" shell getprop sys.boot_completed | tr -d '\r\n')
bootcomplete=$( timeout 1 "$ADB_EXEC" shell getprop dev.bootcomplete | tr -d '\r\n')
echo "bootanim=$bootanim boot_completed=$boot_completed bootcomplete=$bootcomplete"
[ "$bootanim" = stopped ] && [ "$boot_completed" = 1 ] && [ "$bootcomplete" = 1 ]
echo "boot_completed=$boot_completed bootcomplete=$bootcomplete"
[ "$boot_completed" = 1 ] && [ "$bootcomplete" = 1 ]
}
for counter in $(seq ${EMULATOR_MAX_RETRIES})