package com.ubtrobot.log; import android.annotation.TargetApi; import android.content.Context; import android.os.Environment; import android.util.Log; import java.io.File; @TargetApi(9) /* loaded from: classes2.dex */ public class ExternalOverFroyoUtils { public enum Dir { Model("model"), Cache("cache"), User("user"), Image("image"); private String name; Dir(String str) { this.name = str; } public String getName() { return this.name; } } public static boolean a() { if (AndroidVersionCheckUtils.b()) { return Environment.isExternalStorageRemovable(); } return true; } public static File a(Context context, String str) { String path = context.getCacheDir().getPath(); try { if ("mounted".equals(Environment.getExternalStorageState()) || !a()) { path = a(context).getPath(); } } catch (Exception e) { Log.e("DiskCacheDir", e.getMessage() + ""); } return new File(path + File.separator + str); } public static File a(Context context) { if (AndroidVersionCheckUtils.a()) { return context.getExternalCacheDir(); } return new File(Environment.getExternalStorageDirectory().getPath() + ("/Android/data/" + context.getPackageName() + "/cache/")); } }