Bypass database operations for legacy system galleries.

This adds the same bypass mechanism for system galleries which
still have legacy storage that is used for file managers,
introduced in ag/12220064 with change id:
I3ab892d0f0c7a8fe78734ebe1237b87f15b7a480.

Bug: 167307393
Test: atest CtsScopedStorageHostTest:android.scopedstorage.cts.host.LegacyStorageHostTest#testLegacySystemGalleryCanRenameImagesAndVideosWithoutDbUpdates
Test: atest CtsScopedStorageHostTest:android.scopedstorage.cts.host.LegacyStorageHostTest#testLegacyWESCanRenameImagesAndVideosWithDbUpdates_hasW
Test: atest CtsScopedStorageHostTest:android.scopedstorage.cts.host.LegacyStorageHostTest#testLegacySystemGalleryWithoutWESCannotRename
Change-Id: I7df2fd7bd84db739af2801b4df19c42430261e94
3 files changed