package p138.p145.p146.p151.p154.p156;

import android.app.ActivityManager;
import android.content.Context;
import android.os.Build;
import android.text.format.Formatter;
import android.util.DisplayMetrics;
import android.util.Log;
import p138.p139.p143.p144.C2803;

/* JADX INFO: renamed from: ދ.ؠ.֏.ތ.ފ.ޚ.އ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C2975 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final int f9129;

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final int f9130;

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final Context f9131;

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public final int f9132;

    /* JADX INFO: renamed from: ދ.ؠ.֏.ތ.ފ.ޚ.އ$֏, reason: contains not printable characters */
    public static final class C2976 {

        /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
        public static final int f9133;

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final Context f9134;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public ActivityManager f9135;

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public InterfaceC2978 f9136;

        /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
        public float f9138;

        /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
        public float f9137 = 2.0f;

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public float f9139 = 0.4f;

        /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
        public float f9140 = 0.33f;

        /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
        public int f9141 = 4194304;

        static {
            f9133 = Build.VERSION.SDK_INT < 26 ? 4 : 1;
        }

        public C2976(Context context) {
            this.f9138 = f9133;
            this.f9134 = context;
            this.f9135 = (ActivityManager) context.getSystemService("activity");
            this.f9136 = new C2977(context.getResources().getDisplayMetrics());
            if (Build.VERSION.SDK_INT < 26 || !this.f9135.isLowRamDevice()) {
                return;
            }
            this.f9138 = 0.0f;
        }
    }

    /* JADX INFO: renamed from: ދ.ؠ.֏.ތ.ފ.ޚ.އ$ؠ, reason: contains not printable characters */
    public static final class C2977 implements InterfaceC2978 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final DisplayMetrics f9142;

        public C2977(DisplayMetrics displayMetrics) {
            this.f9142 = displayMetrics;
        }
    }

    /* JADX INFO: renamed from: ދ.ؠ.֏.ތ.ފ.ޚ.އ$ހ, reason: contains not printable characters */
    public interface InterfaceC2978 {
    }

    public C2975(C2976 c2976) {
        this.f9131 = c2976.f9134;
        this.f9132 = c2976.f9135.isLowRamDevice() ? c2976.f9141 / 2 : c2976.f9141;
        int iRound = Math.round(r0.getMemoryClass() * 1024 * 1024 * (c2976.f9135.isLowRamDevice() ? c2976.f9140 : c2976.f9139));
        InterfaceC2978 interfaceC2978 = c2976.f9136;
        float f = ((C2977) interfaceC2978).f9142.widthPixels * ((C2977) interfaceC2978).f9142.heightPixels * 4;
        int iRound2 = Math.round(c2976.f9138 * f);
        int iRound3 = Math.round(f * c2976.f9137);
        int i = iRound - this.f9132;
        int i2 = iRound3 + iRound2;
        if (i2 <= i) {
            this.f9130 = iRound3;
            this.f9129 = iRound2;
        } else {
            float f2 = i;
            float f3 = c2976.f9138;
            float f4 = c2976.f9137;
            float f5 = f2 / (f3 + f4);
            this.f9130 = Math.round(f4 * f5);
            this.f9129 = Math.round(f5 * c2976.f9138);
        }
        if (Log.isLoggable("MemorySizeCalculator", 3)) {
            StringBuilder sbM4889 = C2803.m4889("Calculation complete, Calculated memory cache size: ");
            sbM4889.append(m5127(this.f9130));
            sbM4889.append(", pool size: ");
            sbM4889.append(m5127(this.f9129));
            sbM4889.append(", byte array size: ");
            sbM4889.append(m5127(this.f9132));
            sbM4889.append(", memory class limited? ");
            sbM4889.append(i2 > iRound);
            sbM4889.append(", max size: ");
            sbM4889.append(m5127(iRound));
            sbM4889.append(", memoryClass: ");
            sbM4889.append(c2976.f9135.getMemoryClass());
            sbM4889.append(", isLowMemoryDevice: ");
            sbM4889.append(c2976.f9135.isLowRamDevice());
            Log.d("MemorySizeCalculator", sbM4889.toString());
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final String m5127(int i) {
        return Formatter.formatFileSize(this.f9131, i);
    }
}
