package p037.p123.p124;

import android.content.Context;
import android.os.Build;
import java.io.File;
import java.util.HashMap;
import p037.p123.AbstractC2562;

/* JADX INFO: renamed from: މ.ޗ.ޘ.އ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C2603 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static final String f8133 = AbstractC2562.m4622("WrkDbPathHelper");

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public static final String[] f8134 = {"-journal", "-shm", "-wal"};

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static String m4660() {
        return "androidx.work.workdb";
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static void m4661(Context context) {
        File databasePath = context.getDatabasePath("androidx.work.workdb");
        if (Build.VERSION.SDK_INT < 23 || !databasePath.exists()) {
            return;
        }
        AbstractC2562.m4623().mo4625(f8133, "Migrating WorkDatabase to the no-backup directory", new Throwable[0]);
        HashMap map = new HashMap();
        if (Build.VERSION.SDK_INT >= 23) {
            File databasePath2 = context.getDatabasePath("androidx.work.workdb");
            File databasePath3 = Build.VERSION.SDK_INT < 23 ? context.getDatabasePath("androidx.work.workdb") : new File(context.getNoBackupFilesDir(), "androidx.work.workdb");
            map.put(databasePath2, databasePath3);
            for (String str : f8134) {
                map.put(new File(databasePath2.getPath() + str), new File(databasePath3.getPath() + str));
            }
        }
        for (File file : map.keySet()) {
            File file2 = (File) map.get(file);
            if (file.exists() && file2 != null) {
                if (file2.exists()) {
                    AbstractC2562.m4623().mo4628(f8133, String.format("Over-writing contents of %s", file2), new Throwable[0]);
                }
                AbstractC2562.m4623().mo4625(f8133, file.renameTo(file2) ? String.format("Migrated %s to %s", file, file2) : String.format("Renaming %s to %s failed", file, file2), new Throwable[0]);
            }
        }
    }
}
