Improve robustness of updateVolumes().

We've seen evidence from the wild that the local caches populated
by updateVolumes() can end up stale, where we know a specific volume
has been "attached", but we're missing metadata like scan paths.

This change borrows the strategy from getVolumePath() where we're
willing to populate these caches on the fly if the data we're looking
for is missing.  This change also improves updateVolumes() to recover
and process any remaining volumes when we have trouble populating the
cache, instead of bailing entirely.

We also continue to try making progress on fixing flaky tests by
waiting for storage to be mounted and idle *twice*, since we've
seen evidence that clearing the data on a package can asynchronously
perform a vold reset, which can make us think storage is ready and
mounted when it's moments away from being torn down.  We also consult
statvfs() to catch any ENOTCONN errors where an old stale FUSE daemon
hasn't been remounted yet.

Bug: 157990507, 157219547
Test: atest MediaProviderClientTests:com.android.providers.media.client.LegacyProviderMigrationTest --rerun-until-failure 100
Change-Id: Ia7e4565c3102ec7a3b75f0649f958ba071be87a8
(cherry picked from commit f95b06feed0d9f3ac238f4fb7b0d49da1ab5f4d1)
4 files changed