Track down Contexts without data directories.
Data directories for all packages should be created and managed by
installd; if we create a Context and the data directory doesn't exist
yet, we're in trouble, since a later mkdirs() would end up creating
the directory with incorrect permissions, mode, and SELinux labels.
Bug: 28272737
Change-Id: Ie3bb884ab07748719378de5c792046a031a3f945
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 6bb853a..f2e5997 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -1958,6 +1958,10 @@
}
if (res != null) {
+ if (!res.exists()) {
+ Log.wtf(TAG, "Data directory doesn't exist for package " + getPackageName(),
+ new Throwable());
+ }
return res;
} else {
throw new RuntimeException(