Frameworks: Move SharedPreferencesImpl to Future

The asynchronous loading code is not safe wrt/ exceptions. Instead
of adding a tri-state for loading, move the code to use a Future
for the map. This encapsulates the required wait & synchronization,
as well as propagating any exceptions.

Bug: 67986472
Test: m
Test: Device boots
Test: m cts && cts-tradefed run commandAndExit cts-dev --module CtsContentTestCases -c android.content.cts.SharedPreferencesTest
Change-Id: I6616e8a05e64eb1cfe024cc3239a05847dfe1fab
1 file changed