A workaround for ChooserActivity memory leak

Add ScopedAppTargetListCallback class to wrap AppPredictor callbacks
that breaks the callback reference chain when the specified scope gets
closed.

Bug: 290971946
Test: Launch Chooser multiple times in a row, collect heapdump with
a forced garbage collection, verify that:
  * there are no ChooserActivity objects in the dump;
  * there are multiple ScopedAppTargetListCallback instances in the dump
    with AppPredictor$CallbackWrapper in their GC root path.
Test: manual functionality smoke tests: activity configuration changes,
pinning targets (all triggers content reloading).
Test: unit tests

Change-Id: I5099eb7527098a90b3e00bb848eb41e2bc7d14d6
4 files changed
tree: 3fde22c2e0b936210da791d0b5b1cafeadf72e84
  1. aconfig/
  2. java/
  3. .clang-format
  4. Android.bp
  5. AndroidManifest-app.xml
  6. AndroidManifest-lib.xml
  7. OWNERS
  8. PREUPLOAD.cfg
  9. proguard.flags
  10. README.md
  11. TEST_MAPPING
README.md

IntentResolver

About

IntentResolver provides the implementation for Intent ACTION_CHOOSER

See also: ShareCompat.IntentBuilder