그늘 v4.6.9版本的 MD5 值为:45bd3dac9e441bb87fea09c92b437adc

以下内容为反编译后的 b.java 源代码,内容仅作参考


package be;

import android.content.Context;
import android.os.Bundle;
import android.os.SystemClock;
import com.huawei.hms.framework.common.ContainerUtils;
import java.io.CharConversionException;
import java.io.EOFException;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InvalidClassException;
import java.io.InvalidObjectException;
import java.io.NotActiveException;
import java.io.NotSerializableException;
import java.io.OptionalDataException;
import java.io.StreamCorruptedException;
import java.io.SyncFailedException;
import java.io.UTFDataFormatException;
import java.io.UnsupportedEncodingException;
import java.io.WriteAbortedException;
import java.net.BindException;
import java.net.ConnectException;
import java.net.HttpRetryException;
import java.net.MalformedURLException;
import java.net.NoRouteToHostException;
import java.net.PortUnreachableException;
import java.net.ProtocolException;
import java.net.SocketTimeoutException;
import java.net.URLEncoder;
import java.net.UnknownHostException;
import java.net.UnknownServiceException;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.FileLockInterruptionException;
import java.nio.charset.MalformedInputException;
import java.nio.charset.StandardCharsets;
import java.nio.charset.UnmappableCharacterException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.InvalidPropertiesFormatException;
import java.util.UUID;
import java.util.zip.ZipException;
import javax.net.ssl.SSLHandshakeException;
import javax.net.ssl.SSLKeyException;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLProtocolException;
import org.json.JSONException;
import qk.b0;
import qk.s;
import qk.t;
import qk.u;
import qk.w;
import qk.x;
public final class b {

    public static class a extends Exception {
        public a(int i) {
            super(a1.i.d("http status code error:", i));
        }
    }

    public static class C0026b extends Exception {
        public C0026b() {
            super("network unavailable");
        }
    }

    public static HashMap a(Bundle bundle) {
        HashMap hashMap = new HashMap();
        if (bundle.size() != 0) {
            for (String str : bundle.keySet()) {
                Object obj = bundle.get(str);
                if (!(obj instanceof String) && !(obj instanceof String[])) {
                    ae.a.i("openSDK_LOG.HttpUtils", "parseBundleToMap: the type " + obj.getClass() + " is unsupported");
                } else if (obj instanceof String[]) {
                    String[] strArr = (String[]) obj;
                    StringBuilder sb2 = new StringBuilder();
                    for (int i = 0; i < strArr.length; i++) {
                        if (i != 0) {
                            sb2.append(",");
                        }
                        sb2.append(strArr[i]);
                    }
                    hashMap.put(str, sb2.toString());
                } else {
                    hashMap.put(str, (String) obj);
                }
            }
        }
        return hashMap;
    }

