Fix relative_path  update() for SystemGallery with legacy permissions

Previously, SystemGallery with legacy permissions was not allowed to
update() paths if the destination path didn't align to type-path
conformity of MediaProvider update(). But, this was allowed for
non-legacy SystemGallery if it didn't result in creating a top level
non-default directory.

Fixed canAccessMediaFile to behave the same for legacy and non-legacy
SystemGallery.

Bug: 205673506
Test: atest
android.scopedstorage.cts.host.LegacyStorageHostTest#testLegacySystemGalleryCanUpdateToExistingDirectory

Change-Id: Idfbc04f7f9f8b450e51736f2f3786c2b156ef3ce
1 file changed