summaryrefslogtreecommitdiffstats
path: root/rs/java/android/renderscript/RenderScript.java
diff options
context:
space:
mode:
authorTim Murray <timmurray@google.com>2015-04-10 04:35:04 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-04-10 04:35:04 +0000
commit9509bfe46a96a724a9166b115b287f16862b9fc5 (patch)
treeb15ce23dafe5f714d5233d6b62a7b8a079b71b7b /rs/java/android/renderscript/RenderScript.java
parent8d33804b01d4fc871b7eed750fa6aad00861f984 (diff)
parent72fcf9eb1079312afd7bdbee167c759109af4244 (diff)
downloadframeworks_base-9509bfe46a96a724a9166b115b287f16862b9fc5.zip
frameworks_base-9509bfe46a96a724a9166b115b287f16862b9fc5.tar.gz
frameworks_base-9509bfe46a96a724a9166b115b287f16862b9fc5.tar.bz2
am 72fcf9eb: am af61d43d: am 6d718c2f: Merge "Add support for setting the cache directory."
* commit '72fcf9eb1079312afd7bdbee167c759109af4244': Add support for setting the cache directory.
Diffstat (limited to 'rs/java/android/renderscript/RenderScript.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 fd19d49..5fc1f93 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();
@@ -1325,6 +1331,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;