翰林优商.apk(点击下载) / a.java


package com.baidu.liantian.x0.e;

import android.content.Context;
import android.text.TextUtils;
import com.baidu.liantian.ac.FI;
import com.baidu.liantian.x0.EngineImpl;
import com.baidu.liantian.x0.a.e;
import com.baidu.liantian.x6.d.f;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.sigmob.sdk.base.mta.PointType;
import org.json.JSONObject;

/* compiled from: PolicyManager */
public class a {
    private static String a() {
        try {
            Class<?> cls = Class.forName("com.baidu.liantian.ac.F");
            FI fi = (FI) cls.getDeclaredMethod("getInstance", new Class[0]).invoke(cls, new Object[0]);
            if (fi != null) {
                return (String) cls.getDeclaredMethod("gep", new Class[0]).invoke(fi, new Object[0]);
            }
            return "";
        } catch (Throwable th) {
            e.a(th);
            return "";
        }
    }

    public static void a(Context context) {
        try {
            String a = a();
            if (!TextUtils.isEmpty(a)) {
                JSONObject jSONObject = new JSONObject(a);
                try {
                    JSONObject jSONObject2 = jSONObject.getJSONObject(CampaignEx.JSON_AD_IMP_KEY);
                    if (jSONObject2 != null) {
                        a(context, jSONObject2);
                    }
                } catch (Throwable th) {
                    e.a(th);
                }
                try {
                    String optString = jSONObject.optString("fig");
                    if (optString != null) {
                        a(context, optString);
                    }
                } catch (Throwable th2) {
                    e.a(th2);
                }
                try {
                    String optString2 = jSONObject.optString("sig");
                    if (optString2 != null) {
                        a(optString2);
                    }
                } catch (Throwable th3) {
                    e.a(th3);
                }
            }
        } catch (Throwable th4) {
            e.a(th4);
        }
    }

    private static void a(Context context, JSONObject jSONObject) {
        try {
            com.baidu.liantian.x0.f.a aVar = new com.baidu.liantian.x0.f.a(context);
            a(jSONObject, aVar);
            b(jSONObject, aVar);
            a(context, jSONObject, aVar);
            c(jSONObject, aVar);
            d(jSONObject, aVar);
            aVar.c(true);
        } catch (Throwable th) {
            e.a(th);
        }
    }

    private static void a(JSONObject jSONObject, com.baidu.liantian.x0.f.a aVar) {
        try {
            JSONObject optJSONObject = jSONObject.optJSONObject("3");
            if (optJSONObject != null) {
                aVar.a("plc03", optJSONObject.toString());
            }
        } catch (Throwable th) {
            e.a(th);
        }
    }

    private static void b(JSONObject jSONObject, com.baidu.liantian.x0.f.a aVar) {
        try {
            JSONObject optJSONObject = jSONObject.optJSONObject("15");
            if (optJSONObject != null) {
                aVar.a("plc15", optJSONObject.toString());
            }
            JSONObject optJSONObject2 = jSONObject.optJSONObject("16");
            if (optJSONObject2 != null) {
                aVar.a("plc16", optJSONObject2.toString());
            }
            JSONObject optJSONObject3 = jSONObject.optJSONObject("18");
            if (optJSONObject3 != null) {
                aVar.a("plc18", optJSONObject3.toString());
            }
            JSONObject optJSONObject4 = jSONObject.optJSONObject("20");
            if (optJSONObject4 != null) {
                aVar.a("plc20", optJSONObject4.toString());
            }
        } catch (Throwable th) {
            e.a(th);
        }
    }

    private static void a(Context context, JSONObject jSONObject, com.baidu.liantian.x0.f.a aVar) {
        try {
            JSONObject optJSONObject = jSONObject.optJSONObject("51");
            if (optJSONObject != null) {
                aVar.a("plc51", optJSONObject.toString());
                a(context, aVar, optJSONObject);
            }
        } catch (Throwable th) {
            e.a(th);
        }
    }

    private static void c(JSONObject jSONObject, com.baidu.liantian.x0.f.a aVar) {
        try {
            JSONObject optJSONObject = jSONObject.optJSONObject("71");
            if (optJSONObject != null) {
                aVar.a("plc71", optJSONObject.toString());
            }
        } catch (Throwable th) {
            e.a(th);
        }
    }

    private static void d(JSONObject jSONObject, com.baidu.liantian.x0.f.a aVar) {
        try {
            JSONObject optJSONObject = jSONObject.optJSONObject("84");
            if (optJSONObject != null) {
                aVar.a("plc84", optJSONObject.toString());
            }
        } catch (Throwable th) {
            e.a(th);
        }
    }

    private static void a(Context context, com.baidu.liantian.x0.f.a aVar, JSONObject jSONObject) {
        try {
            JSONObject optJSONObject = jSONObject.optJSONObject("5");
            if (optJSONObject != null) {
                int optInt = optJSONObject.optInt("1", 0);
                if (optInt == 0 && aVar.b()) {
                    EngineImpl.getInstance(context).unload();
                }
                aVar.b(optInt);
                com.baidu.liantian.x6.jni.a a = com.baidu.liantian.x6.jni.a.a(context);
                if (optJSONObject.optInt("16", 0) == 1) {
                    a.a();
                }
                a.a(optJSONObject.optInt("2", 0));
                a.c(optJSONObject.optInt("5", 50));
                a.a(optJSONObject.optBoolean("6", true));
                a.e(optJSONObject.optInt("7", 3));
                aVar.c(optJSONObject.optInt(PointType.SIGMOB_ERROR, 0));
                aVar.d(optJSONObject.optInt("15", 3));
            }
        } catch (Throwable th) {
            e.a(th);
        }
    }

    private static void a(Context context, String str) {
        try {
            if (!TextUtils.isEmpty(str)) {
                com.baidu.liantian.x6.a.a aVar = new com.baidu.liantian.x6.a.a(context);
                JSONObject optJSONObject = new JSONObject(str).optJSONObject("14");
                if (optJSONObject != null) {
                    aVar.a(com.baidu.liantian.x6.a.a.n, optJSONObject.toString());
                }
            }
        } catch (Throwable th) {
            e.a(th);
        }
    }

    private static void a(String str) {
        try {
            f.a = str;
        } catch (Throwable th) {
            e.a(th);
        }
    }
}