-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Android aggresive cache clearing leads to crash #2
Comments
Hi Lexs, Is it possible to write cache into a cache directory which is located in SD Card?(/mnt/sdcard/data/somepackagename/cache/images/) In my opinion, Android would never clear this, and this could be a workaround. |
Yes, this would work but will introduce other problems, for example that SD storage can be removed at any time or not even be available. I guess these issues could be worked around as well though. |
Give the |
Gerrit tracking: https://android-review.googlesource.com/31430 |
What happened to this? Should I still try dev? I'm asking as my image loader is based on this and when they user clicks "clear cache" in app info all new writes will fail if the app was open. |
It's fixed on |
My original preference was for the cache to stop caching if ever it runs into a hostile storage system. But in @lexs scenario, that's probably to heavy-handed. It would probably be more robust for the cache tried its best to keep caching even as things disappeared out from under it. That way, if a user clicks 'clear cache' while the app is open, performance won't degrade indefinitely. @JakeWharton can you assign this to me? I'll code up a fix. |
Sadly I still haven't gotten around to doing this work. If you'd prefer to tackle it, it's all yours. Otherwise I'll circle back when I have time. |
New implementation of this on |
I have the cache put inside a subdirectory in the application cache directory. On devices with low internal storage (Nexus One for example) this will eventually lead to low storage situations where Android will just clear the whole cache directory, including subdirectories.
This gives this:
It's thrown because the images directory is now gone. I though listening for ACTION_DEVICE_STORAGE_LOW could solve this but that is broadcasted after Android has cleared the directory.
If would be nice if it was possible to just reset the cache when the whole directory has gone missing or something.
The text was updated successfully, but these errors were encountered: