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

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


package com.excelliance.kxqp.manager;

import a.q;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import com.excelliance.kxqp.api.ApiManager;
import com.excelliance.kxqp.bean.KcpLibSaveInfo;
import com.excelliance.kxqp.bean.ReponseKcpInfo;
import com.excelliance.kxqp.gs.appstore.model.ResponseData;
import com.excelliance.kxqp.gs.multi.down.model.DownBean;
import com.excelliance.kxqp.gs.thpool.tp;
import com.excelliance.kxqp.gs.util.an;
import com.excelliance.kxqp.gs.util.az;
import com.excelliance.kxqp.gs.util.bn;
import com.excelliance.kxqp.gs.util.by;
import java.io.File;
import java.util.ArrayList;
import org.json.JSONException;
import org.json.JSONObject;

public class e {

    private static volatile e f12540a;

    private volatile boolean f12541b;

    private e() {
    }

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

    public void a(final Context context) {
        if (this.f12541b) {
            return;
        }
        this.f12541b = true;
        tp.f(new Runnable() {
            @Override
            public void run() {
                com.excelliance.kxqp.api.c cVar = new com.excelliance.kxqp.api.c(context);
                cVar.a(ApiManager.getInstance().a(context, 15000L, 15000L, "https://gapi.ourplay.com.cn/").i(new q.a().a("kcpFlag", "1").a()));
                ResponseData b2 = cVar.b();
                az.d("CheckKcpToDownloadManager", "startCheckKcp responseData:" + b2);
                if (b2 != null && b2.data != 0) {
                    ReponseKcpInfo reponseKcpInfo = (ReponseKcpInfo) b2.data;
                    az.d("CheckKcpToDownloadManager", "startCheckKcp/start reponseKcpInfo: " + reponseKcpInfo);
                    DownBean downBean = new DownBean();
                    downBean.name = reponseKcpInfo.name;
                    downBean.md5 = reponseKcpInfo.md5;
                    downBean.versionCode = reponseKcpInfo.versionCode;
                    downBean.size = reponseKcpInfo.size;
                    downBean.downloadUrl = reponseKcpInfo.downloadUrl;
                    downBean.packageName = reponseKcpInfo.packageName;
                    downBean.isZip = reponseKcpInfo.isZip;
                    downBean.threadNum = 1;
                    downBean.type = 8;
                    downBean.filePath = bn.a(context, downBean.isZip);
                    downBean.startPos = new long[]{0};
                    downBean.endPos = new long[]{downBean.size - 1};
                    if (downBean.versionCode > e.b(context)) {
                        az.d("CheckKcpToDownloadManager", "startCheckKcp/start downBean: " + downBean);
                        ArrayList arrayList = new ArrayList();
                        arrayList.add(downBean);
                        com.excelliance.kxqp.gs.multi.down.a.a(context).a(arrayList);
                    }
                }
                e.this.f12541b = false;
            }
        });
    }

    public static int b(Context context) {
        int i;
        String b2 = by.a(context, "feature_all").b("sp_key_kcp_lib_current_info", "");
        az.d("CheckKcpToDownloadManager", "getCurrentKcpLibVersion  kcpCurrentInfo:" + b2);
        if (TextUtils.isEmpty(b2)) {
            return 0;
        }
        try {
            i = new JSONObject(b2).optInt("kcp_ver");
        } catch (JSONException e) {
            e.printStackTrace();
            i = 0;
        }
        az.d("CheckKcpToDownloadManager", "getCurrentKcpLibVersion  ver:" + i);
        return i;
    }

    public static boolean c(Context context) {
        boolean z;
        String b2 = by.a(context, "feature_all").b("sp_key_kcp_lib_current_info", "");
        Log.d("CheckKcpToDownloadManager", "getCurrentKcpLibEnable  kcpCurrentInfo:" + b2);
        if (TextUtils.isEmpty(b2)) {
            return false;
        }
        try {
            z = new JSONObject(b2).optBoolean("kcp_enable");
        } catch (JSONException e) {
            e.printStackTrace();
            z = false;
        }
        Log.d("CheckKcpToDownloadManager", "getCurrentKcpLibEnable  kcpCurrentInfo:" + b2 + " enable:" + z);
        return z;
    }

