package d.f.a.p2;

import android.os.Environment;
import android.text.TextUtils;
import android.util.Log;
import d.f.a.r2.h3;
import d.f.a.r2.u2;
import java.io.File;

/* JADX INFO: compiled from: UpgradeHelper.java */
/* JADX INFO: loaded from: classes.dex */
public class r0 {
    public static final String a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static String f3043b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final String f3044c;

    static {
        a = d.i.c.a.p() ? "/data/local/tmp/" : "/tmp/";
        StringBuilder sb = new StringBuilder();
        sb.append(Environment.getExternalStorageDirectory());
        String str = File.separator;
        sb.append(str);
        sb.append("MCU.bin");
        sb.toString();
        String str2 = Environment.getExternalStorageDirectory() + str + "MCU.md5";
        f3044c = d.b.a.a.a.t(new StringBuilder(), "touchdriver.zip");
    }

    public static String a() {
        String strF = d.i.f.c.c.f("ro.cvte.ic", "");
        if (TextUtils.isEmpty(strF)) {
            strF = d.i.f.c.c.f("ro.customer.ic", "");
        }
        if (strF.equals("3576")) {
            return "upgrade_3576/";
        }
        if (strF.equals("9679")) {
            return "upgrade_9679/";
        }
        if ("3562".equals(strF)) {
            return "upgrade_3562/";
        }
        int iOrdinal = d.i.c.a.e().ordinal();
        if (iOrdinal == 2) {
            return "upgrade_638/";
        }
        if (iOrdinal == 3) {
            return "upgrade_8386/";
        }
        switch (iOrdinal) {
            case 8:
                return "upgrade_551/";
            case 9:
                return d.f.f.f.b.e() ? "upgrade_810/" : "upgrade_811/";
            case 10:
                return "upgrade_972/";
            case 11:
                return "upgrade_3399/";
            case 12:
                return "upgrade_9950/";
            case 13:
                return "upgrade_982/";
            case 14:
                return "upgrade_1516/";
            case 15:
                return "upgrade_3588/";
            case 16:
                return "upgrade_8195/";
            case 17:
                return "upgrade_9666/";
            default:
                return "upgrade_510/";
        }
    }

    public static boolean b(String str) {
        if (h3.q(str)) {
            Log.e("UpgradeHelper", "File name empty");
            return false;
        }
        if (!h3.q(u2.f(str))) {
            return true;
        }
        Log.e("UpgradeHelper", "File not found");
        return false;
    }

    public static boolean c(String str) {
        if (h3.q(str)) {
            Log.e("UpgradeHelper", "Pattern empty");
            return false;
        }
        if (!h3.q(u2.p(str))) {
            return true;
        }
        Log.e("UpgradeHelper", "File not found");
        return false;
    }

    public static boolean d(String str, String str2) {
        if (h3.q(str2)) {
            Log.e("UpgradeHelper", "Pattern empty");
            return false;
        }
        if (!h3.q(u2.q(str, str2))) {
            return true;
        }
        Log.e("UpgradeHelper", "File not found");
        return false;
    }
}
