package p138.p176.p177.p242.p258.p263;

import android.content.Context;
import android.net.Uri;
import android.os.Build;
import android.os.StrictMode;
import android.util.Log;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

/* JADX INFO: renamed from: ދ.ހ.֏.ހ.ރ.ނ.ၰ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final /* synthetic */ class C4721 implements InterfaceC4731 {

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public static final InterfaceC4731 f14247 = new C4721();

    @Override // p138.p176.p177.p242.p258.p263.InterfaceC4731
    /* JADX INFO: renamed from: ֏ */
    public final Object mo7259() {
        AbstractC4730 c4732;
        BufferedReader bufferedReader;
        HashMap map;
        Context contextCreateDeviceProtectedStorageContext = AbstractC4718.f14238;
        String str = Build.TYPE;
        String str2 = Build.TAGS;
        String str3 = Build.HARDWARE;
        if (!((str.equals("eng") || str.equals("userdebug")) && (str3.equals("goldfish") || str3.equals("ranchu") || str3.equals("robolectric")) && (str2.contains("dev-keys") || str2.contains("test-keys")))) {
            return C4729.f14258;
        }
        if (C4705.m7878() && !contextCreateDeviceProtectedStorageContext.isDeviceProtectedStorage()) {
            contextCreateDeviceProtectedStorageContext = contextCreateDeviceProtectedStorageContext.createDeviceProtectedStorageContext();
        }
        StrictMode.ThreadPolicy threadPolicyAllowThreadDiskReads = StrictMode.allowThreadDiskReads();
        try {
            StrictMode.allowThreadDiskWrites();
            File file = new File(contextCreateDeviceProtectedStorageContext.getDir("phenotype_hermetic", 0), "overrides.txt");
            c4732 = file.exists() ? new C4732(file) : C4729.f14258;
        } catch (RuntimeException e) {
            Log.e("HermeticFileOverrides", "no data dir", e);
            c4732 = C4729.f14258;
        } finally {
            StrictMode.setThreadPolicy(threadPolicyAllowThreadDiskReads);
        }
        if (!c4732.mo7898()) {
            return C4729.f14258;
        }
        File file2 = (File) c4732.mo7899();
        try {
            bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file2)));
            try {
                map = new HashMap();
            } finally {
            }
        } catch (IOException e2) {
            throw new RuntimeException(e2);
        }
        while (true) {
            String line = bufferedReader.readLine();
            if (line == null) {
                String strValueOf = String.valueOf(file2);
                StringBuilder sb = new StringBuilder(strValueOf.length() + 7);
                sb.append("Parsed ");
                sb.append(strValueOf);
                Log.i("HermeticFileOverrides", sb.toString());
                C4715 c4715 = new C4715(map);
                bufferedReader.close();
                return new C4732(c4715);
            }
            String[] strArrSplit = line.split(" ", 3);
            if (strArrSplit.length != 3) {
                Log.e("HermeticFileOverrides", line.length() != 0 ? "Invalid: ".concat(line) : new String("Invalid: "));
            } else {
                String str4 = strArrSplit[0];
                String strDecode = Uri.decode(strArrSplit[1]);
                String strDecode2 = Uri.decode(strArrSplit[2]);
                if (!map.containsKey(str4)) {
                    map.put(str4, new HashMap());
                }
                ((Map) map.get(str4)).put(strDecode, strDecode2);
            }
            throw new RuntimeException(e2);
        }
    }
}