    public static void a(Context context, boolean z) {
        JSONObject jSONObject;
        String b2 = by.a(context, "feature_all").b("sp_key_kcp_lib_current_info", "");
        Log.d("CheckKcpToDownloadManager", "getCurrentKcpLibEnable  fixedConfig:" + b2 + " kcpEnable:" + z);
        try {
            new JSONObject();
            if (TextUtils.isEmpty(b2)) {
                jSONObject = new JSONObject();
                jSONObject.put("kcp_enable", z);
            } else {
                JSONObject jSONObject2 = new JSONObject(b2);
                jSONObject2.put("kcp_enable", z);
                jSONObject = jSONObject2;
            }
            Log.d("CheckKcpToDownloadManager", "putKcpInfo  jsonObject:" + jSONObject.toString());
            by.a(context, "feature_all").a("sp_key_kcp_lib_current_info", jSONObject.toString());
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public static void a(Context context, KcpLibSaveInfo kcpLibSaveInfo) {
        JSONObject jSONObject;
        az.d("CheckKcpToDownloadManager", "putKcpInfo kcpLibSaveInfo:" + kcpLibSaveInfo);
        String b2 = by.a(context, "feature_all").b("sp_key_kcp_lib_current_info", "");
        try {
            new JSONObject();
            if (TextUtils.isEmpty(b2)) {
                jSONObject = new JSONObject();
                jSONObject.put("kcp_md5", kcpLibSaveInfo.md5);
                jSONObject.put("kcp_ver", kcpLibSaveInfo.ver);
                jSONObject.put("kcp_enable", kcpLibSaveInfo.currentKcpEnable);
            } else {
                JSONObject jSONObject2 = new JSONObject(b2);
                jSONObject2.put("kcp_md5", kcpLibSaveInfo.md5);
                jSONObject2.put("kcp_ver", kcpLibSaveInfo.ver);
                jSONObject2.put("kcp_enable", kcpLibSaveInfo.currentKcpEnable);
                jSONObject = jSONObject2;
            }
            az.d("CheckKcpToDownloadManager", "putKcpInfo  jsonObject:" + jSONObject.toString());
            by.a(context, "feature_all").a("sp_key_kcp_lib_current_info", jSONObject.toString());
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public static void a(Context context, DownBean downBean) {
        az.d("CheckKcpToDownloadManager", "saveKcp downBean:" + downBean);
        String e = bn.e(context);
        az.d("CheckKcpToDownloadManager", "saveKcp destName:" + e);
        File file = new File(downBean.filePath);
        if (file.exists()) {
            try {
                if (downBean.isZip) {
                    String parent = file.getParent();
                    File file2 = new File(parent + "/libkcptun_client.so");
                    az.d("CheckKcpToDownloadManager", "saveKcp unzipDir:" + parent + " unzipFile:" + file2.getAbsolutePath());
                    try {
                        if (file2.exists()) {
                            file2.delete();
                        }
                        com.excean.a.d.a(file.getAbsolutePath(), parent);
                        an.c(file.getAbsolutePath());
                        file = file2;
                    } catch (Exception e2) {
                        e2.printStackTrace();
                        az.e("CheckKcpToDownloadManager", "saveKcp/unzip fial e:" + e2.toString());
                        return;
                    }
                }
                a(context, false);
                File file3 = new File(e);
                if (file3.exists()) {
                    file3.delete();
                }
                file.renameTo(new File(e));
                an.c(file.getAbsolutePath());
                new File(e).setExecutable(true, false);
                KcpLibSaveInfo kcpLibSaveInfo = new KcpLibSaveInfo();
                kcpLibSaveInfo.md5 = downBean.md5;
                kcpLibSaveInfo.ver = downBean.versionCode;
                kcpLibSaveInfo.currentKcpEnable = true;
                a(context, kcpLibSaveInfo);
            } catch (Exception e3) {
                e3.printStackTrace();
                az.d("CheckKcpToDownloadManager", "saveKcp fail e:" + e3.getMessage() + "downBean:" + downBean);
            }
        }
    }
}