Fix lock inversion bug.

To avoid deadlocking, we need to ensure consistent lock ordering,
and we nominate mDirectoryCache to be a finer-grain lock when compared
to database transactions.

Bug: 154107764
Test: atest --test-mapping packages/providers/MediaProvider
Change-Id: Ide47ca8c067f1f416b119011203c3b5fb82531b9
1 file changed