package v0; import android.content.Context; import android.os.Build; import androidx.work.m; import java.io.File; import java.util.HashMap; import java.util.Map; /* loaded from: classes.dex */ public abstract class h { /* renamed from: a, reason: collision with root package name */ private static final String f14811a = m.f("WrkDbPathHelper"); /* renamed from: b, reason: collision with root package name */ private static final String[] f14812b = {"-journal", "-shm", "-wal"}; public static File a(Context context) { return Build.VERSION.SDK_INT < 23 ? b(context) : c(context, "androidx.work.workdb"); } public static File b(Context context) { return context.getDatabasePath("androidx.work.workdb"); } private static File c(Context context, String str) { return new File(context.getNoBackupFilesDir(), str); } public static String d() { return "androidx.work.workdb"; } public static void e(Context context) { File b10 = b(context); if (Build.VERSION.SDK_INT < 23 || !b10.exists()) { return; } m.c().a(f14811a, "Migrating WorkDatabase to the no-backup directory", new Throwable[0]); Map f10 = f(context); for (File file : f10.keySet()) { File file2 = (File) f10.get(file); if (file.exists() && file2 != null) { if (file2.exists()) { m.c().h(f14811a, String.format("Over-writing contents of %s", file2), new Throwable[0]); } m.c().a(f14811a, file.renameTo(file2) ? String.format("Migrated %s to %s", file, file2) : String.format("Renaming %s to %s failed", file, file2), new Throwable[0]); } } } public static Map f(Context context) { HashMap hashMap = new HashMap(); if (Build.VERSION.SDK_INT >= 23) { File b10 = b(context); File a10 = a(context); hashMap.put(b10, a10); for (String str : f14812b) { hashMap.put(new File(b10.getPath() + str), new File(a10.getPath() + str)); } } return hashMap; } }