package defpackage;

import j$.util.Objects;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.net.ssl.SSLSocket;

/* renamed from: ᵙᵽ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C2630 {

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public static final C2630 f10210;

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public static final C2630 f10211;

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public static final C2630 f10212;

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final String[] f10213;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final boolean f10214;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final boolean f10215;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final String[] f10216;

    static {
        C4974 c4974 = C4974.f18483;
        C4974 c49742 = C4974.f18475;
        C4974 c49743 = C4974.f18477;
        C4974 c49744 = C4974.f18470;
        C4974 c49745 = C4974.f18478;
        C4974 c49746 = C4974.f18479;
        C4974 c49747 = C4974.f18480;
        C4974 c49748 = C4974.f18476;
        C4974 c49749 = C4974.f18469;
        List listM5912 = AbstractC2240.m5912(c4974, c49742, c49743, c49744, c49745, c49746, c49747, c49748, c49749);
        List listM59122 = AbstractC2240.m5912(c4974, c49742, c49743, c49744, c49745, c49746, c49747, c49748, c49749, C4974.f18482, C4974.f18484, C4974.f18485, C4974.f18474, C4974.f18472, C4974.f18471, C4974.f18468);
        C1894 c1894 = new C1894();
        C4974[] c4974Arr = (C4974[]) listM5912.toArray(new C4974[0]);
        c1894.m5311((C4974[]) Arrays.copyOf(c4974Arr, c4974Arr.length));
        EnumC4208 enumC4208 = EnumC4208.f15735;
        EnumC4208 enumC42082 = EnumC4208.f15738;
        c1894.m5309(enumC4208, enumC42082);
        c1894.f7630 = true;
        c1894.m5310();
        C1894 c18942 = new C1894();
        C4974[] c4974Arr2 = (C4974[]) listM59122.toArray(new C4974[0]);
        c18942.m5311((C4974[]) Arrays.copyOf(c4974Arr2, c4974Arr2.length));
        c18942.m5309(enumC4208, enumC42082);
        c18942.f7630 = true;
        f10210 = c18942.m5310();
        C1894 c18943 = new C1894();
        C4974[] c4974Arr3 = (C4974[]) listM59122.toArray(new C4974[0]);
        c18943.m5311((C4974[]) Arrays.copyOf(c4974Arr3, c4974Arr3.length));
        c18943.m5309(enumC4208, enumC42082, EnumC4208.f15737, EnumC4208.f15736);
        c18943.f7630 = true;
        f10212 = c18943.m5310();
        f10211 = new C2630(false, false, null, null);
    }

    public C2630(boolean z, boolean z2, String[] strArr, String[] strArr2) {
        this.f10214 = z;
        this.f10215 = z2;
        this.f10213 = strArr;
        this.f10216 = strArr2;
    }

    public final boolean equals(Object obj) {
        if (!(obj instanceof C2630)) {
            return false;
        }
        if (obj == this) {
            return true;
        }
        C2630 c2630 = (C2630) obj;
        boolean z = c2630.f10214;
        boolean z2 = this.f10214;
        if (z2 != z) {
            return false;
        }
        if (z2) {
            return Arrays.equals(this.f10213, c2630.f10213) && Arrays.equals(this.f10216, c2630.f10216) && this.f10215 == c2630.f10215;
        }
        return true;
    }

    public final int hashCode() {
        if (!this.f10214) {
            return 17;
        }
        String[] strArr = this.f10213;
        int iHashCode = (527 + (strArr != null ? Arrays.hashCode(strArr) : 0)) * 31;
        String[] strArr2 = this.f10216;
        return ((iHashCode + (strArr2 != null ? Arrays.hashCode(strArr2) : 0)) * 31) + (!this.f10215 ? 1 : 0);
    }

    public final String toString() {
        if (!this.f10214) {
            return "ConnectionSpec()";
        }
        return "ConnectionSpec(cipherSuites=" + Objects.toString(m6621(), "[all enabled]") + ", tlsVersions=" + Objects.toString(m6619(), "[all enabled]") + ", supportsTlsExtensions=" + this.f10215 + ')';
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final ArrayList m6619() {
        String[] strArr = this.f10216;
        if (strArr == null) {
            return null;
        }
        ArrayList arrayList = new ArrayList(strArr.length);
        for (String str : strArr) {
            arrayList.add(ᵮʛˀ.ᵻᵢﹳᵰ(str));
        }
        return arrayList;
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final void m6620(SSLSocket sSLSocket, boolean z) {
        String[] enabledCipherSuites = sSLSocket.getEnabledCipherSuites();
        String[] strArr = this.f10213;
        if (strArr != null) {
            enabledCipherSuites = AbstractC1348.m4177(strArr, enabledCipherSuites, C4974.f18473);
        }
        String[] strArr2 = this.f10216;
        String[] strArrM4177 = strArr2 != null ? AbstractC1348.m4177(sSLSocket.getEnabledProtocols(), strArr2, C2700.f10467) : sSLSocket.getEnabledProtocols();
        String[] supportedCipherSuites = sSLSocket.getSupportedCipherSuites();
        C4544 c4544 = C4974.f18473;
        byte[] bArr = AbstractC1348.f5567;
        int length = supportedCipherSuites.length;
        int i = 0;
        while (true) {
            if (i >= length) {
                i = -1;
                break;
            } else if (c4544.compare(supportedCipherSuites[i], "TLS_FALLBACK_SCSV") == 0) {
                break;
            } else {
                i++;
            }
        }
        if (z && i != -1) {
            String str = supportedCipherSuites[i];
            enabledCipherSuites = (String[]) Arrays.copyOf(enabledCipherSuites, enabledCipherSuites.length + 1);
            enabledCipherSuites[enabledCipherSuites.length - 1] = str;
        }
        String[] strArr3 = (String[]) Arrays.copyOf(enabledCipherSuites, enabledCipherSuites.length);
        boolean z2 = this.f10214;
        if (!z2) {
            ᵹˉᵞ.ˌᵜᵹᵩ("no cipher suites for cleartext connections");
            return;
        }
        if (strArr3.length == 0) {
            ᵹˉᵞ.ˌᵜᵹᵩ("At least one cipher suite is required");
            return;
        }
        String[] strArr4 = (String[]) Arrays.copyOf(strArr3, strArr3.length);
        String[] strArr5 = (String[]) Arrays.copyOf(strArrM4177, strArrM4177.length);
        if (!z2) {
            ᵹˉᵞ.ˌᵜᵹᵩ("no TLS versions for cleartext connections");
            return;
        }
        if (strArr5.length == 0) {
            ᵹˉᵞ.ˌᵜᵹᵩ("At least one TLS version is required");
            return;
        }
        C2630 c2630 = new C2630(z2, this.f10215, strArr4, (String[]) Arrays.copyOf(strArr5, strArr5.length));
        if (c2630.m6619() != null) {
            sSLSocket.setEnabledProtocols(c2630.f10216);
        }
        if (c2630.m6621() != null) {
            sSLSocket.setEnabledCipherSuites(c2630.f10213);
        }
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final ArrayList m6621() {
        String[] strArr = this.f10213;
        if (strArr == null) {
            return null;
        }
        ArrayList arrayList = new ArrayList(strArr.length);
        for (String str : strArr) {
            arrayList.add(C4974.f18481.ᵞʡ(str));
        }
        return arrayList;
    }
}
