Expose Environment device/credential encrypted app storage directories
ApplicationInfo is expensive to build, especially when using the
new PackageState APIs which don't require ApplicationInfo at all.
To allow access to the dataDir field without ApplicationInfo, this
exposes methods on Environment to build them dynamically based on
volume UUID, user, and app package name. This avoids having to
build/cache the strings in system server and consolidates the
file system related APIs into Environment as a single source of
truth.
This also fixes the @TestApi StorageManager#convert so that its
String parameter is marked @Nullable, which works because
UUID_PRIVATE_INTERNAL is defined as nullable. This allows the method
to be used in Kotlin, as the Kotlin compiler will enforce nullability
annotations, preventing the UUID_PRIVATE_INTERNAL value from being
tested without the right annotation on the parameter.
Bug: 245943991
Test: atest android.os.EnvironmentTest
Test: atest android.os.cts.EnvironmentTest
Change-Id: I5983ee22a27f566352fd0de03f0ee421a0bc390f
6 files changed