package ඓ.ⁱ.K.ʬ;

import android.os.Build;
import android.text.TextUtils;
import com.google.zxing.qrcode.encoder.Encoder;
import java.nio.charset.Charset;
import java.util.Locale;
import java.util.Random;
import ඓ.ⁱ.K.ඓ.C1252;

/* renamed from: ඓ.ⁱ.K.ʬ.Ԕ  reason: contains not printable characters */
/* compiled from: UserAgent */
public final class C1229 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public static C1229 f4859 = new C1229();

    /* renamed from: ῲ  reason: contains not printable characters */
    public final String f4860;

    /* renamed from: K  reason: contains not printable characters */
    public final String f4861;

    /* JADX WARNING: Removed duplicated region for block: B:12:0x005d A[Catch:{ all -> 0x0080 }] */
    /* JADX WARNING: Removed duplicated region for block: B:15:0x006e A[Catch:{ all -> 0x0080 }] */
    public C1229() {
        String str;
        Random random = new Random();
        this.f4861 = System.currentTimeMillis() + "" + random.nextInt(999);
        String str2 = this.f4861;
        String str3 = "-";
        Object[] objArr = new Object[4];
        objArr[0] = "7.3.15";
        try {
            String str4 = Build.VERSION.RELEASE;
            if (str4 == null) {
                str = str3;
                objArr[1] = str;
                try {
                    String trim = Build.MODEL.trim();
                    String r5 = m3302(Build.MANUFACTURER.trim(), trim);
                    r5 = TextUtils.isEmpty(r5) ? m3302(Build.BRAND.trim(), trim) : r5;
                    StringBuilder sb = new StringBuilder();
                    sb.append(r5 == null ? str3 : r5);
                    sb.append(str3);
                    sb.append(trim);
                    str3 = C1252.m3353(sb.toString());
                } catch (Throwable unused) {
                }
                objArr[2] = str3;
                objArr[3] = str2;
                this.f4860 = String.format("QiniuAndroid/%s (%s; %s; %s", objArr);
            }
            str = C1252.m3353(str4.trim());
            objArr[1] = str;
            String trim2 = Build.MODEL.trim();
            String r52 = m3302(Build.MANUFACTURER.trim(), trim2);
            if (TextUtils.isEmpty(r52)) {
            }
            StringBuilder sb2 = new StringBuilder();
            sb2.append(r52 == null ? str3 : r52);
            sb2.append(str3);
            sb2.append(trim2);
            str3 = C1252.m3353(sb2.toString());
            objArr[2] = str3;
            objArr[3] = str2;
            this.f4860 = String.format("QiniuAndroid/%s (%s; %s; %s", objArr);
        } catch (Throwable unused2) {
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public static String m3302(String str, String str2) {
        String lowerCase = str.toLowerCase(Locale.getDefault());
        if (lowerCase.startsWith("unknown") || lowerCase.startsWith("alps") || lowerCase.startsWith("android") || lowerCase.startsWith("sprd") || lowerCase.startsWith("spreadtrum") || lowerCase.startsWith("rockchip") || lowerCase.startsWith("wondermedia") || lowerCase.startsWith("mtk") || lowerCase.startsWith("mt65") || lowerCase.startsWith("nvidia") || lowerCase.startsWith("brcm") || lowerCase.startsWith("marvell") || str2.toLowerCase(Locale.getDefault()).contains(lowerCase)) {
            return null;
        }
        return str;
    }

    /* renamed from: K  reason: contains not printable characters */
    public String m3303(String str) {
        String trim = ("" + str).trim();
        String substring = trim.substring(0, Math.min(16, trim.length()));
        return new String((this.f4860 + "; " + substring + ")").getBytes(Charset.forName(Encoder.DEFAULT_BYTE_MODE_ENCODING)));
    }
}
