Share a single VirtualMachine object for VMs

VirtualMachineManager.get() has always been returning a new
VirtualMachine object. This can cause confusion because VirtualMachine
object stores the VM's binder object which isn't shared among instances.
So it may be possible to run multiple guest VMs on a single instance,
which isn't advised.

This fixes it by maintaining a map from the VM to the corresponding
unique VirtualMachine object. VirtualMachineManager.get() will return an
existing object, rather than creating a new one. The mapping is removed
when the VM is deleted.

Bug: 238692795
Test: atest MicrodroidTests
Change-Id: Ie273e9118f4986aebf336b415d0e87a061228e1b
2 files changed
tree: 44be85fda1d10eb61f96bccc1bcc8d76c80e5ee7
  1. .prebuilt_info/
  2. apex/
  3. apkdmverity/
  4. authfs/
  5. avmd/
  6. compos/
  7. demo/
  8. docs/
  9. javalib/
  10. launcher/
  11. libs/
  12. microdroid/
  13. microdroid_manager/
  14. pvmfw/
  15. rialto/
  16. tests/
  17. virtualizationservice/
  18. vm/
  19. vmbase/
  20. vmclient/
  21. zipfuse/
  22. .clang-format
  23. .gitignore
  24. Android.bp
  25. OWNERS
  26. PREUPLOAD.cfg
  27. README.md
  28. 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.