Media Provider receives volume state changed update before other apps

Currently Media Provider receives volume mount broadcast
ACTION_MEDIA_MOUNTED/ACTION_MEDIA_UNMOUNTED etc (these broadcasts can be
received by other apps as well which can then try to access the volume).
If other apps try to access the volume in this data before Media Provider
has processed/scanned the volume, then they may not have the correct
view of the volume.

MediaProvider also listens to StorageEventListener#onVolumeStateChanged()
callback to update volumes whenever a volume changes state. (This can be
done by other apps as well)

This is required in R as file path access is now proxied through Media
Provider database. This allows Media Provider to process/scan the volume before
any apps know that the volume is mounted.

TODO: Remove listening to broadcasts in a follow up CL

Bug: 145194312
Test: builds
Test: atest AdoptableHostTest
Change-Id: If23eb02cd6d772363a3747261b9beeb1c5985cbb
1 file changed