diff options
author | Jeff Sharkey <jsharkey@android.com> | 2014-07-15 20:39:15 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2014-07-15 22:13:26 -0700 |
commit | 4ed745d359ada6986ac15d8718452e5c55f40170 (patch) | |
tree | fce91cd40193520da8012e839ac3615da51da57f /core/java/android/content | |
parent | 78a130144bdd047665f00782c481d31edb3e5fb7 (diff) | |
download | frameworks_base-4ed745d359ada6986ac15d8718452e5c55f40170.zip frameworks_base-4ed745d359ada6986ac15d8718452e5c55f40170.tar.gz frameworks_base-4ed745d359ada6986ac15d8718452e5c55f40170.tar.bz2 |
Add code cache directory for apps.
This provides a directory where apps can cache compiled or optimized
code generated at runtime. The platform will delete all files in
this location on both app and platform upgrade.
Bug: 16187224
Change-Id: I641b21d841c436247f35ff235317e3a4ba520441
Diffstat (limited to 'core/java/android/content')
-rw-r--r-- | core/java/android/content/Context.java | 16 | ||||
-rw-r--r-- | core/java/android/content/ContextWrapper.java | 5 |
2 files changed, 21 insertions, 0 deletions
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index a52cbdd..d068b1f 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -867,6 +867,22 @@ public abstract class Context { public abstract File getCacheDir(); /** + * Returns the absolute path to the application specific cache directory on + * the filesystem designed for storing cached code. The system will delete + * any files stored in this location both when your specific application is + * upgraded, and when the entire platform is upgraded. + * <p> + * This location is optimal for storing compiled or optimized code generated + * by your application at runtime. + * <p> + * Apps require no extra permissions to read or write to the returned path, + * since this path lives in their private storage. + * + * @return The path of the directory holding application code cache files. + */ + public abstract File getCodeCacheDir(); + + /** * Returns the absolute path to the directory on the primary external filesystem * (that is somewhere on {@link android.os.Environment#getExternalStorageDirectory() * Environment.getExternalStorageDirectory()} where the application can diff --git a/core/java/android/content/ContextWrapper.java b/core/java/android/content/ContextWrapper.java index 13eed07..4e1c4a7 100644 --- a/core/java/android/content/ContextWrapper.java +++ b/core/java/android/content/ContextWrapper.java @@ -232,6 +232,11 @@ public class ContextWrapper extends Context { } @Override + public File getCodeCacheDir() { + return mBase.getCodeCacheDir(); + } + + @Override public File getExternalCacheDir() { return mBase.getExternalCacheDir(); } |