Implement memory ballooning in Terminal App

This change implements memory ballooning in the Terminal App to
dynamically adjust the memory allocated to the VM.

The Application class now includes an ApplicationLifecycleObserver which
binds to the VmLauncherService and sends lifecycle events (onStart,
onStop). The VmLauncherService then calls setMemoryBalloonByPercent() on
the VirtualMachine instance to adjust the memory. On application start
(onStart), the memory balloon is deflated (0%), maximizing available
memory for the app. On application stop (onStop), the memory balloon is
inflated (10%), allowing the system to reclaim memory while the app is
in the background.

Bug: b/392791968
Test: Maunual test memory balloon works in Terminal App
Test: Verify setMemoryBalloon() is not called if memory balloon disabled

Change-Id: I26e9bd944b29c27831f54be8b4ddba8c29020a5a
4 files changed
tree: d64d5ab3dbae4c77d15ed7baf2b3e88c51be43c5
  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: