ChooserAdapter: fix NPE for non-work profiles

For some non-work profiles (Communal, and maybe Private), the
getListAdapterForUserHandle is returning null. The method is indeed
nullable. But we run getCount on it without doing a null-check,
causing crashes for such profiles.

This previously couldn't have happened, since shouldShowTabs() returns
false in these cases, and the evaluation was skipped; however,
ag/I8273cf365a1e00b1acff4030086f1a044ad7531f moved that check to later,
so we are hitting this problem.

Bug: 322523699
Bug: 320369524
Bug: 320615143
Bug: 322497953

Test: atest IntentResolver-tests-unit
Change-Id: I82303d6a6a1be1066f5c3e05c53f6a70d486bf5a
1 file changed
tree: a8edd2e6a045e864afc661f86e908dbf92dc1c8c
  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