Fix slow migration of virtual playlists

Writing of virtual playlist files to real files did not return when
the write was successful, but instead retried again and again for 10s
per playlist.

And because the playlist writing threw an exception when it timed out,
the path for the new playlist was not used when deciding if an old file
needed to be moved/renamed during migration. This caused migration to
try and rename a non-existing file and again retry for 10s. The logic
mistook the file not existing to mean that the pass-through was not
mounted yet.

The end result was that each virtual playlist added 20s to the data
migration, preventing apps from accessing the MediaProvider for a
potentially long time during first boot after system upgrade.

Fix by adding the return-on-success for writing playlist files, and by
checking the rename against an updated values field.

Bug: 174941351
Test: atest LegacyProviderMigrationTest
Change-Id: I27ee2af88e9b4a92398bdf922eb1c6da08724509
Merged-In: I27ee2af88e9b4a92398bdf922eb1c6da08724509
1 file changed