Retrieve terminal info in a more robust way

Previously, it was possible for onServiceUpdated is called "after" the
service is destroyed due to an early exit of the application. When that
happened, we got RejectedExecutionException because the executor service
given to the NsdManager is shutdown as part of the service destroyal.

This CL fixes that by having a dedicated executor service for NsdManager
and shut it down upon onServiceInfoCallbackUnregistered, which means
there will be no more callbacks.

This CL also does some pending refactorings;

* Retrival of the terminal service info (ip addr & port) is deduped
  across MainActivity and VmLauncherService

* Uses CompletableFuture to abstract the retrival of the terminal
  service info.

Bug: 401041913
Test: try to kill the app before the terminal is connected
Change-Id: Ie268601317f040c2da9d33d31b2b9d1f9e475b61
2 files changed
tree: a7bbf61fb78b9d6317c69988f1a18d16e12c1a66
  1. android/
  2. build/
  3. docs/
  4. guest/
  5. libs/
  6. microfuchsia/
  7. tests/
  8. .clang-format
  9. .gitignore
  10. Android.bp
  11. dice_for_avf_guest.cddl
  12. OWNERS
  13. PREUPLOAD.cfg
  14. README.md
  15. rustfmt.toml
  16. TEST_MAPPING
README.md

Android Virtualization Framework (AVF)

Android Virtualization Framework (AVF) provides secure and private execution environments for executing code. AVF is ideal for security-oriented use cases that require stronger isolation assurances over those offered by Android’s app sandbox.

Visit our public doc site to learn more about what AVF is, what it is for, and how it is structured. This repository contains source code for userspace components of AVF.

If you want a quick start, see the getting started guideline and follow the steps there.

For in-depth explanations about individual topics and components, visit the following links.

AVF components:

AVF APIs:

How-Tos: