Skip to content

Commit 9a67113

Browse files
jsharkeyAndroid (Google) Code Review
authored andcommitted
Merge "Set tmpdir to application cache directory." into jb-dev
2 parents 2f612bd + e1d330a commit 9a67113

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

core/java/android/app/ActivityThread.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3843,7 +3843,7 @@ final void handleTrimMemory(int level) {
38433843
windowManager.endTrimMemory();
38443844
}
38453845

3846-
private void setupGraphicsSupport(LoadedApk info) {
3846+
private void setupGraphicsSupport(LoadedApk info, File cacheDir) {
38473847
if (Process.isIsolated()) {
38483848
// Isolated processes aren't going to do UI.
38493849
return;
@@ -3855,11 +3855,8 @@ private void setupGraphicsSupport(LoadedApk info) {
38553855
// If there are several packages in this application we won't
38563856
// initialize the graphics disk caches
38573857
if (packages != null && packages.length == 1) {
3858-
ContextImpl appContext = new ContextImpl();
3859-
appContext.init(info, null, this);
3860-
3861-
HardwareRenderer.setupDiskCache(appContext.getCacheDir());
3862-
RenderScript.setupDiskCache(appContext.getCacheDir());
3858+
HardwareRenderer.setupDiskCache(cacheDir);
3859+
RenderScript.setupDiskCache(cacheDir);
38633860
}
38643861
} catch (RemoteException e) {
38653862
// Ignore
@@ -3925,8 +3922,15 @@ private void handleBindApplication(AppBindData data) {
39253922

39263923
data.info = getPackageInfoNoCheck(data.appInfo, data.compatInfo);
39273924

3928-
setupGraphicsSupport(data.info);
3929-
3925+
final ContextImpl appContext = new ContextImpl();
3926+
appContext.init(data.info, null, this);
3927+
final File cacheDir = appContext.getCacheDir();
3928+
3929+
// Provide a usable directory for temporary files
3930+
System.setProperty("java.io.tmpdir", cacheDir.getAbsolutePath());
3931+
3932+
setupGraphicsSupport(data.info, cacheDir);
3933+
39303934
/**
39313935
* For system applications on userdebug/eng builds, log stack
39323936
* traces of disk and network access to dropbox for analysis.
@@ -4003,8 +4007,6 @@ private void handleBindApplication(AppBindData data) {
40034007
}
40044008

40054009
if (data.instrumentationName != null) {
4006-
ContextImpl appContext = new ContextImpl();
4007-
appContext.init(data.info, null, this);
40084010
InstrumentationInfo ii = null;
40094011
try {
40104012
ii = appContext.getPackageManager().

0 commit comments

Comments
 (0)