Skip to content

Commit 41d4332

Browse files
Amith YamasaniAndroid (Google) Code Review
authored andcommitted
Merge "Handle null cache directory" into jb-mr1-dev
2 parents 6715d1e + 92d5705 commit 41d4332

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

core/java/android/app/ActivityThread.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4070,10 +4070,14 @@ private void handleBindApplication(AppBindData data) {
40704070
if (!Process.isIsolated()) {
40714071
final File cacheDir = appContext.getCacheDir();
40724072

4073-
// Provide a usable directory for temporary files
4074-
System.setProperty("java.io.tmpdir", cacheDir.getAbsolutePath());
4075-
4076-
setupGraphicsSupport(data.info, cacheDir);
4073+
if (cacheDir != null) {
4074+
// Provide a usable directory for temporary files
4075+
System.setProperty("java.io.tmpdir", cacheDir.getAbsolutePath());
4076+
4077+
setupGraphicsSupport(data.info, cacheDir);
4078+
} else {
4079+
Log.e(TAG, "Unable to setupGraphicsSupport due to missing cache directory");
4080+
}
40774081
}
40784082
/**
40794083
* For system applications on userdebug/eng builds, log stack

core/java/android/app/ContextImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ public File getCacheDir() {
769769
}
770770
if (!mCacheDir.exists()) {
771771
if(!mCacheDir.mkdirs()) {
772-
Log.w(TAG, "Unable to create cache directory");
772+
Log.w(TAG, "Unable to create cache directory " + mCacheDir.getAbsolutePath());
773773
return null;
774774
}
775775
FileUtils.setPermissions(

0 commit comments

Comments
 (0)