Commit 8b372e6f authored by brizental's avatar brizental Committed by jwilde
Browse files

TB 42191: [android] Temporary StrictMode relaxation to clear the thumbnail cache.

parent e8cbe5a0
Loading
Loading
Loading
Loading
+4 −0
Changes for mobile/android/android-components/components/support/utils/src/main/java/mozilla/components/support/utils/cache/DiskLruCacheStore.kt: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
package mozilla.components.support.utils.cache

import android.content.Context
import android.os.StrictMode
import androidx.annotation.VisibleForTesting
import com.jakewharton.disklrucache.DiskLruCache
import java.io.File
@@ -42,10 +43,13 @@ class DiskLruCacheStore(
     */
    fun clear(context: Context) {
        synchronized(cacheLock) {
            val defaultPolicy = StrictMode.allowThreadDiskWrites()
            try {
                getCache(context)?.delete()
            } catch (_: IOException) {
                logger.warn("Cache could not be cleared. Perhaps there are none?")
            } finally {
                StrictMode.setThreadPolicy(defaultPolicy)
            }

            cache = null