package o;

import android.app.ActivityManager;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.StatFs;
import java.io.File;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.vG, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C2701vG extends AbstractC0706aK implements NC {
    public final /* synthetic */ int m;
    public final /* synthetic */ C3126zm0 n;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public /* synthetic */ C2701vG(C3126zm0 c3126zm0, int i) {
        super(0);
        this.m = i;
        this.n = c3126zm0;
    }

    /* JADX WARN: Multi-variable type inference failed */
    @Override // o.NC
    public final Object a() {
        int i;
        C0247Jn c0247Jn;
        int largeMemoryClass;
        C2676v00 c2676v00;
        switch (this.m) {
            case 0:
                Context context = (Context) this.n.m;
                Bitmap.Config[] configArr = AbstractC1345h.a;
                double d = 0.2d;
                try {
                    if (((ActivityManager) context.getSystemService(ActivityManager.class)).isLowRamDevice()) {
                        d = 0.15d;
                    }
                } catch (Exception unused) {
                }
                C1254g2 c1254g2 = new C1254g2(7);
                if (d > 0.0d) {
                    Bitmap.Config[] configArr2 = AbstractC1345h.a;
                    try {
                        ActivityManager activityManager = (ActivityManager) context.getSystemService(ActivityManager.class);
                        largeMemoryClass = (context.getApplicationInfo().flags & 1048576) != 0 ? activityManager.getLargeMemoryClass() : activityManager.getMemoryClass();
                    } catch (Exception unused2) {
                        largeMemoryClass = 256;
                    }
                    double d2 = d * largeMemoryClass;
                    double d3 = 1024;
                    i = (int) (d2 * d3 * d3);
                } else {
                    i = 0;
                }
                if (i > 0) {
                    DH dh = new DH();
                    dh.l = c1254g2;
                    dh.m = new G00(i, dh);
                    c0247Jn = dh;
                } else {
                    c0247Jn = new C0247Jn(15, c1254g2);
                }
                return new C00(c0247Jn, c1254g2);
            default:
                C0669Zu c0669Zu = C0669Zu.Y;
                Context context2 = (Context) this.n.m;
                synchronized (c0669Zu) {
                    try {
                        c2676v00 = C0669Zu.Z;
                        if (c2676v00 == null) {
                            C2704vJ c2704vJ = AbstractC1628jy.a;
                            C2468sq c2468sq = AbstractC1903ms.a;
                            ExecutorC1232fq executorC1232fq = ExecutorC1232fq.m;
                            Bitmap.Config[] configArr3 = AbstractC1345h.a;
                            File cacheDir = context2.getCacheDir();
                            if (cacheDir == null) {
                                throw new IllegalStateException("cacheDir == null");
                            }
                            cacheDir.mkdirs();
                            File fileK = AbstractC2008ny.K(cacheDir);
                            String str = SV.m;
                            SV svM = BP.m(fileK);
                            long jL = 10485760;
                            try {
                                File file = svM.toFile();
                                file.mkdir();
                                StatFs statFs = new StatFs(file.getAbsolutePath());
                                jL = AbstractC0940cn0.l((long) (0.02d * statFs.getBlockCountLong() * statFs.getBlockSizeLong()), 10485760L, 262144000L);
                            } catch (Exception unused3) {
                            }
                            C2676v00 c2676v002 = new C2676v00(jL, c2704vJ, svM);
                            C0669Zu.Z = c2676v002;
                            c2676v00 = c2676v002;
                        }
                    } finally {
                    }
                }
                return c2676v00;
        }
    }
}
