summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2021-09-14 17:08:20 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-09-14 17:08:20 +0000
commit76aa934468fc646faac975eac5e2b2e2a869d25a (patch)
treec2e0e6821284b218b10c9b86721c039679b1bb5f /core/java/android
parent902b8e2df5484f3267c0be4da9f1151653f02109 (diff)
parent1353c413790ac6d60ee3a4c1a1a9b325c404a1e8 (diff)
Merge "Set $TMPDIR as well as java.io.tmpdir." am: 1353c41379
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1821337 Change-Id: Ib98b38571754781102093c67d15ac3364c5dc029
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/ActivityThread.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 0c64c86daf3e..8210baf40983 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -6370,7 +6370,13 @@ public final class ActivityThread extends ClientTransactionHandler
final File cacheDir = context.getCacheDir();
if (cacheDir != null) {
// Provide a usable directory for temporary files
- System.setProperty("java.io.tmpdir", cacheDir.getAbsolutePath());
+ String tmpdir = cacheDir.getAbsolutePath();
+ System.setProperty("java.io.tmpdir", tmpdir);
+ try {
+ android.system.Os.setenv("TMPDIR", tmpdir, true);
+ } catch (ErrnoException ex) {
+ Log.w(TAG, "Unable to initialize $TMPDIR", ex);
+ }
} else {
Log.v(TAG, "Unable to initialize \"java.io.tmpdir\" property "
+ "due to missing cache directory");