Spermatid v6.1.8版本的 MD5 值为:a375ce51a42d528ba6e2583c10478296

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


package com.windmill.sdk.b;

import aegon.chrome.base.TimeUtils;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import com.czhj.sdk.common.ClientMetadata;
import com.czhj.sdk.common.models.Config;
import com.czhj.sdk.common.network.Networking;
import com.czhj.sdk.common.network.SigmobRequestQueue;
import com.czhj.sdk.common.track.TrackManager;
import com.czhj.volley.VolleyError;
import com.windmill.sdk.WindMillAd;
import com.windmill.sdk.b.c;
import com.windmill.sdk.base.WMLogUtil;
import com.windmill.sdk.models.Android;
import com.windmill.sdk.models.Common;
import com.windmill.sdk.models.CommonEndpointsConfig;
import com.windmill.sdk.models.SdkConfig;
import com.windmill.sdk.models.SdkConfigResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.List;

public class g {

    private static g f30707a = null;

    private static boolean f30708b = false;

    private static String f30709k = "";

    private a f30717j;

    private final String f30712e = "tb-3.4.3";

    private long f30714g = 0;

    private SdkConfig f30715h = null;

    private SdkConfig f30716i = null;

    private String f30718l = "https://adservice.sigmob.cn/strategy/v6";

    private String f30719m = "https://adservice.sigmob.cn/waterfall/v1";

    private String f30720n = "https://dc.sigmob.cn/log";

    private final Handler f30710c = new Handler(Looper.getMainLooper());

    private final Runnable f30711d = new Runnable() {
        @Override
        public void run() {
            g.this.B();
        }
    };

    private boolean f30713f = true;

    public interface a {
        void a();
    }

    private g() {
        y();
        A();
    }

    private void A() {
        if (ClientMetadata.getInstance() == null) {
            a(this.f30716i);
            return;
        }
        ObjectInputStream objectInputStream = null;
        String string = com.windmill.sdk.c.i.a(ClientMetadata.getInstance().getContext()).getString("sdkConfigVer", null);
        File file = new File(com.windmill.sdk.c.d.a() + "/tb_config");
        if ("tb-3.4.3".equals(string)) {
            try {
                if (file.exists()) {
                    try {
                        ObjectInputStream objectInputStream2 = new ObjectInputStream(new FileInputStream(file));
                        try {
                            a(SdkConfig.ADAPTER.decode(objectInputStream2));
                            objectInputStream2.close();
                        } catch (Throwable th) {
                            th = th;
                            objectInputStream = objectInputStream2;
                            try {
                                a(this.f30716i);
                                WMLogUtil.e(th.getMessage());
                                if (objectInputStream != null) {
                                    objectInputStream.close();
                                    return;
                                }
                                return;
                            } catch (Throwable th2) {
                                if (objectInputStream != null) {
                                    try {
                                        objectInputStream.close();
                                    } catch (Throwable th3) {
                                        WMLogUtil.e(th3.getMessage());
                                    }
                                }
                                throw th2;
                            }
                        }
                    } catch (Throwable th4) {
                        th = th4;
                    }
                    return;
                }
            } catch (Throwable th5) {
                WMLogUtil.e(th5.getMessage());
                return;
            }
        }
        a(this.f30716i);
    }

    public void B() {
        if (ClientMetadata.getInstance() == null) {
            return;
        }
        if (ClientMetadata.getInstance().isNetworkConnected(b()) && com.windmill.sdk.a.a.b()) {
            C();
        } else {
            WMLogUtil.e("Can't load an ad because  is no network or can not CollectPersonalInformation");
            D();
        }
    }