    public static yd.b b(String str, String str2, Bundle bundle) throws IOException {
        Bundle bundle2;
        Bundle bundle3;
        if (bundle != null) {
            bundle2 = new Bundle(bundle);
        } else {
            bundle2 = new Bundle();
        }
        boolean z10 = false;
        if (str2.equalsIgnoreCase("GET")) {
            HashMap a10 = a(bundle2);
            if (!((bundle2.containsKey("access_token") || bundle2.containsKey("pay_token") || bundle2.containsKey("pfkey") || bundle2.containsKey("expires_in") || bundle2.containsKey("openid") || bundle2.containsKey("proxy_code") || bundle2.containsKey("proxy_expires_in")) ? true : true)) {
                bundle3 = bundle2;
            } else {
                bundle3 = new Bundle(bundle2);
                bundle3.remove("access_token");
                bundle3.remove("pay_token");
                bundle3.remove("pfkey");
                bundle3.remove("expires_in");
                bundle3.remove("openid");
                bundle3.remove("proxy_code");
                bundle3.remove("proxy_expires_in");
            }
            if (bundle3 != bundle2) {
                ae.a.f("openSDK_LOG.HttpUtils", "-->openUrl encodedParam =" + bundle3.toString() + " -- url = " + str);
            } else {
                ae.a.f("openSDK_LOG.HttpUtils", "-->openUrl encodedParam =" + a10.toString() + " -- url = " + str);
            }
            return yd.a.a().c(str, a10);
        } else if (str2.equalsIgnoreCase("POST")) {
            HashMap a11 = a(bundle2);
            HashMap hashMap = new HashMap(0);
            if (bundle2.size() != 0) {
                for (String str3 : bundle2.keySet()) {
                    Object obj = bundle2.get(str3);
                    if (obj instanceof byte[]) {
                        hashMap.put(str3, (byte[]) obj);
                    }
                }
            }
            if (hashMap.size() == 0) {
                return yd.a.a().d(str, a11);
            }
            ae.a.i("openSDK_LOG.HttpUtils", "openUrl: has binary " + hashMap.size());
            yd.a a12 = yd.a.a();
            a12.getClass();
            if (hashMap.size() == 0) {
                return a12.d(str, a11);
            }
            ae.a.f("openSDK_LOG.OpenHttpService", "post data, has byte data");
            String uuid = UUID.randomUUID().toString();
            s sVar = t.f13113e;
            ArrayList arrayList = new ArrayList();
            bl.h e10 = bl.h.e(uuid);
            if (a11.size() > 0) {
                for (String str4 : a11.keySet()) {
                    String str5 = (String) a11.get(str4);
                    if (str5 != null) {
                        arrayList.add(t.b.b(str4, null, b0.c(null, str5.getBytes(StandardCharsets.UTF_8))));
                    }
                }
            }
            for (String str6 : hashMap.keySet()) {
                byte[] bArr = (byte[]) hashMap.get(str6);
                if (bArr != null && bArr.length > 0) {
                    arrayList.add(t.b.b(str6, str6, b0.c(s.b("content/unknown"), bArr)));
                    ae.a.i("openSDK_LOG.OpenHttpService", "post byte data.");
                }
            }
            if (!arrayList.isEmpty()) {
                t tVar = new t(e10, sVar, arrayList);
                x.a aVar = new x.a();
                aVar.e(str);
                aVar.b("POST", tVar);
                x a13 = aVar.a();
                u uVar = a12.f15897a;
                uVar.getClass();
                return new yd.b(w.c(uVar, a13, false).execute(), (int) tVar.a());
            }
            throw new IllegalStateException("Multipart body must have at least one part.");
        } else {
            ae.a.c("openSDK_LOG.HttpUtils", "openUrl: http method " + str2 + " is not supported.");
            throw new IOException("http method is not supported.");
        }
    }

    public static String c(HashMap hashMap) {
        if (hashMap.size() == 0) {
            return "";
        }
        StringBuilder sb2 = new StringBuilder();
        boolean z10 = true;
        for (String str : hashMap.keySet()) {
            if (z10) {
                z10 = false;
            } else {
                sb2.append(ContainerUtils.FIELD_DELIMITER);
            }
            sb2.append(URLEncoder.encode(str));
            sb2.append(ContainerUtils.KEY_VALUE_DELIMITER);
            sb2.append(URLEncoder.encode((String) hashMap.get(str)));
        }
        return sb2.toString();
    }

    public static int d(IOException iOException) {
        if (iOException instanceof CharConversionException) {
            return -20;
        }
        if (iOException instanceof MalformedInputException) {
            return -21;
        }
        if (iOException instanceof UnmappableCharacterException) {
            return -22;
        }
        if (iOException instanceof ClosedChannelException) {
            return -24;
        }
        if (iOException instanceof EOFException) {
            return -26;
        }
        if (iOException instanceof FileLockInterruptionException) {
            return -27;
        }
        if (iOException instanceof FileNotFoundException) {
            return -28;
        }
        if (iOException instanceof HttpRetryException) {
            return -29;
        }
        if (iOException instanceof SocketTimeoutException) {
            return -8;
        }
        if (iOException instanceof InvalidPropertiesFormatException) {
            return -30;
        }
        if (iOException instanceof MalformedURLException) {
            return -3;
        }
        if (iOException instanceof InvalidClassException) {
            return -33;
        }
        if (iOException instanceof InvalidObjectException) {
            return -34;
        }
        if (iOException instanceof NotActiveException) {
            return -35;
        }
        if (iOException instanceof NotSerializableException) {
            return -36;
        }
        if (iOException instanceof OptionalDataException) {
            return -37;
        }
        if (iOException instanceof StreamCorruptedException) {
            return -38;
        }
        if (iOException instanceof WriteAbortedException) {
            return -39;
        }
        if (iOException instanceof ProtocolException) {
            return -40;
        }
        if (iOException instanceof SSLHandshakeException) {
            return -41;
        }
        if (iOException instanceof SSLKeyException) {
            return -42;
        }
        if (iOException instanceof SSLPeerUnverifiedException) {
            return -43;
        }
        if (iOException instanceof SSLProtocolException) {
            return -44;
        }
        if (iOException instanceof BindException) {
            return -45;
        }
        if (iOException instanceof ConnectException) {
            return -46;
        }
        if (iOException instanceof NoRouteToHostException) {
            return -47;
        }
        if (iOException instanceof PortUnreachableException) {
            return -48;
        }
        if (iOException instanceof SyncFailedException) {
            return -49;
        }
        if (iOException instanceof UTFDataFormatException) {
            return -50;
        }
        if (iOException instanceof UnknownHostException) {
            return -51;
        }
        if (iOException instanceof UnknownServiceException) {
            return -52;
        }
        if (iOException instanceof UnsupportedEncodingException) {
            return -53;
        }
        if (iOException instanceof ZipException) {
            return -54;
        }
        return -2;
    }

