UserScopedService: Cache and share contexts

This change caches both the Context and the Service instance
to reuse both as needed. Previously a new Context is created
for every service for a given user.

In addition, switch to LruCache instead of a plain main, which
provides an upper bound on the number of cached instances as a
safeguard.

Finally, switch the key to UserHandle to decouple from other
sharesheet concepts. This mechanism is an implementation detail
and not for general use so framework types are fine here.

Bug: 324428064
Test: Not yet used
Flag: Not yet used
Change-Id: I0115853f0c8888d59ebb0407391a1e6d3c6e7e6c
2 files changed
tree: f4891138c33fef99eb9bbd5095822c5602e50340
  1. aconfig/
  2. java/
  3. tests/
  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