Restrict legacy apps to insert files to other private app dirs

We allow legacy apps to insert/update content values such that they can
add private files to MediaStore database. Restrict such apps to
insert/update content in other app's private directories.
Retrict System Gallery apps and apps with MANAGE_EXTERNAL_STORAGE
permission to insert private path files.

Bug: 201667614
Test: atest FileUtilsTest
Test: atest CtsScopedStorageHostTest
Test: atest LegacyStorageTest:LegacyStorageHostTest
Change-Id: I52481b24b137790d49845f1a4b00978c63ed183b
Merged-In: I52481b24b137790d49845f1a4b00978c63ed183b
(cherry picked from commit 1272768815dce7ec769cb01e0e52843a8839082f)
4 files changed