MediaUpgradeReceiver should set MigrationListener

MediaProvider database migration can happen either
1) through MediaUpgradeReceiver on PRE_BOOT_COMPLETED broadcast or
2) MediaProvider's first database operation
depends on which gets scheduled first.
MediaUpgradeReceiver does not request any MigrationListener which leads
to NullPointerException. To resolve this, we use same MigrationListener
as MediaProvider.

Changed MediaUpgradeReceiver to set MigrationListener while creating
DatabaseHelper object.

Bug: 160673173
Bug: 162806809
Test: Manual. Flash device with Q. Flash device with R, also force
MediaUpgradeReceiver to win the race condition. Verified that there's no
NullPointerException and database is migrated with all db rows and
columns completely migrated to the new database.

Change-Id: I4edd1465bc557a469d638a0c45c5bd84825d54f4
Merged-In: I4edd1465bc557a469d638a0c45c5bd84825d54f4
(cherry picked from commit 58451a23d8eda5fc139577ff46687480a7fe8a20)
4 files changed