From e9681e192a678d2b8f1fae5c92a87d5d52149515 Mon Sep 17 00:00:00 2001 From: Kevin Hufnagle Date: Fri, 23 Sep 2016 16:44:03 -0700 Subject: [PATCH] docs: Added note in getCacheDir() that developers can use directory obtained from getExternalCacheDir() to store app caches larger than 1 MB. Bug: 22505268 Change-Id: I9972ba5ef7b43a135c00ac48a2e5ccb1fcc5b103 --- core/java/android/content/Context.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index bdf888f59715..a1a1ace14646 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -1130,7 +1130,9 @@ public abstract class Context { * Note: you should not rely on the system deleting these * files for you; you should always have a reasonable maximum, such as 1 MB, * for the amount of space you consume with cache files, and prune those - * files when exceeding that space. + * files when exceeding that space. If your app requires a larger + * cache (larger than 1 MB), you should use {@link #getExternalCacheDir()} + * instead. *

* The returned path may change over time if the calling app is moved to an * adopted storage device, so only relative paths should be persisted. @@ -1142,6 +1144,7 @@ public abstract class Context { * @see #openFileOutput * @see #getFileStreamPath * @see #getDir + * @see #getExternalCacheDir */ public abstract File getCacheDir(); @@ -1190,7 +1193,7 @@ public abstract class Context { * *

* If a shared storage device is emulated (as determined by - * {@link Environment#isExternalStorageEmulated(File)}), it's contents are + * {@link Environment#isExternalStorageEmulated(File)}), its contents are * backed by a private user data partition, which means there is little * benefit to storing data here instead of the private directory returned by * {@link #getCacheDir()}. -- 2.11.0