Microdroid: wait for apexd.status=ready instead of activated in init.rc

This fixes a race condition. See
I8a5ebfcb82569eb098391c7860e6a6afd31d3650 for a similer fix in
minidroid.

Bug: 271275085
Test: manually, by running the microdroid sample on a VM in cuttlefish
Test: 1. as it is
Test: 2. by locally adding two times 5 seconds sleeps
  (`wait /only-wait 5`) before wait_for_prop apexd.status ready to
  trigger the deadlock.
Change-Id: Ia3250f098f1d87700351d3c179e31471167e90ed
This commit is contained in:
Istvan Nador 2023-03-16 16:31:14 +00:00
parent 563018f2af
commit ae0c2f5df4
1 changed files with 4 additions and 1 deletions

View File

@ -35,7 +35,10 @@ on init
restorecon /mnt/extra-apk
# Wait for apexd to finish activating APEXes before starting more processes.
wait_for_prop apexd.status activated
# Microdroid starts apexd in VM mode in which apexd doesn't wait for init after setting
# apexd.status to activated, but immediately transitions to ready. Therefore, it's not safe to
# wait for the activated status, by the time this line is reached it may be already be ready.
wait_for_prop apexd.status ready
perform_apex_config
# Notify to microdroid_manager that perform_apex_config is done.