Fix race condition between authfs_service and /data mounted

Currently there is a race condition between authfs_service starting and
/data/misc/authfs directory being created. If authfs_service is started
before the /data/misc/authfs has been created then authfs_service will
exit abnormally. One way this race condition is surface is
android.compos.test.ComposTestCase#testOdrefreshSpeedProfile being
flaky.

This change attempts to fix the race condition by starting the
authfs_service on post-fs-data trigger, which guarantees that
/data/misc/authfs has been prepared.

In more detail this change includes:

* Introducing new setup_config_syspros function inside the
  microdroid_manager. This function is responsible for setting sysprops
  derived from the payload config, e.g. if config has enable_authfs,
  then microdroid.config.enable_authfs sysprop will be set. Once all the
  necessary sysprops were set, microdroid_manager will set the
  microdroid.config_done property.
* Adding wait_for_prop microdroid.config_done before triggering
  post-fs-data action in the init.rc
* Adding on post-fs-data && prop:microdroid.config.enable_authfs=1
  trigger to start authfs_service
* Moving setprop dev.bootcomplete to on boot action, and switching
  microdroid_manager to wait for the dev.bootcomplete property before
  running the payload.

The first three points should get rid of the race condition with
authfs_service startup, while the last one should guarantee that by the
time payload runs the authfs_service is already running.

Bug: 260361248
Bug: 260005615
Test: presubmit
Test: atest --iterations 20 android.compos.test.ComposTestCase#testOdrefreshSpeedProfile
Change-Id: Ib8d2dde5f340ffead9e681c18fa8dd18ba2dd859
2 files changed
tree: 793d1132a1197666035d79b2b94b4a2f5f3264ba
  1. apex/
  2. apkdmverity/
  3. authfs/
  4. avmd/
  5. compos/
  6. demo/
  7. docs/
  8. encryptedstore/
  9. javalib/
  10. launcher/
  11. libs/
  12. microdroid/
  13. microdroid_manager/
  14. pvmfw/
  15. rialto/
  16. tests/
  17. virtualizationservice/
  18. vm/
  19. vm_payload/
  20. vmbase/
  21. vmclient/
  22. zipfuse/
  23. .clang-format
  24. .gitignore
  25. Android.bp
  26. OWNERS
  27. PREUPLOAD.cfg
  28. README.md
  29. TEST_MAPPING
README.md

Virtualization

This repository contains userspace services related to running virtual machines on Android, especially protected virtual machines. See the getting started documentation and Microdroid README for more information.