    public static void e(td.f fVar, Context context, String str, Bundle bundle, String str2) throws IOException, JSONException, C0026b, a {
        String str3;
        String str4;
        int i;
        long j10;
        long j11;
        int i10;
        ae.a.f("openSDK_LOG.HttpUtils", "OpenApi request");
        if (l.n(context)) {
            if (!str.toLowerCase().startsWith("http")) {
                str3 = i.a().b(context, "https://openmobile.qq.com/") + str;
                str4 = i.a().b(context, "https://openmobile.qq.com/") + str;
            } else {
                str3 = str;
                str4 = str3;
            }
            int i11 = 0;
            if (str.indexOf("add_share") > -1 || str.indexOf("upload_pic") > -1 || str.indexOf("add_topic") > -1 || str.indexOf("set_user_face") > -1 || str.indexOf("add_t") > -1 || str.indexOf("add_pic_t") > -1 || str.indexOf("add_pic_url") > -1 || str.indexOf("add_video") > -1) {
                wf.d.p(context, fVar, str);
            }
            long elapsedRealtime = SystemClock.elapsedRealtime();
            int a10 = h.b(context, fVar.f13884a).a("Common_HttpRetryCount");
            StringBuilder i12 = androidx.appcompat.widget.d.i("config 1:Common_HttpRetryCount            config_value:", a10, "   appid:");
            String str5 = fVar.f13884a;
            i12.append(str5);
            i12.append("     url:");
            i12.append(str4);
            ae.a.h("OpenConfig_test", i12.toString());
            if (a10 == 0) {
                a10 = 3;
            }
            ae.a.h("OpenConfig_test", "config 1:Common_HttpRetryCount            result_value:" + a10 + "   appid:" + str5 + "     url:" + str4);
            long j12 = elapsedRealtime;
            while (true) {
                int i13 = i11 + 1;
                try {
                    try {
                        yd.b b10 = b(str3, str2, bundle);
                        int i14 = b10.f15902c;
                        ae.a.f("openSDK_LOG.HttpUtils", "request statusCode " + i14);
                        if (i14 == 200) {
                            try {
                                i10 = l.s(b10.a()).getInt("ret");
                            } catch (JSONException unused) {
                                i10 = -4;
                            }
                            j11 = b10.f15904e;
                            i = i10;
                            j10 = b10.f15903d;
                        } else {
                            zd.h.b().d(str4, j12, 0L, 0L, i14);
                            throw new a(i14);
                        }
                    } catch (JSONException e10) {
                        e10.printStackTrace();
                        zd.h.b().d(str4, j12, 0L, 0L, -4);
                        throw e10;
                    }
                } catch (MalformedURLException e11) {
                    e11.printStackTrace();
                    zd.h.b().d(str4, j12, 0L, 0L, -3);
                    throw e11;
                } catch (SocketTimeoutException e12) {
                    e12.printStackTrace();
                    i = -8;
                    j10 = 0;
                    j11 = 0;
                    if (i13 < a10) {
                        j12 = SystemClock.elapsedRealtime();
                        if (i13 >= a10) {
                            break;
                        }
                        i11 = i13;
                    } else {
                        zd.h.b().d(str4, j12, 0L, 0L, -8);
                        throw e12;
                    }
                } catch (IOException e13) {
                    e13.printStackTrace();
                    zd.h.b().d(str4, j12, 0L, 0L, d(e13));
                    throw e13;
                }
            }
            zd.h.b().d(str4, j12, j10, j11, i);
            return;
        }
        throw new C0026b();
    }
}