Ignore mkdirs requests if CE storage not available.

There is a time gap between user unlock and CE
storage preparation. This would creates a race
between thread preparing CE storages and another
thread doing a mkdirs. An application call to
getExternalCacheDir() result in a mkdirs call.
mkdirs would create a full path inside CE directory.
If directories are created before encryption policies
are applied then CE storage preparation would fail on
the very first boot. This will cause the device to not
ever boot successfully. This change will prevent an app
from breaking the system.

Another solution would have been moving CE preparation
inside user unlock before updating mLocalUnlockedUsers,
that would guarantee that CE storage is ready when
isUserKeyUnlocked returns true, but that would be riskier
change.

Bug: 76222913
Test: No longer can break CE preparation by calling
getExternalCacheDir() early.

Change-Id: I3141f541b43bb51a444f8c79b63e5a6d4b3fd3b2
(cherry picked from commit 4d24d8130b7fdbe46751f527d615143f4cb4de4b)
1 file changed