summaryrefslogtreecommitdiffstats
path: root/rs/java
diff options
context:
space:
mode:
authorTim Murray <timmurray@google.com>2015-04-07 15:43:24 -0700
committerTim Murray <timmurray@google.com>2015-04-09 17:50:39 -0700
commit47f31582b67f492d9e1523abd0d8b86c38ec007d (patch)
tree3832370c800536d22d23de76cd3e6183cdd20fe9 /rs/java
parentba2836e6cf5a00855e470705741d9e4b9b1a9df9 (diff)
downloadframeworks_base-47f31582b67f492d9e1523abd0d8b86c38ec007d.zip
frameworks_base-47f31582b67f492d9e1523abd0d8b86c38ec007d.tar.gz
frameworks_base-47f31582b67f492d9e1523abd0d8b86c38ec007d.tar.bz2
Add support for setting the cache directory.
Change-Id: I2bf1874705b877a8a8262ab49b47fe8241e603d5
Diffstat (limited to 'rs/java')
-rw-r--r--rs/java/android/renderscript/RenderScript.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/rs/java/android/renderscript/RenderScript.java b/rs/java/android/renderscript/RenderScript.java
index 5138719..126b8c7 100644
--- a/rs/java/android/renderscript/RenderScript.java
+++ b/rs/java/android/renderscript/RenderScript.java
@@ -16,6 +16,7 @@
package android.renderscript;
+import java.io.File;
import java.lang.reflect.Method;
import java.util.concurrent.locks.ReentrantReadWriteLock;
@@ -231,6 +232,11 @@ public class RenderScript {
validate();
rsnContextSetPriority(mContext, p);
}
+ native void rsnContextSetCacheDir(long con, String cacheDir);
+ synchronized void nContextSetCacheDir(String cacheDir) {
+ validate();
+ rsnContextSetCacheDir(mContext, cacheDir);
+ }
native void rsnContextDump(long con, int bits);
synchronized void nContextDump(int bits) {
validate();
@@ -1326,6 +1332,14 @@ public class RenderScript {
if (rs.mContext == 0) {
throw new RSDriverException("Failed to create RS context.");
}
+
+ // set up cache directory for entire context
+ final String CACHE_PATH = "com.android.renderscript.cache";
+ File f = new File(RenderScriptCacheDir.mCacheDir, CACHE_PATH);
+ String mCachePath = f.getAbsolutePath();
+ f.mkdirs();
+ rs.nContextSetCacheDir(mCachePath);
+
rs.mMessageThread = new MessageThread(rs);
rs.mMessageThread.start();
return rs;