From 414316f8ee6ced40217cc597db05167a3ac0f7d2 Mon Sep 17 00:00:00 2001 From: Rami Potinkara Date: Tue, 2 Sep 2025 12:34:22 +0300 Subject: [PATCH] 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 Reviewed-by: Assam Boudjelthia Reviewed-by: Elias Toivola (cherry picked from commit 0eb085f93ddef133aeee2dbcc5cb9b241774300c) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 9f42f331947e911cc6a0da33b11c3ed849b050b8) --- .../common/linux/android_emulator_launcher.sh | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/coin/provisioning/common/linux/android_emulator_launcher.sh b/coin/provisioning/common/linux/android_emulator_launcher.sh index 351a04f9..bd89fe1a 100755 --- a/coin/provisioning/common/linux/android_emulator_launcher.sh +++ b/coin/provisioning/common/linux/android_emulator_launcher.sh @@ -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})