Migrate playlists on OS upgrade

1) During the OS upgrade and MediaProvider database migration, we don't
migrate "FORMAT" column which determines MTP format of the file. This
makes ModernMediaScanner#reconcileAndClean() delete all stale rows
unless FORMAT is MtpConstants.FORMAT_ABSTRACT_AV_PLAYLIST.
2) Database migration doesn't migrate audio_playlists_map table, hence
we lose all playlist->audio_files mapping.
3) In Q, playlist files can be only "virtual" playlists which only
exists in MediaProvider database. We changed this logic in R, we force
create "real" playlist files for all playlists. Playlist files are
source of truth in R, and MediaProvider database is updated from
playlist details from playlist files.

All these together causes playlists to be lost after the OS upgrade from
Q to R.

This CL achieves migration of virtual playlist files on OS upgrade with
following steps:
1) Migrate playlist rows with right playlist file names.
2) Create "real" playlist files for virtaul playlists during the
migration and let ModernMediaScanner resolve the playlist and create
audio_playlists_map entries.

Also adds tests for verifying playlist files are migrated on
LegacyMigration.

Bug: 165904660
Test: LegacyProviderMigrationTest#testLegacy_PlaylistMap
Change-Id: Ib96e63bf33a27679465b05c8baa4acf7cc4977b2
(cherry picked from commit 9f4c1fa8b90b0fa60301d3967cf7f00c4c757a26)
3 files changed