省心素材.apk(点击下载) / c.java


package cn.jiguang.be;

import android.content.Context;
import android.text.TextUtils;
import cn.jiguang.bc.f;
import cn.jiguang.bc.h;
import cn.jiguang.bx.e;
import cn.jiguang.net.HttpRequest;
import cn.jiguang.net.HttpResponse;
import cn.jiguang.net.HttpUtils;
import com.alipay.sdk.sys.a;
import com.google.common.base.Ascii;
import com.google.common.primitives.SignedBytes;
import okio.Utf8;
import org.json.JSONArray;
import org.json.JSONObject;

public class c {
    private static final String a = b.b(new byte[]{109, 80, 79, 112, 92, 113, Ascii.DLE, 94, 75, 69, 96, 119, 115, 80, 106, 37, 85, 97, 101, 91, 73, 71, 68, 113, 97, 45, 79, 88, 80, 116, 99, 91, 97, 71, 90, 114, 71, 72, 76, 82, 118, 82, 82, 88, 90, SignedBytes.MAX_POWER_OF_TWO, 101, 106, 17, 74, 125, 98, 126, 114, 70, 83, 70, 81, 98, 102, 86, 86, 70, 71, 39, Ascii.US, 87, 122, 126, 122, 91, 69, 69, 96, 56, 47, 82, 116, 66, 79, 57, 94, 71, 89, 116, 76, 126, 122, 105, 117, 99, 84, 88, 80, 114, 104, 76, 125, 124, 81, 83, 96, 111, 107, 105, Byte.MAX_VALUE, 105, 102, 73, 111, 82, 69, 67, 105, 76, 110, 126, 124, 72, 101, 107, 106, 102, 67, 93, 118, 108, 88, 66, 89, 40, 91, 106, 90, 112, SignedBytes.MAX_POWER_OF_TWO, 112, 2, 102, 113, 68, 70, 85, 84, 90, 87, Utf8.REPLACEMENT_BYTE, 117, 97, 94, 70, 44, Byte.MAX_VALUE, 126, 33, 123, 116, 46, 48, 96, 70, Ascii.US, 82, 94, 56, 90, 93, 87, Ascii.SYN, 95, 94, 103, 121, 104, 111, 122, 100, 66, 73, 117, 68, 45, 112, 102, 41, 82, 100, 104, 108, 123, 71, 74, 106, 117, 66, 89, 72, 5, 88, 105, 114, 47, 115, 117, 118, 87, 69, 35, 62, 97, 105, 93, 73, 71, 80, 114});

    public static String a() {
        return a;
    }

    /* JADX WARNING: Removed duplicated region for block: B:19:0x0090  */
    /* JADX WARNING: Removed duplicated region for block: B:20:0x0097  */
    public static String a(Context context, String str, String str2, long j, long j2) {
        String str3;
        try {
            JSONObject a2 = f.a(context);
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("userVersion", j);
            jSONObject.put("eventVersion", j2);
            jSONObject.put("model_num", a2.optString("model", ""));
            jSONObject.put("manufacturer", a2.optString("manufacturer", ""));
            jSONObject.put(a.f, f.l(context));
            if (str == null) {
                str = "";
            }
            jSONObject.put("cuid", str);
            jSONObject.put("rid", str2);
            JSONArray optJSONArray = a2.optJSONArray("sim_slots");
            if (optJSONArray != null) {
                int i = 0;
                while (true) {
                    if (i >= optJSONArray.length()) {
                        break;
                    }
                    JSONObject optJSONObject = optJSONArray.optJSONObject(i);
                    if (optJSONObject != null) {
                        str3 = optJSONObject.optString("imei");
                        if (!TextUtils.isEmpty(str3)) {
                            break;
                        }
                    }
                    i++;
                }
                jSONObject.put("imei", str3);
                jSONObject.put("resolution", a2.optString("resolution"));
                jSONObject.put("os", "a");
                jSONObject.put("sysver", a2.optString("os_version"));
                JSONObject optJSONObject2 = a2.optJSONObject("ids");
                jSONObject.put("oaid", optJSONObject2 == null ? optJSONObject2.optString("joad") : "");
                jSONObject.put("time", System.currentTimeMillis());
                jSONObject.put("joperate_sdk_version", h.a());
                jSONObject.put("jcore_sdk_version", f.c(context));
                jSONObject.put("app_version", a.a(context));
                return b(context, c(), jSONObject);
            }
            str3 = "";
            jSONObject.put("imei", str3);
            jSONObject.put("resolution", a2.optString("resolution"));
            jSONObject.put("os", "a");
            jSONObject.put("sysver", a2.optString("os_version"));
            JSONObject optJSONObject22 = a2.optJSONObject("ids");
            jSONObject.put("oaid", optJSONObject22 == null ? optJSONObject22.optString("joad") : "");
            jSONObject.put("time", System.currentTimeMillis());
            jSONObject.put("joperate_sdk_version", h.a());
            jSONObject.put("jcore_sdk_version", f.c(context));
            jSONObject.put("app_version", a.a(context));
            return b(context, c(), jSONObject);
        } catch (Throwable th) {
            f.b("JOperateHttpHelper", "configDownload:", th);
            return "";
        }
    }