    private void C() {
        SigmobRequestQueue requestQueue = Networking.getRequestQueue();
        c cVar = new c(b(), new c.a() {
            @Override
            public void a(SdkConfigResponse sdkConfigResponse) {
                WMLogUtil.dd(WMLogUtil.TAG, "SdkConfigResponse:" + sdkConfigResponse.toString());
                SdkConfig sdkConfig = sdkConfigResponse.config;
                if (sdkConfigResponse.code.intValue() == 0 && sdkConfig != null) {
                    g.this.a(sdkConfig);
                    g.this.b(sdkConfig);
                } else {
                    WMLogUtil.e("ConfigResponseError:" + sdkConfigResponse.error_message);
                }
                g.this.D();
            }

            @Override
            public void onErrorResponse(VolleyError volleyError) {
                WMLogUtil.e("ConfigResponseError:" + volleyError.toString());
                g.this.D();
            }
        });
        if (requestQueue == null) {
            WMLogUtil.e("queue is null");
            D();
        } else {
            requestQueue.add(cVar);
            WMLogUtil.i(WMLogUtil.TAG, "start update sdk config");
        }
    }

    public void D() {
        z();
        if (this.f30713f) {
            this.f30710c.postDelayed(this.f30711d, Math.max(30000L, this.f30714g));
        }
    }

    public static String c() {
        return "https://adservice.sigmob.cn/extconfig?" + d();
    }

    public static String d() {
        return "appId=" + WindMillAd.sharedAds().getAppId() + "&sdkVersion=3.4.3";
    }

    private void y() {
        if (this.f30716i == null) {
            SdkConfig.Builder builder = new SdkConfig.Builder();
            Common.Builder builder2 = new Common.Builder();
            Android.Builder builder3 = new Android.Builder();
            CommonEndpointsConfig.Builder builder4 = new CommonEndpointsConfig.Builder();
            builder4.log(this.f30720n);
            builder4.strategy(this.f30718l);
            builder4.bidding_url(this.f30719m);
            builder2.endpoints(builder4.build());
            builder2.configRefresh(1000);
            Boolean bool = Boolean.TRUE;
            builder2.disable_up_location(bool);
            Boolean bool2 = Boolean.FALSE;
            builder2.is_gdpr_region(bool2);
            builder2.enable_debug_level(bool2);
            builder3.disable_boot_mark(bool);
            builder3.oaid_api_is_disable(bool);
            builder3.enable_permission(bool2);
            builder3.enable_report_crash(bool2);
            builder.common_config(builder2.build());
            builder.android_config(builder3.build());
            this.f30716i = builder.build();
        }
    }

    private void z() {
        this.f30710c.removeCallbacks(this.f30711d);
    }

    public void e() {
        z();
        this.f30710c.post(this.f30711d);
    }

    public SdkConfig f() {
        SdkConfig sdkConfig = this.f30715h;
        return sdkConfig == null ? this.f30716i : sdkConfig;
    }

    public Common g() {
        return f().common_config;
    }

    public Android h() {
        return f().android_config;
    }

    public String i() {
        String str = g().endpoints.log;
        if (!TextUtils.isEmpty(str)) {
            if (str.indexOf(63) == -1) {
                return str + "?" + d();
            }
            return str + "&" + d();
        }
        return this.f30720n + "?" + d();
    }

    public String j() {
        String str = g().endpoints.strategy;
        if (!TextUtils.isEmpty(str)) {
            if (str.indexOf(63) == -1) {
                return str + "?" + d();
            }
            return str + "&" + d();
        }
        return this.f30718l + "?" + d();
    }

    public String k() {
        String str = g().endpoints.bidding_url;
        if (!TextUtils.isEmpty(str)) {
            if (str.indexOf(63) == -1) {
                return str + "?" + d();
            }
            return str + "&" + d();
        }
        return this.f30719m + "?" + d();
    }

    public int l() {
        int intValue = g().max_send_log_records.intValue();
        if (intValue < 10) {
            return 100;
        }
        return intValue;
    }

    public boolean m() {
        if (g() != null) {
            return g().log_enc.booleanValue();
        }
        return false;
    }

    public int n() {
        return (g() == null || g().tracking_expiration_time.intValue() < 1) ? TimeUtils.SECONDS_PER_DAY : g().tracking_expiration_time.intValue();
    }

    public int o() {
        if (g() == null || g().tracking_retry_interval.intValue() < 10) {
            return 180;
        }
        return g().tracking_retry_interval.intValue();
    }

    public int p() {
        int intValue = g().send_log_interval.intValue();
        if (intValue < 3) {
            return 3;
        }
        return intValue;
    }

