Snaptube v4.40.0.4401610版本的 MD5 值为:ca2b95dcff63007195db02a6c93091b9

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


package com.duapps.ad.internal.a;

import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.SystemClock;
import android.util.Base64;
import com.duapps.ad.base.g;
import com.duapps.ad.base.l;
import com.duapps.ad.base.o;
import com.duapps.ad.base.s;
import com.duapps.ad.base.v;
import com.mobvista.msdk.setting.net.SettingConst;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import net.pubnative.library.request.PubnativeRequest;
import org.apache.http.NameValuePair;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class d extends Handler {
    private static final String b = d.class.getSimpleName();
    private static String c = "http://api.mobula.sdk.duapps.com/adunion/slot/getSrcPrio?";
    private Context a;

    public d(Context context) {
        this.a = context;
        d();
    }

    @Override
    public void handleMessage(Message message) {
        int i = message.what;
        if (5 == i) {
            removeMessages(5);
            a aVar = new a(this.a);
            if (Looper.getMainLooper() == Looper.myLooper()) {
                v.a().a(aVar);
            } else {
                post(aVar);
            }
            sendEmptyMessageDelayed(5, SettingConst.TCCT_DEFAULT_TIME);
        } else if (7 == i) {
            removeMessages(7);
            long r = l.r(this.a);
            if (r > 0) {
                e.a(this.a).a((String) null);
                sendEmptyMessageDelayed(7, r);
            }
        }
        super.handleMessage(message);
    }

    private void d() {
        if (l.w(this.a) == 0) {
            l.c(this.a, SystemClock.elapsedRealtime());
        }
    }

    public void a() {
        if (com.duapps.ad.internal.utils.d.a(this.a)) {
            long currentTimeMillis = System.currentTimeMillis() - l.d(this.a);
            if (currentTimeMillis < 0) {
                l.c(this.a);
                return;
            }
            sendEmptyMessageDelayed(5, currentTimeMillis <= SettingConst.TCCT_DEFAULT_TIME ? SettingConst.TCCT_DEFAULT_TIME - currentTimeMillis : 0L);
            sendEmptyMessage(7);
        }
    }

    public static void a(Context context, JSONObject jSONObject) {
        String str;
        long j;
        l.k(context, jSONObject.has("start_pkg_time") ? jSONObject.optInt("start_pkg_time") * 1000 : -1);
        l.e(context, jSONObject.optInt("isPkgT") > 0);
        int i = jSONObject.getInt("logPriority");
        l.c(context, i);
        f.a(context, i);
        l.f(context, jSONObject.has("dInstall") ? jSONObject.optInt("dInstall") > 0 : true);
        l.g(context, jSONObject.has("isPT") ? jSONObject.optInt("isPT") > 0 : true);
        g.c("TEST", "getSrc logPriority :" + i);
        String optString = jSONObject.optString("imId");
        try {
            g.c("TEST", "from server Inmobi ID = " + optString);
            str = new String(com.duapps.ad.base.a.a("8a1n9d0i3c1y0c2f", "8a1n9d0i3c1y0c2f", Base64.decode(optString.getBytes(), 0)));
            try {
                g.c("TEST", "AES Inmobi ID = " + str);
            } catch (Exception e) {
            }
        } catch (Exception e2) {
            str = optString;
        }
        l.b(context, str);
        g.c("TEST", "getSrc Inmobi ID = " + str);
        long optLong = jSONObject.optLong("tcppCacheTime", 0L);
        if (optLong > 0) {
            optLong = optLong * 60 * 1000;
        }
        l.b(context, optLong);
        if (jSONObject.has("tcppPullTime")) {
            int i2 = jSONObject.getInt("tcppPullTime");
            g.c(b, "tcppPullTime  = " + i2);
            if (i2 == 0 || i2 >= 30) {
                l.h(context, i2);
            }
        }
        int optInt = jSONObject.optInt("fbct", 0);
        g.c("StrategyPuller", "fbct  = " + optInt);
        if (optInt > 0) {
            l.i(context, optInt);
        }
        g.c("TEST", "getSrcPrio --> tcppCacheTime : " + optLong);
        boolean z = jSONObject.optInt("isAllowC", 1) > 0;
        boolean z2 = jSONObject.optInt("isAllowT", 1) > 0;
        boolean z3 = jSONObject.optInt("isAllowS", 1) > 0;
        long optLong2 = jSONObject.optLong("nuInterval", 0L);
        if (optLong2 <= 0) {
            j = 14400000;
        } else {
            j = optLong2 * 60 * 1000;
        }
        l.a(context, z);
        l.b(context, z2);
        l.c(context, z3);
        l.d(context, j);
        JSONArray optJSONArray = jSONObject.optJSONArray("priorityBrowsers");
        if (optJSONArray != null && optJSONArray.length() > 0) {
            g.c("StrategyPuller", "browserArray : " + optJSONArray.toString());
            l.c(context, optJSONArray.toString());
        }
        l.d(context, jSONObject.optString("pk"));
        String optString2 = jSONObject.optString("location");
        g.c("StrategyPuller", "location:" + optString2);
        l.e(context, optString2);
        boolean z4 = jSONObject.optInt("isSus", 1) > 0;
        g.c("StrategyPuller", "isSus:" + z4);
        l.d(context, z4);
        String optString3 = jSONObject.optString("exg");
        g.c("StrategyPuller", "exg:" + optString3);
        l.f(context, optString3);
        a(jSONObject.optString("tps", "1000"), context);
        JSONObject optJSONObject = jSONObject.optJSONObject("pInfo");
        if (optJSONObject != null) {
            int optInt2 = optJSONObject.optInt("implimit");
            if (optInt2 < 0) {
                optInt2 = 0;
            }
            l.l(context, optInt2);
            l.l(context, optJSONObject.optInt("itwdp", 1) > 0);
        }
    }

    private static void a(String str, Context context) {
        if (str.length() < 4) {
            str = "1000";
        }
        l.h(context, str.charAt(0) == '1');
        l.i(context, str.charAt(1) == '1');
        l.j(context, str.charAt(2) == '1');
        l.k(context, str.charAt(3) == '1');
    }

    public static class a implements Runnable {
        private Context a;

        public a(Context context) {
            this.a = context;
        }

        public void a(JSONObject jSONObject) {
            JSONObject jSONObject2;
            try {
                String f = com.duapps.ad.internal.utils.d.f(jSONObject.getString("datas"));
                jSONObject2 = new JSONObject(f);
                g.c("decode", "strategy decode succ:--> " + f);
            } catch (Exception e) {
                jSONObject2 = jSONObject.getJSONObject("datas");
                g.c("decode", "strategy decode fail" + jSONObject.toString());
            }
            d.a(this.a, jSONObject2);
            JSONArray jSONArray = jSONObject2.getJSONArray("list");
            for (int i = 0; i < jSONArray.length(); i++) {
                JSONObject optJSONObject = jSONArray.optJSONObject(i);
                if (optJSONObject != null) {
                    int optInt = optJSONObject.optInt("sid");
                    String jSONObject3 = optJSONObject.toString();
                    l.a(this.a, optInt, jSONObject3);
                    if (o.a(this.a).f(optInt)) {
                        f.a(this.a, optInt, jSONObject3);
                    }
                }
            }
            int optInt2 = jSONObject2.optInt("tcppTctp");
            l.e(this.a, optInt2);
            g.c("TEST", "tcppTctp = " + optInt2);
            l.c(this.a);
        }

        @Override
        public void run() {
            final long elapsedRealtime = SystemClock.elapsedRealtime();
            try {
                List<NameValuePair> a = com.duapps.ad.base.f.a(this.a, o.b(this.a), true);
                HashSet<Integer> a2 = o.a(this.a).a();
                StringBuilder sb = new StringBuilder();
                Iterator<Integer> it = a2.iterator();
                while (it.hasNext()) {
                    sb.append(it.next());
                    sb.append(",");
                }
                String sb2 = sb.toString();
                if (sb2.length() > 1) {
                    sb2 = sb2.substring(0, sb2.length() - 1);
                }
                a.add(new BasicNameValuePair("sid", sb2));
                a.add(new BasicNameValuePair("res", "1080*460,244*244,170*170,108*108"));
                URL url = new URL(d.c + URLEncodedUtils.format(a, "UTF-8"));
                g.c(PubnativeRequest.Parameters.TEST, "get src priority url: " + url);
                s.a(url, new s.b() {
                    @Override
                    public void a(int i, s.a aVar) {
                        l.a(a.this.a, aVar.c);
                        JSONObject jSONObject = aVar.a;
                        if (jSONObject == null) {
                            g.c(d.b, "getSrc code :" + i + " ,\n responseJson is null!");
                            return;
                        }
                        g.c(d.b, "getSrc code :" + i + " ,\n response: " + jSONObject.toString());
                        if (200 == i && jSONObject != null) {
                            try {
                                a.this.a(jSONObject);
                            } catch (JSONException e) {
                                com.duapps.ad.stats.b.a(a.this.a, -101, SystemClock.elapsedRealtime() - elapsedRealtime);
                                return;
                            }
                        } else if (304 == i) {
                            return;
                        }
                        com.duapps.ad.stats.b.a(a.this.a, i, SystemClock.elapsedRealtime() - elapsedRealtime);
                    }

                    @Override
                    public void a(int i, String str) {
                        l.c(a.this.a);
                        com.duapps.ad.stats.b.a(a.this.a, i, SystemClock.elapsedRealtime() - elapsedRealtime);
                    }
                }, l.e(this.a));
            } catch (MalformedURLException e) {
                com.duapps.ad.stats.b.a(this.a, -102, SystemClock.elapsedRealtime() - elapsedRealtime);
            }
            e.a(this.a).a((String) null);
        }
    }
}