Use code cache dir for engine cache on API >= 21 (#14704). (flutter/engine#8534)

This commit is contained in:
Matt Carroll 2019-04-10 15:32:31 -07:00 committed by GitHub
parent 05de762638
commit b3e91cb003

View File

@ -5,6 +5,7 @@
package io.flutter.util;
import android.content.Context;
import android.os.Build;
public final class PathUtils {
public static String getFilesDir(Context applicationContext) {
@ -16,6 +17,10 @@ public final class PathUtils {
}
public static String getCacheDirectory(Context applicationContext) {
return applicationContext.getCacheDir().getPath();
if (Build.VERSION.SDK_INT >= 21) {
return applicationContext.getCodeCacheDir().getPath();
} else {
return applicationContext.getCacheDir().getPath();
}
}
}