Wire opendir to go through MediaProvider

opendir now consults MediaProvider to check whether the requesting app
is allowed to access the directory. The only rule is that an app is not
allowed to access another app's external directory or any other
subdirectory in it.

This implementation of opendir does not leak app info, because if the
app has no access to the directory, we just return ENOENT, regardless of
whether the directory exists or not.

Add a test case for opendir to ensure we enforce the restriction
mentioned above. Also fix a little bug in the test setup (we should mkdir
EXTERNAL_FILES_DIR not EXTERNAL_STORAGE_DIR).

Test: atest FuseDaemonTest
Fixes: 144279803

Change-Id: I14956a32cca9b21675fc2901c46a6ec26671b3ef
5 files changed