OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046

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


package com.excelliance.staticslio.h;

import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import com.excelliance.staticslio.StatisticsManager;
import com.excelliance.staticslio.i.i;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class a extends d {

    public static String f15333a = "http://10.0.0.95:8007/multiadctrol.php";

    public static String f15334b = "http://statis.multiopen.cn/multiadctrol.php";
    private InterfaceC0609a e;
    private Context g;
    private int f = -1;
    public final int c = 3;
    private boolean h = false;
    private String i = "";
    private String j = "";
    public boolean d = false;

    public interface InterfaceC0609a {
        void a();

        void a(Map<String, com.excelliance.staticslio.a.a> map, boolean z);
    }

    public a(Context context, long j, long j2) {
        a(context, "ctrl_adv_info_task");
        this.g = context;
        b(j2);
        a(System.currentTimeMillis() + j);
        if (i.a()) {
            i.b("AdvCtrlInfoTask", "Adv ctrlInfo task constructed!:" + b());
        }
    }

    public void a(InterfaceC0609a interfaceC0609a) {
        this.e = interfaceC0609a;
    }

    @Override
    public void a() {
        if (i.a()) {
            i.b("AdvCtrlInfoTask", "Execute advCtrlInfoTask!");
        }
        new Thread("ctrl_adv_info_thread") {
            @Override
            public void run() {
                if (a.this.e != null) {
                    a.this.e.a();
                }
                Map<String, com.excelliance.staticslio.a.a> map = null;
                if (a.this.d) {
                    String h = a.this.h();
                    i.b("AdvCtrlInfoTask", "advCtrlInfo:" + h);
                    if (i.b(h)) {
                        a.this.h = false;
                    } else {
                        a.this.h = true;
                        if (i.a()) {
                            i.b("AdvCtrlInfoTask", "httpConnectedOK  advCtrlInfo:" + h);
                        }
                        map = a.a(h);
                    }
                    a.this.e.a(map, a.this.h);
                    return;
                }
                if (i.a()) {
                    i.b("AdvCtrlInfoTask", "Get ctrl info network is not ok and quit");
                }
                a.this.h = false;
                a.this.e.a(null, a.this.h);
            }
        }.start();
    }

    public static Map<String, com.excelliance.staticslio.a.a> a(String str) {
        HashMap hashMap = new HashMap();
        try {
            JSONArray jSONArray = new JSONObject(str).getJSONArray("ctrl_info");
            if (StatisticsManager.sDebugMode) {
                i.b("AdvCtrlInfoTask", "adv simulated switch info:" + jSONArray.toString());
            } else {
                i.b("AdvCtrlInfoTask", "adv switch info:" + jSONArray.toString());
            }
            for (int i = 0; i < jSONArray.length(); i++) {
                JSONObject jSONObject = (JSONObject) jSONArray.opt(i);
                long j = jSONObject.getLong("valid_time") * 1000;
                String string = jSONObject.getString("stat_id");
                String string2 = jSONObject.getString("upload_cycle");
                String string3 = jSONObject.getString("behav");
                String string4 = jSONObject.getString("appid");
                if (Integer.parseInt(string) >= 2000) {
                    string4 = "0";
                }
                if (!TextUtils.isEmpty(string) && c(j)) {
                    long longValue = Long.valueOf(string2).longValue();
                    long j2 = longValue < 24 ? 30000L : longValue * 1000;
                    if (!i.b(string)) {
                        a(hashMap, new com.excelliance.staticslio.a.a(Integer.valueOf(string4).intValue(), Integer.valueOf(string).intValue(), Integer.valueOf(string3).intValue(), j2, j));
                    }
                }
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return hashMap;
    }

    private static boolean c(long j) {
        return j == 0 || j > System.currentTimeMillis();
    }

    private static void a(Map<String, com.excelliance.staticslio.a.a> map, com.excelliance.staticslio.a.a aVar) {
        map.get(String.valueOf(aVar.d() + StatisticsManager.COMMA + aVar.c()));
        if (aVar != null && aVar.a() != 0 && aVar.a() < System.currentTimeMillis()) {
            if (i.a()) {
                i.b("AdvCtrlInfoTask", "StatId:" + aVar.d() + ", expired validtime:" + aVar.a() + ", AppId:" + aVar.c());
                return;
            }
            return;
        }
        map.put(String.valueOf(aVar.d() + StatisticsManager.COMMA + aVar.c()), aVar);
    }

    public String h() {
        String str;
        HttpURLConnection httpURLConnection;
        if (StatisticsManager.sDebugMode) {
            str = f15333a;
            if (i.a()) {
                i.b("AdvCtrlInfoTask", "debug build:" + f15333a);
            }
        } else {
            str = f15334b;
            if (i.a()) {
                i.b("AdvCtrlInfoTask", "release build:" + f15334b);
            }
        }
        String str2 = null;
        StringBuilder sb = new StringBuilder();
        try {
            URL url = new URL(str + "?ver=3&type=0");
            this.i = url.toURI().toString();
            httpURLConnection = (HttpURLConnection) url.openConnection();
            httpURLConnection.setDoOutput(true);
            httpURLConnection.setDoInput(true);
            httpURLConnection.setUseCaches(false);
            httpURLConnection.setRequestProperty("Content-type", "application/json");
            httpURLConnection.setRequestMethod("POST");
            httpURLConnection.setReadTimeout(60000);
            httpURLConnection.setConnectTimeout(60000);
            httpURLConnection.connect();
            this.j = i();
            OutputStream outputStream = httpURLConnection.getOutputStream();
            outputStream.write(this.j.getBytes());
            outputStream.flush();
            outputStream.close();
        } catch (Exception e) {
            e = e;
        }
        if (httpURLConnection.getResponseCode() == 200) {
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream()));
            while (true) {
                String readLine = bufferedReader.readLine();
                if (readLine != null) {
                    sb.append(readLine);
                } else {
                    String sb2 = sb.toString();
                    try {
                        Log.d("AdvCtrlInfoTask", "result = " + sb2);
                        return sb2;
                    } catch (Exception e2) {
                        str2 = sb2;
                        e = e2;
                        e.printStackTrace();
                        Log.d("AdvCtrlInfoTask", "exception = " + e.getMessage());
                        return str2;
                    }
                }
            }
        } else {
            Log.d("AdvCtrlInfoTask", "getResponseCode = " + httpURLConnection.getResponseCode());
            return str2;
        }
    }

    private String i() {
        JSONArray jSONArray = new JSONArray();
        JSONObject jSONObject = new JSONObject();
        try {
            if (StatisticsManager.sAndroidId != null) {
                jSONObject.put("android_id", com.excelliance.staticslio.i.a.a(StatisticsManager.sAndroidId).getBytes());
            } else {
                jSONObject.put("android_id", StatisticsManager.sAndroidId);
            }
            jSONObject.put("isnew", StatisticsManager.isNewCtrol);
            jSONObject.put("m_ch", i.a(this.g, "MainChId"));
            jSONObject.put("s_ch", i.a(this.g, "SubChId"));
            jSONObject.put("ver_c", i.a(this.g, "VersionCode"));
            jSONArray.put(jSONObject);
        } catch (Exception e) {
            if (i.a()) {
                i.b("AdvCtrlInfoTask", "getCtrInfo error:" + e);
            }
        }
        return jSONArray.toString();
    }
}