    public static String a(Context context, String str, String str2, JSONObject jSONObject) {
        JSONObject jSONObject2 = new JSONObject();
        try {
            jSONObject2.put("appKey", f.l(context));
            jSONObject2.put("cuid", str);
            jSONObject2.put("rid", str2);
            jSONObject2.put("value", jSONObject);
            jSONObject2.put("time", System.currentTimeMillis());
            return b(context, d(), jSONObject2);
        } catch (Throwable th) {
            f.b("JOperateHttpHelper", "setLoginTag e1:", th);
            return a(th).toString();
        }
    }

    public static String a(Context context, String str, JSONObject jSONObject) {
        try {
            jSONObject.put("appKey", f.l(context));
            jSONObject.put("cuid", str);
            jSONObject.put("time", System.currentTimeMillis());
            return b(context, e(), jSONObject);
        } catch (Throwable th) {
            f.b("JOperateHttpHelper", "setChannel:", th);
            return a(th).toString();
        }
    }

    public static String a(Context context, JSONObject jSONObject) {
        return b(context, b(), jSONObject);
    }

    public static String a(String str) {
        try {
            return e.b(str, a(), "RSA/ECB/PKCS1Padding");
        } catch (Throwable unused) {
            f.e("getBasicAuthorization", "basic authorization encode failed");
            return null;
        }
    }

    private static JSONObject a(Throwable th) {
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("code", -1);
            jSONObject.put("msg", th.getMessage());
        } catch (Throwable unused) {
        }
        return jSONObject;
    }

    private static String b() {
        return b("/v1/visual-bury-sdk-api/smartop/debug/report");
    }

    public static String b(Context context, String str, JSONObject jSONObject) {
        JSONObject jSONObject2;
        try {
            HttpRequest httpRequest = new HttpRequest(str);
            httpRequest.setRequestProperty("Content-Type", "application/json");
            httpRequest.setRequestProperty("Accept", "application/json");
            String a2 = e.a((long) e.a());
            httpRequest.setRequestProperty("Authorization", a(a2));
            String jSONObject3 = jSONObject.toString();
            f.a("JOperateHttpHelper", "sendHttp ulr:" + httpRequest.getUrl());
            f.a("JOperateHttpHelper", "sendHttp body:" + jSONObject3);
            httpRequest.setBody(e.a(jSONObject3.getBytes("UTF-8"), a2, "q5bfn8msyozljacg", true));
            HttpResponse httpPost = HttpUtils.httpPost(context, httpRequest);
            f.a("JOperateHttpHelper", "sendHttp httpResponse:" + httpPost.toString());
            if (200 == httpPost.getResponseCode()) {
                return httpPost.getResponseBody();
            }
            f.f("JOperateHttpHelper", "sendHttp: httpResponse:" + httpPost);
            JSONObject jSONObject4 = new JSONObject();
            try {
                jSONObject4.put("code", -1);
                jSONObject4.put("msg", httpPost);
            } catch (Throwable unused) {
            }
            return jSONObject4.toString();
        } catch (Throwable unused2) {
        }
        return jSONObject2.toString();
    }

    private static String b(String str) {
        return "https://sdkapi-smartop.jiguang.cn" + str;
    }

    private static String c() {
        return b("/v1/visual-bury-sdk-api/smartop/getEvent");
    }

    private static String d() {
        return b("/v1/visual-bury-sdk-api/smartop/setUserInfo");
    }

    private static String e() {
        return b("/v1/visual-bury-sdk-api/smartop/setChannel");
    }
}