    public List<Integer> q() {
        return g().dclog_blacklist;
    }

    public long r() {
        int intValue = g().ready_expire_timestamp.intValue();
        if (intValue < 1) {
            intValue = 900;
        }
        return intValue * 1000;
    }

    public long s() {
        Integer num = g().load_interval;
        if (num == null || num.intValue() < 1) {
            return 0L;
        }
        return num.intValue() * 1000;
    }

    public boolean t() {
        if (f() == null || g().disable_up_location == null) {
            return true;
        }
        return g().disable_up_location.booleanValue();
    }

    public int u() {
        if (f() == null || h() == null) {
            return 0;
        }
        return h().disable_up_oaid.intValue();
    }

    public boolean v() {
        if (f() == null || h() == null) {
            return false;
        }
        return h().enable_report_crash.booleanValue();
    }

    public boolean w() {
        if (f() == null || h() == null) {
            return true;
        }
        return h().oaid_api_is_disable.booleanValue();
    }

    public boolean x() {
        if (f() == null || h() == null) {
            return true;
        }
        return h().disable_boot_mark.booleanValue();
    }

    public static g a() {
        if (f30707a == null) {
            synchronized (g.class) {
                if (f30707a == null) {
                    f30707a = new g();
                }
            }
        }
        return f30707a;
    }

    public static String b() {
        if (!TextUtils.isEmpty(f30709k)) {
            return f30709k + "?" + d();
        }
        return "https://adservice.sigmob.cn/w/config?" + d();
    }

    public void b(SdkConfig sdkConfig) {
        ObjectOutputStream objectOutputStream;
        if (sdkConfig != null) {
            ObjectOutputStream objectOutputStream2 = null;
            File file = new File(com.windmill.sdk.c.d.a() + "/tb_config");
            if (file.exists()) {
                file.delete();
            }
            file.getParentFile().mkdirs();
            try {
                try {
                    try {
                        objectOutputStream = new ObjectOutputStream(new FileOutputStream(file));
                    } catch (IOException e10) {
                        e = e10;
                    }
                } catch (Throwable th) {
                    th = th;
                }
                try {
                    sdkConfig.encode(objectOutputStream);
                    com.windmill.sdk.c.i.a(ClientMetadata.getInstance().getContext()).edit().putString("sdkConfigVer", "tb-3.4.3").apply();
                    objectOutputStream.close();
                } catch (IOException e11) {
                    e = e11;
                    objectOutputStream2 = objectOutputStream;
                    WMLogUtil.e(e.getMessage());
                    if (objectOutputStream2 != null) {
                        objectOutputStream2.close();
                    }
                } catch (Throwable th2) {
                    th = th2;
                    objectOutputStream2 = objectOutputStream;
                    if (objectOutputStream2 != null) {
                        try {
                            objectOutputStream2.close();
                        } catch (IOException e12) {
                            WMLogUtil.e(e12.getMessage());
                        }
                    }
                    throw th;
                }
            } catch (IOException e13) {
                WMLogUtil.e(e13.getMessage());
            }
        }
    }

    public void a(SdkConfig sdkConfig) {
        Common common;
        if (sdkConfig == null || (common = sdkConfig.common_config) == null) {
            return;
        }
        this.f30715h = sdkConfig;
        this.f30714g = common.configRefresh.intValue() * 1000;
        a aVar = this.f30717j;
        if (aVar != null) {
            aVar.a();
        }
        Config.sharedInstance().update(f30708b, x(), w(), u(), i(), p(), l(), m());
        TrackManager.getInstance().setRetryExpiredTime(n());
        TrackManager.getInstance().setRetryInterval(o());
    }

    public long a(String str) {
        int i10 = 45;
        try {
            i10 = com.windmill.sdk.c.i.a(ClientMetadata.getInstance().getContext()).getInt(str, 45);
        } catch (Exception e10) {
            e10.printStackTrace();
        }
        return i10 * 1000;
    }

    public int b(String str) {
        try {
            return com.windmill.sdk.c.i.a(ClientMetadata.getInstance().getContext()).getInt(str, 5);
        } catch (Exception e10) {
            e10.printStackTrace();
            return 5;
        }
    }
}