OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046
以下内容为反编译后的 a.java 源代码,内容仅作参考
package com.excelliance.kxqp.bitmap;
import android.content.Context;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.lifecycle.MutableLiveData;
import com.android.spush.util.WebActionRouter;
import com.excelliance.kxqp.GameUtil;
import com.excelliance.kxqp.SmtServService;
import com.excelliance.kxqp.bean.AppExtraBean;
import com.excelliance.kxqp.bitmap.bean.NativeVpnInfo;
import com.excelliance.kxqp.bitmap.bean.RankingItem;
import com.excelliance.kxqp.bitmap.bean.ResponseData;
import com.excelliance.kxqp.gs.bean.PermissionBean;
import com.excelliance.kxqp.gs.game.GameAttributesHelper;
import com.excelliance.kxqp.gs.m.a.c;
import com.excelliance.kxqp.gs.m.a.f;
import com.excelliance.kxqp.gs.service.ProxyDelayService;
import com.excelliance.kxqp.gs.thpool.tp;
import com.excelliance.kxqp.gs.util.as;
import com.excelliance.kxqp.gs.util.au;
import com.excelliance.kxqp.gs.util.ay;
import com.excelliance.kxqp.gs.util.az;
import com.excelliance.kxqp.gs.util.bd;
import com.excelliance.kxqp.gs.util.bm;
import com.excelliance.kxqp.gs.util.bs;
import com.excelliance.kxqp.gs.util.by;
import com.excelliance.kxqp.gs.util.cd;
import com.excelliance.kxqp.gs.util.cn;
import com.excelliance.kxqp.gs.util.s;
import com.excelliance.kxqp.gs.util.w;
import com.excelliance.kxqp.platforms.ExcellianceAppInfo;
import com.excelliance.kxqp.ui.InitialData;
import com.excelliance.kxqp.ui.detail.category.CategoryListActivity;
import com.excelliance.kxqp.util.d.b;
import com.excelliance.kxqp.util.master.e;
import com.tencent.open.SocialConstants;
import com.umeng.analytics.pro.am;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class a {
public static AbstractC0108a<String, JSONObject> f2685a = new AbstractC0108a<String, JSONObject>(0) {
@Override
void a() {
Log.d("RequestBean", "mUpdateApkMap " + a.f2685a.toString());
a.f2686b.postValue(a.f2685a);
}
};
public static MutableLiveData<HashMap<String, JSONObject>> f2686b = new MutableLiveData<>();
public static boolean a(int i, int i2, int i3, int i4) {
return i > i3 || i2 > i4;
}
public static JSONObject a(Context context) {
JSONObject jSONObject = new JSONObject();
GameUtil intance = GameUtil.getIntance();
try {
jSONObject.put("vc", GameUtil.g(context));
jSONObject.put(RankingItem.KEY_VER_NAME, GameUtil.h(context));
jSONObject.put("chid", GameUtil.d(context));
by a2 = by.a(context, "sp_customization");
jSONObject.put("customizationAd", a2.b(am.aw, true).booleanValue() ? 1 : 0);
jSONObject.put("customizationGame", a2.b("game", true).booleanValue() ? 1 : 0);
jSONObject.put("customizationPush", a2.b("push", true).booleanValue() ? 1 : 0);
jSONObject.put("subchid", GameUtil.e(context));
String v = intance.v(context);
if (v == null) {
v = "";
}
jSONObject.put("imei", v);
String w = intance.w(context);
if (w == null) {
w = "";
}
jSONObject.put("imsi", w);
jSONObject.put(WebActionRouter.KEY_PKG, context.getPackageName());
jSONObject.put("api", Build.VERSION.SDK_INT);
jSONObject.put("release", Build.VERSION.RELEASE);
jSONObject.put("brand", a(Build.BRAND));
jSONObject.put("manufacturer", a(Build.MANUFACTURER));
jSONObject.put("model", a(Build.MODEL));
jSONObject.put("product", Build.PRODUCT);
jSONObject.put("abi", Build.CPU_ABI);
} catch (JSONException e) {
e.printStackTrace();
}
return jSONObject;
}
public static String a(Context context, String str, String str2) {
JSONObject i = cn.i(context);
try {
i.put("phoneNumber", str);
i.put("gameId", 0);
i.put(WebActionRouter.KEY_PKG, str2);
az.d("RequestBean", "params.toString():" + i.toString());
az.d("RequestBean", "url:https://sdk.ourplay.com.cn/assistantPoint.php");
String c = bd.c("https://sdk.ourplay.com.cn/assistantPoint.php", i.toString());
az.d("RequestBean", c);
return new JSONObject(c).optString("message");
} catch (Exception e) {
e.printStackTrace();
az.d("RequestBean", "sendSubscribe:" + e.getMessage());
return w.e(context, "subscribe_failure");
}
}
public static abstract class AbstractC0108a<K, V> extends LinkedHashMap<K, V> {
abstract void a();
public AbstractC0108a(int i) {
super(i);
}
@Override
@Nullable
public V put(K k, V v) {
a();
return (V) super.put(k, v);
}
@Override
public void putAll(@NonNull Map<? extends K, ? extends V> map) {
super.putAll(map);
a();
}
@Override
@Nullable
public V remove(@Nullable Object obj) {
a();
return (V) super.remove(obj);
}
}
public static void a(Map<String, f> map, ArrayList<ExcellianceAppInfo> arrayList) {
HashMap hashMap = new HashMap();
Iterator<ExcellianceAppInfo> it = arrayList.iterator();
while (it.hasNext()) {
ExcellianceAppInfo next = it.next();
hashMap.put(next.getAppPackageName(), next);
}
Iterator<Map.Entry<String, f>> it2 = map.entrySet().iterator();
while (it2.hasNext()) {
Map.Entry<String, f> next2 = it2.next();
if (!hashMap.containsKey(next2.getKey())) {
az.d("RequestBean", "clearNoDownLoadedYapp: remove no contain pkg:" + next2.getKey());
it2.remove();
}
}
}
public static void b(final Context context) {
tp.f(new Runnable() {
@Override
public void run() {
if (NativeVpnInfo.hasInstalled(context)) {
Log.d("RequestBean", "run: 已安装加速器 ");
String b2 = as.b();
Log.d("RequestBean", "requestUpdateNativeVpnData: response = " + b2);
if (NativeVpnInfo.save(context, b2)) {
return;
}
Log.d("RequestBean", "run: 存储失败");
}
}
});
}
public static String c(Context context) {
int i;
int i2;
Context context2 = context;
b(context);
JSONArray jSONArray = new JSONArray();
ArrayList<ExcellianceAppInfo> a2 = InitialData.a(context).a();
as.b(a2);
StringBuffer stringBuffer = new StringBuffer();
JSONArray jSONArray2 = new JSONArray();
if (a2 != null) {
au a3 = au.a();
GameAttributesHelper.getInstance().a(context2);
Iterator<ExcellianceAppInfo> it = a2.iterator();
int i3 = 0;
while (it.hasNext()) {
ExcellianceAppInfo next = it.next();
boolean p = a3.p(next.getAppPackageName(), context2);
boolean a4 = bm.a(next.getAppPackageName());
if ((bs.a(next.getAppPackageName()) == -1 && (TextUtils.equals(next.getGameType(), "1") || TextUtils.equals(next.getGameType(), "5") || TextUtils.equals(next.getGameType(), "7") || next.loseObb() || a4)) || p) {
Log.d("RequestBean", "requestUpdateData: " + next);
if (p || !e.a(context2, next.getAppPackageName(), next.getUid()) || e.a(context)) {
if (!e.a(context2, next.getAppPackageName(), next.getUid()) || !e.a(context) || next.haveApkInstalled()) {
if (com.excelliance.kxqp.util.master.a.f15049a.containsKey(next.getAppPackageName())) {
Log.d("RequestBean", "requestUpdateData: b64 contain" + next);
} else {
StringBuilder sb = new StringBuilder();
sb.append(i3 > 0 ? "||" : "");
sb.append(next.getAppPackageName());
stringBuffer.append(sb.toString());
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put(WebActionRouter.KEY_PKG, next.getAppPackageName());
jSONObject.put(RankingItem.KEY_VER, next.getVersionCode());
AppExtraBean d = e.d(context2, next.getAppPackageName(), next.getUid());
int cpu = d.getCpu();
if (cpu == -1) {
cpu = 0;
}
jSONObject.put("cpu", cpu);
jSONObject.put("md5", d.getBaseApkMd5(context2));
jSONObject.put("pos", d.getInstallPosition());
} catch (JSONException e) {
e.printStackTrace();
}
jSONArray2.put(jSONObject);
i3++;
}
}
}
}
}
String stringBuffer2 = stringBuffer.toString();
if (!TextUtils.isEmpty(stringBuffer2)) {
az.d("RequestBean", "requestUpdateData: " + stringBuffer2);
az.d("RequestBean", "requestUpdateData: pkgInfos:" + jSONArray2.toString());
String b2 = b.f15028b ? as.b(context2, stringBuffer2, jSONArray2, true) : as.a(context2, stringBuffer2, jSONArray2, true);
try {
ArrayList<ExcellianceAppInfo> a5 = InitialData.a(context).a();
boolean S = com.excelliance.kxqp.gs.util.b.S(context);
HashMap hashMap = new HashMap();
if (S) {
ResponseData.saveUpdateData(context2, new JSONArray(a(context2, a5)));
JSONArray updateData = ResponseData.getUpdateData(context);
if (updateData != null) {
for (int i4 = 0; i4 < updateData.length(); i4++) {
JSONObject optJSONObject = updateData.optJSONObject(i4);
if (optJSONObject != null) {
String optString = optJSONObject.optString(WebActionRouter.KEY_PKG);
az.d("RequestBean", "add exit map pkg:" + optString + " content:" + optJSONObject.toString());
hashMap.put(optString, optJSONObject);
}
}
}
}
JSONArray b3 = ay.b(b2, a5);
az.d("RequestBean", "requestUpdateData: " + b3);
LinkedHashMap linkedHashMap = new LinkedHashMap();
if (b3 != null) {
int i5 = 0;
while (i5 < b3.length()) {
JSONObject optJSONObject2 = b3.optJSONObject(i5);
az.d("RequestBean", "requestUpdateData: " + optJSONObject2);
if (optJSONObject2 != null) {
JSONObject jSONObject2 = new JSONObject();
String optString2 = optJSONObject2.optString(WebActionRouter.KEY_PKG);
jSONObject2.put(WebActionRouter.KEY_PKG, optString2);
String optString3 = optJSONObject2.optString(RankingItem.KEY_VER);
int optInt = optJSONObject2.optInt(RankingItem.KEY_FORCEUPDATE);
az.d("RequestBean", "requestUpdateData: pkg:" + optString2);
JSONObject updateIgnoreData = ResponseData.getUpdateIgnoreData(context);
JSONObject optJSONObject3 = updateIgnoreData.optJSONObject(optString2);
if (optJSONObject3 != null) {
if (TextUtils.equals(optJSONObject3.optInt(RankingItem.KEY_VER) + "", optString3)) {
if (S) {
hashMap.remove(optString2);
}
} else if (S) {
updateIgnoreData.remove(optString2);
ResponseData.saveUpdateIgnoreData(context2, updateIgnoreData);
}
}
if (S && hashMap.containsKey(optString2) && optInt != 1 && optInt != 2) {
az.d("RequestBean", "requestUpdateData: contain pkg:" + optString2);
JSONObject jSONObject3 = (JSONObject) hashMap.get(optString2);
int optInt2 = jSONObject3.optInt("appId");
az.d("RequestBean", "requestUpdateData: appID:" + optInt2);
if (optInt2 != 0) {
az.d("RequestBean", "1 requestUpdateData: appID:" + optInt2);
String optString4 = jSONObject3.optString(RankingItem.KEY_VER);
if (optString3 != null && optString4 != null) {
try {
i = Integer.parseInt(optString4);
} catch (Exception e2) {
e = e2;
i = 0;
}
try {
i2 = Integer.parseInt(optString3);
} catch (Exception e3) {
e = e3;
e.printStackTrace();
i2 = 0;
az.d("RequestBean", "requestUpdateData: ver_by_server:" + i2 + " ver_exit:" + i);
if (i2 < i) {
}
jSONObject2.put(RankingItem.KEY_VER, optString3);
jSONObject2.put(RankingItem.KEY_SIZE, optJSONObject2.optString("length"));
jSONObject2.put("desc", "最新版本" + optJSONObject2.optString(RankingItem.KEY_VER_NAME));
jSONObject2.put(RankingItem.KEY_ADDR, optJSONObject2.optString(SocialConstants.PARAM_URL));
jSONObject2.put(RankingItem.KEY_ONLINE, optJSONObject2.optInt(RankingItem.KEY_ONLINE));
jSONObject2.put(RankingItem.KEY_FORCEUPDATE, optJSONObject2.optInt(RankingItem.KEY_FORCEUPDATE));
jSONObject2.put("md5", optJSONObject2.optString("md5"));
jSONObject2.put(AppExtraBean.KEY_AREA, optJSONObject2.opt(AppExtraBean.KEY_AREA));
if (S) {
}
jSONArray.put(jSONObject2);
linkedHashMap.put(optString2, jSONObject2);
f2685a.clear();
f2685a.putAll(linkedHashMap);
i5++;
context2 = context;
}
az.d("RequestBean", "requestUpdateData: ver_by_server:" + i2 + " ver_exit:" + i);
if (i2 < i) {
jSONArray.put(jSONObject3);
az.d("RequestBean", "1 requestUpdateData: ver_by_server:" + i2 + " ver_exit:" + i + " jsonObject:" + jSONObject3);
hashMap.remove(optString2);
}
}
}
}
jSONObject2.put(RankingItem.KEY_VER, optString3);
jSONObject2.put(RankingItem.KEY_SIZE, optJSONObject2.optString("length"));
jSONObject2.put("desc", "最新版本" + optJSONObject2.optString(RankingItem.KEY_VER_NAME));
jSONObject2.put(RankingItem.KEY_ADDR, optJSONObject2.optString(SocialConstants.PARAM_URL));
jSONObject2.put(RankingItem.KEY_ONLINE, optJSONObject2.optInt(RankingItem.KEY_ONLINE));
jSONObject2.put(RankingItem.KEY_FORCEUPDATE, optJSONObject2.optInt(RankingItem.KEY_FORCEUPDATE));
jSONObject2.put("md5", optJSONObject2.optString("md5"));
jSONObject2.put(AppExtraBean.KEY_AREA, optJSONObject2.opt(AppExtraBean.KEY_AREA));
if (S) {
hashMap.remove(optString2);
}
jSONArray.put(jSONObject2);
linkedHashMap.put(optString2, jSONObject2);
f2685a.clear();
f2685a.putAll(linkedHashMap);
}
i5++;
context2 = context;
}
if (S) {
for (Map.Entry entry : hashMap.entrySet()) {
if (((JSONObject) entry.getValue()).optInt("appId") != 0) {
az.d("RequestBean", "requestUpdateData: add other jsonObject:" + entry.getValue());
jSONArray.put(entry.getValue());
linkedHashMap.put(entry.getKey(), entry.getValue());
f2685a.clear();
f2685a.putAll(linkedHashMap);
}
}
}
}
} catch (Exception e4) {
e4.printStackTrace();
}
}
}
Log.d("RequestBean", "requestUpdateData: " + jSONArray);
return jSONArray.toString();
}
public static String a(Context context, ArrayList<ExcellianceAppInfo> arrayList) {
JSONArray updateData = ResponseData.getUpdateData(context);
HashMap hashMap = new HashMap();
HashMap hashMap2 = new HashMap();
JSONArray jSONArray = new JSONArray();
if (arrayList != null) {
if (updateData != null && updateData.length() > 0) {
for (int i = 0; i < updateData.length(); i++) {
JSONObject optJSONObject = updateData.optJSONObject(i);
int optInt = optJSONObject.optInt("appId");
String optString = optJSONObject.optString(WebActionRouter.KEY_PKG);
if (optInt != 0) {
f b2 = com.excelliance.kxqp.gs.m.d.a.a().b(context, "appId", String.valueOf(optInt));
if (b2 != null) {
hashMap.put(optString, b2);
} else {
hashMap2.put(optString, optJSONObject);
}
}
}
}
HashMap hashMap3 = new HashMap();
Iterator<ExcellianceAppInfo> it = arrayList.iterator();
while (it.hasNext()) {
ExcellianceAppInfo next = it.next();
hashMap3.put(next.getAppPackageName(), next);
}
SmtServService.a(context, hashMap);
if (updateData != null && updateData.length() > 0) {
for (int i2 = 0; i2 < updateData.length(); i2++) {
JSONObject optJSONObject2 = updateData.optJSONObject(i2);
int optInt2 = optJSONObject2.optInt("appId");
String optString2 = optJSONObject2.optString(WebActionRouter.KEY_PKG);
if (hashMap.containsKey(optString2) && optInt2 != 0) {
if (hashMap3.containsKey(optString2)) {
jSONArray.put(optJSONObject2);
}
} else if ((!hashMap2.containsKey(optString2) || optInt2 == 0) && hashMap3.containsKey(optString2) && optInt2 == 0) {
jSONArray.put(optJSONObject2);
}
}
}
}
az.d("RequestBean", "clearExitYalpData: result:" + jSONArray.toString());
return jSONArray.toString();
}
public static void a(Context context, List<ExcellianceAppInfo> list) {
GameUtil.getIntance();
if (!GameUtil.isNetworkConnected(context)) {
Log.d("RequestBean", "checkCpuInfo: network connected error");
return;
}
JSONArray jSONArray = new JSONArray();
if (list != null) {
for (ExcellianceAppInfo excellianceAppInfo : list) {
if (bs.a(excellianceAppInfo.getAppPackageName()) == -1) {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("pkgname", excellianceAppInfo.getAppPackageName());
jSONObject.put("vc", excellianceAppInfo.getVersionCode());
} catch (JSONException e) {
e.printStackTrace();
}
jSONArray.put(jSONObject);
}
}
if (jSONArray.length() > 0) {
az.d("RequestBean", "checkAppFrom: " + jSONArray);
String a2 = as.a(context, jSONArray);
try {
az.d("RequestBean", "checkAppFrom: " + a2);
JSONArray optJSONArray = new JSONObject(a2).optJSONArray("data");
az.d("RequestBean", "checkAppFrom: " + optJSONArray);
if (optJSONArray != null) {
for (int i = 0; i < optJSONArray.length(); i++) {
JSONObject optJSONObject = optJSONArray.optJSONObject(i);
az.d("RequestBean", "checkAppFrom: " + optJSONObject);
if (optJSONObject != null) {
String optString = optJSONObject.optString(WebActionRouter.KEY_PKG);
int optInt = optJSONObject.optInt("apkfrom");
int optInt2 = optJSONObject.optInt("is_white");
int optInt3 = optJSONObject.optInt("isshowload");
int optInt4 = optJSONObject.optInt("buttonStatus");
String optString2 = optJSONObject.optString("buttonText");
String optString3 = optJSONObject.optString("datafinder_game_id");
String optString4 = optJSONObject.optString("version_updatetime");
int optInt5 = optJSONObject.optInt("apk_update_version");
ExcellianceAppInfo b2 = com.excelliance.kxqp.repository.a.a(context).b(optString);
if (b2 != null && (b2.apkFrom != optInt || b2.isWhite != optInt2 || b2.downloadButtonVisible != optInt3 || TextUtils.isEmpty(b2.datafinder_game_id) || TextUtils.isEmpty(b2.appUpdateTime) || b2.serverVc == 0)) {
b2.apkFrom = optInt;
b2.isWhite = optInt2;
b2.downloadButtonVisible = optInt3;
b2.buttonStatus = optInt4;
b2.buttonText = optString2;
if (cd.a(b2.datafinder_game_id)) {
b2.datafinder_game_id = optString3;
}
if (b2.serverVc == 0) {
b2.serverVc = optInt5;
}
if (cd.a(b2.appUpdateTime)) {
b2.appUpdateTime = optString4;
}
com.excelliance.kxqp.repository.a.a(context).b(b2);
}
}
}
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
}
}
public static boolean a(Context context, String str, List<ExcellianceAppInfo> list) {
if (s.a(list)) {
return false;
}
ExcellianceAppInfo excellianceAppInfo = null;
Iterator<ExcellianceAppInfo> it = list.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
ExcellianceAppInfo next = it.next();
if (TextUtils.equals(str, next.getAppPackageName())) {
excellianceAppInfo = next;
break;
}
}
if (excellianceAppInfo == null || bs.a(excellianceAppInfo.getAppPackageName()) != -1 || (!TextUtils.equals(excellianceAppInfo.getGameType(), "1") && !TextUtils.equals(excellianceAppInfo.getGameType(), "5") && !TextUtils.equals(excellianceAppInfo.getGameType(), "7") && !excellianceAppInfo.loseObb())) {
return false;
}
Log.d("RequestBean", "isNeedCheckCpu: " + excellianceAppInfo);
return !e.a(context, excellianceAppInfo.getAppPackageName(), excellianceAppInfo.getUid()) || e.a(context);
}
public static List<PermissionBean> a(JSONArray jSONArray) {
ArrayList arrayList = new ArrayList();
if (jSONArray != null && jSONArray.length() > 0) {
for (int i = 0; i < jSONArray.length(); i++) {
JSONObject optJSONObject = jSONArray.optJSONObject(i);
if (optJSONObject != null) {
PermissionBean permissionBean = new PermissionBean();
permissionBean.key = optJSONObject.optString(CategoryListActivity.TAG_NAME);
permissionBean.name = optJSONObject.optString("name");
arrayList.add(permissionBean);
}
}
}
return arrayList;
}
public static String a(String str) {
try {
return URLEncoder.encode(str, "UTF-8").replaceAll("\\+", "%20");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return "";
}
}
public static Map<String, JSONObject> d(Context context) {
LinkedHashMap linkedHashMap = new LinkedHashMap();
ArrayList<ExcellianceAppInfo> a2 = InitialData.a(context).a();
StringBuffer stringBuffer = new StringBuffer();
if (a2 != null) {
Iterator<ExcellianceAppInfo> it = a2.iterator();
int i = 0;
while (it.hasNext()) {
ExcellianceAppInfo next = it.next();
if (as.h(context, next.getPath()) != 0 && ((bs.a(next.getAppPackageName()) == -1 && TextUtils.equals(next.getGameType(), "1")) || TextUtils.equals(next.getGameType(), "5"))) {
Log.d("RequestBean", "requestUpdateDataObb: " + next);
StringBuilder sb = new StringBuilder();
sb.append(i > 0 ? "||" : "");
sb.append(next.getAppPackageName());
sb.append("-");
sb.append(next.getVersionCode());
stringBuffer.append(sb.toString());
i++;
}
}
String stringBuffer2 = stringBuffer.toString();
if (!TextUtils.isEmpty(stringBuffer2)) {
az.d("RequestBean", "requestUpdateDataObb: " + stringBuffer2);
String r = as.r(context, stringBuffer2);
by a3 = by.a(context, "request_update_data");
if (com.excelliance.kxqp.gs.util.b.S(context)) {
String b2 = a3.b("request_obb_update_data", "");
Map hashMap = new HashMap();
if (!cd.a(b2)) {
hashMap = ay.b(b2, context);
}
Map hashMap2 = new HashMap();
if (!cd.a(r)) {
hashMap2 = ay.c(r, context);
}
String a4 = a((Map<String, JSONObject>) hashMap, (Map<String, JSONObject>) hashMap2);
if (!cd.a(a4)) {
az.d("RequestBean", "requestUpdateDataObb: obbInfoListStr" + a4);
r = a4;
}
}
a3.a("request_obb_update_data", r);
try {
az.d("RequestBean", "requestUpdateDataObb: " + r);
JSONArray a5 = ay.a(r, context);
az.d("RequestBean", "requestUpdateDataObb: " + a5);
if (a5 != null) {
for (int i2 = 0; i2 < a5.length(); i2++) {
JSONObject optJSONObject = a5.optJSONObject(i2);
az.d("RequestBean", "requestUpdateDataObb: " + optJSONObject);
if (optJSONObject != null) {
linkedHashMap.put(optJSONObject.optString(WebActionRouter.KEY_PKG), optJSONObject);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
return linkedHashMap;
}
public static String a(Map<String, JSONObject> map, Map<String, JSONObject> map2) {
if (map.size() == 0 && map2.size() == 0) {
az.d("RequestBean", "mergeYalpAndServer: 0");
} else if (map.size() == 0 && map2.size() > 0) {
az.d("RequestBean", "mergeYalpAndServer: 1");
} else {
if (map.size() > 0 && map2.size() == 0) {
String a2 = a(map);
az.d("RequestBean", "mergeYalpAndServer: 2 result:" + a2);
return a2;
}
if (map.size() > 0 && map2.size() > 0) {
String b2 = b(map, map2);
az.d("RequestBean", "mergeYalpAndServer: 3 result:" + b2);
return b2;
}
}
return null;
}
public static String b(Map<String, JSONObject> map, Map<String, JSONObject> map2) {
int i;
String str;
int i2;
int i3;
int i4;
HashMap hashMap = new HashMap();
for (Map.Entry<String, JSONObject> entry : map.entrySet()) {
az.d("RequestBean", "addYalpAndServer: add yalp key:" + entry.getKey() + " value:" + entry.getValue().toString());
hashMap.put(entry.getKey(), entry.getValue());
}
Iterator<Map.Entry<String, JSONObject>> it = map2.entrySet().iterator();
while (true) {
i = 0;
if (!it.hasNext()) {
break;
}
Map.Entry<String, JSONObject> next = it.next();
if (hashMap.containsKey(next.getKey())) {
az.d("RequestBean", "addYalpAndServer: add yalp continue key:" + next.getKey() + " value:" + next.getValue().toString());
JSONObject jSONObject = (JSONObject) hashMap.get(next.getKey());
JSONObject value = next.getValue();
JSONObject optJSONObject = jSONObject.optJSONObject("main");
JSONObject optJSONObject2 = jSONObject.optJSONObject(ExcellianceAppInfo.KEY_PATCH);
String optString = jSONObject.optString(RankingItem.KEY_VER);
JSONObject optJSONObject3 = value.optJSONObject("main");
JSONObject optJSONObject4 = value.optJSONObject(ExcellianceAppInfo.KEY_PATCH);
String optString2 = value.optString(RankingItem.KEY_VER);
int parseInt = !cd.a(optString) ? Integer.parseInt(optString) : 0;
int parseInt2 = !cd.a(optString2) ? Integer.parseInt(optString2) : 0;
if (parseInt > parseInt2) {
az.d("RequestBean", "0 addYalpAndServer: add server key:" + next.getKey() + " server value:" + next.getValue().toString() + " yalp value:" + jSONObject);
} else if (parseInt != 0 && parseInt2 != 0 && parseInt == parseInt2) {
if (optJSONObject != null) {
String optString3 = optJSONObject.optString("obbver");
if (!cd.a(optString3)) {
i2 = Integer.parseInt(optString3);
if (optJSONObject2 != null) {
String optString4 = optJSONObject2.optString("obbver");
if (!cd.a(optString4)) {
i3 = Integer.parseInt(optString4);
if (optJSONObject3 != null) {
String optString5 = optJSONObject3.optString("obbver");
if (!cd.a(optString5)) {
i4 = Integer.parseInt(optString5);
if (optJSONObject4 != null) {
String optString6 = optJSONObject4.optString("obbver");
if (!cd.a(optString6)) {
i = Integer.parseInt(optString6);
}
}
if (a(i2, i3, i4, i)) {
az.d("RequestBean", "2 addYalpAndServer: add server key:" + next.getKey() + " server value:" + next.getValue().toString() + " yalp value:" + jSONObject);
hashMap.remove(next.getKey());
hashMap.put(next.getKey(), next.getValue());
} else {
az.d("RequestBean", "1 addYalpAndServer: add server key:" + next.getKey() + " server value:" + next.getValue().toString() + " yalp value:" + jSONObject);
}
}
}
i4 = 0;
if (optJSONObject4 != null) {
}
if (a(i2, i3, i4, i)) {
}
}
}
i3 = 0;
if (optJSONObject3 != null) {
}
i4 = 0;
if (optJSONObject4 != null) {
}
if (a(i2, i3, i4, i)) {
}
}
}
i2 = 0;
if (optJSONObject2 != null) {
}
i3 = 0;
if (optJSONObject3 != null) {
}
i4 = 0;
if (optJSONObject4 != null) {
}
if (a(i2, i3, i4, i)) {
}
} else {
az.d("RequestBean", "4 addYalpAndServer: add server key:" + next.getKey() + " server value:" + next.getValue().toString() + " yalp value:" + jSONObject);
hashMap.remove(next.getKey());
hashMap.put(next.getKey(), next.getValue());
}
} else {
az.d("RequestBean", "5 addYalpAndServer: add server key:" + next.getKey() + " value:" + next.getValue().toString());
hashMap.put(next.getKey(), next.getValue());
}
}
JSONObject jSONObject2 = new JSONObject();
JSONArray jSONArray = new JSONArray();
for (Map.Entry entry2 : hashMap.entrySet()) {
try {
jSONArray.put(i, entry2.getValue());
az.d("RequestBean", "addYalpAndServer: add content:" + ((JSONObject) entry2.getValue()).toString());
i++;
} catch (JSONException e) {
e.printStackTrace();
az.d("RequestBean", "addYalpAndServer: json fail:" + e);
}
}
try {
if (jSONArray.length() <= 0) {
return null;
}
jSONObject2.put("pkgs", jSONArray);
str = jSONObject2.toString();
try {
az.d("RequestBean", "addYalpAndServer: result:" + str);
return str;
} catch (JSONException e2) {
e = e2;
e.printStackTrace();
az.d("RequestBean", "addYalpAndServer: add json fail:" + e);
return str;
}
} catch (JSONException e3) {
e = e3;
str = null;
}
}
public static String a(Map<String, JSONObject> map) {
String str = null;
try {
JSONObject jSONObject = new JSONObject();
JSONArray jSONArray = new JSONArray();
Iterator<Map.Entry<String, JSONObject>> it = map.entrySet().iterator();
int i = 0;
while (it.hasNext()) {
jSONArray.put(i, it.next().getValue());
i++;
}
jSONObject.put("pkgs", jSONArray);
String jSONArray2 = jSONArray.toString();
try {
az.d("RequestBean", "mapToObbInfo: result:" + jSONArray2);
return jSONArray2;
} catch (JSONException e) {
str = jSONArray2;
e = e;
e.printStackTrace();
return str;
}
} catch (JSONException e2) {
e = e2;
}
}
public static Map<String, JSONObject> a(Context context, int i) {
boolean z;
LinkedHashMap linkedHashMap = new LinkedHashMap();
ArrayList<ExcellianceAppInfo> a2 = InitialData.a(context).a();
f b2 = com.excelliance.kxqp.gs.m.d.a.a().b(context, "appId", String.valueOf(i));
if (a2 != null && b2 != null) {
Iterator<ExcellianceAppInfo> it = a2.iterator();
while (it.hasNext()) {
ExcellianceAppInfo next = it.next();
if (as.h(context, next.getPath()) != 0 && ((bs.a(next.getAppPackageName()) == -1 && TextUtils.equals(next.getGameType(), "1")) || TextUtils.equals(next.getGameType(), "5"))) {
az.d("RequestBean", "addUpdateDataObbByYalp: " + next);
if (next.getAppPackageName().equals(b2.c) && i != 0) {
az.d("RequestBean", "addUpdateDataObbByYalp: exit yalp appinfo:" + next);
z = true;
break;
}
}
}
}
z = false;
if (b2 != null && ((!b2.c() || !b2.d()) && z)) {
ProxyDelayService.a("RequestBean", "addUpdateDataObbByYalp: yapp:" + b2);
String a3 = a(context, b2);
if (!cd.a(a3)) {
az.d("RequestBean", "addUpdateDataObbByYalp obbInfo: " + a3);
try {
az.d("RequestBean", "addUpdateDataObbByYalp: " + a3);
JSONArray optJSONArray = new JSONObject(a3).optJSONArray("pkgs");
if (optJSONArray != null) {
az.d("RequestBean", "addUpdateDataObbByYalp: " + optJSONArray);
for (int i2 = 0; i2 < optJSONArray.length(); i2++) {
JSONObject optJSONObject = optJSONArray.optJSONObject(i2);
az.d("RequestBean", "addUpdateDataObbByYalp: " + optJSONObject);
if (optJSONObject != null) {
linkedHashMap.put(optJSONObject.optString(WebActionRouter.KEY_PKG), optJSONObject);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
return linkedHashMap;
}
public static Map<String, JSONObject> a(Context context, String str) {
LinkedHashMap linkedHashMap = new LinkedHashMap();
String b2 = b(context, str);
if (!cd.a(b2)) {
az.d("RequestBean", "deleteUpdateDataObbByYalp obbInfo: " + b2);
try {
az.d("RequestBean", "deleteUpdateDataObbByYalp: " + b2);
JSONArray optJSONArray = new JSONObject(b2).optJSONArray("pkgs");
az.d("RequestBean", "deleteUpdateDataObbByYalp: " + optJSONArray);
if (optJSONArray != null) {
for (int i = 0; i < optJSONArray.length(); i++) {
JSONObject optJSONObject = optJSONArray.optJSONObject(i);
az.d("RequestBean", "deleteUpdateDataObbByYalp: " + optJSONObject);
if (optJSONObject != null) {
linkedHashMap.put(optJSONObject.optString(WebActionRouter.KEY_PKG), optJSONObject);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
return linkedHashMap;
}
public static String b(Context context, String str) {
HashMap hashMap = new HashMap();
by a2 = by.a(context, "request_update_data");
String b2 = a2.b("request_obb_update_data", "");
String str2 = null;
if (!cd.a(b2)) {
try {
JSONArray optJSONArray = new JSONObject(b2).optJSONArray("pkgs");
JSONObject jSONObject = new JSONObject(b2);
JSONArray jSONArray = new JSONArray();
if (optJSONArray != null && optJSONArray.length() > 0) {
int i = 0;
for (int i2 = 0; i2 < optJSONArray.length(); i2++) {
JSONObject jSONObject2 = optJSONArray.getJSONObject(i2);
if (jSONObject2 != null) {
String optString = jSONObject2.optString(WebActionRouter.KEY_PKG);
if (str.equals(optString) && a(jSONObject2)) {
az.d("RequestBean", "deleteObbInfoYalp: ylap continue info obb jsonObject_item:" + jSONObject2.toString());
} else {
az.d("RequestBean", "deleteObbInfoYalp: ylap add info obb jsonObject_item:" + jSONObject2.toString());
hashMap.put(optString, jSONObject2);
}
}
}
if (hashMap.size() > 0) {
Iterator it = hashMap.entrySet().iterator();
while (it.hasNext()) {
JSONObject jSONObject3 = (JSONObject) ((Map.Entry) it.next()).getValue();
jSONArray.put(i, jSONObject3);
az.d("RequestBean", "deleteObbInfoYalp: ylap info new obb jsonObject_item:" + jSONObject3.toString());
i++;
}
}
if (jSONArray.length() > 0) {
jSONObject.put("pkgs", jSONArray);
str2 = jSONObject.toString();
}
}
} catch (JSONException e) {
e.printStackTrace();
az.d("RequestBean", "deleteObbInfoYalp: json fial e:" + e);
}
}
if (str2 != null) {
a2.a("request_obb_update_data", str2);
}
az.d("RequestBean", "deleteObbInfoYalp: ylap info save result:" + str2);
return str2;
}
private static boolean a(JSONObject jSONObject) {
return jSONObject.optInt("appId") != 0;
}
private static String a(Context context, f fVar) {
String jSONObject;
HashMap hashMap = new HashMap();
hashMap.put(fVar.c, fVar);
by a2 = by.a(context, "request_update_data");
String b2 = a2.b("request_obb_update_data", "");
String str = null;
if (!cd.a(b2)) {
try {
JSONArray optJSONArray = new JSONObject(b2).optJSONArray("pkgs");
JSONObject jSONObject2 = new JSONObject(b2);
JSONArray jSONArray = new JSONArray();
if (optJSONArray != null && optJSONArray.length() > 0) {
for (int i = 0; i < optJSONArray.length(); i++) {
JSONObject jSONObject3 = optJSONArray.getJSONObject(i);
JSONObject jSONObject4 = new JSONObject();
JSONObject jSONObject5 = new JSONObject();
JSONObject jSONObject6 = new JSONObject();
if (jSONObject3 != null) {
String optString = jSONObject3.optString(WebActionRouter.KEY_PKG);
if (fVar != null && fVar.c.equals(optString) && (!fVar.c() || !fVar.d())) {
a(fVar, jSONObject4, jSONObject5, jSONObject6);
hashMap.remove(optString);
jSONArray.put(i, jSONObject4);
az.d("RequestBean", "saveObbInfo: ylap info obb jsonObject_item:" + jSONObject4.toString());
} else {
jSONArray.put(i, jSONObject3);
}
}
}
int length = optJSONArray.length();
if (hashMap.size() > 0) {
JSONObject jSONObject7 = new JSONObject();
a(fVar, jSONObject7, new JSONObject(), new JSONObject());
jSONArray.put(length, jSONObject7);
az.d("RequestBean", "saveObbInfo: ylap info other obb jsonObject_item:" + jSONObject7.toString());
}
if (jSONArray.length() > 0) {
jSONObject2.put("pkgs", jSONArray);
jSONObject = jSONObject2.toString();
}
}
} catch (JSONException e) {
e.printStackTrace();
az.d("RequestBean", "saveObbInfo: json fial e:" + e);
}
if (str != null) {
a2.a("request_obb_update_data", str);
}
az.d("RequestBean", "saveObbInfo: ylap info save result:" + str);
return str;
}
try {
JSONObject jSONObject8 = new JSONObject();
JSONArray jSONArray2 = new JSONArray();
JSONObject jSONObject9 = new JSONObject();
a(fVar, jSONObject9, new JSONObject(), new JSONObject());
jSONArray2.put(jSONObject9);
az.d("RequestBean", "saveObbInfo: ylap info save is null obb jsonObject_item:" + jSONArray2.toString());
jSONObject8.put("pkgs", jSONArray2);
jSONObject = jSONObject8.toString();
} catch (JSONException e2) {
e2.printStackTrace();
az.d("RequestBean", "saveObbInfo: json fial 1 e:" + e2);
}
str = jSONObject;
if (str != null) {
}
az.d("RequestBean", "saveObbInfo: ylap info save result:" + str);
return str;
}
public static void a(f fVar, JSONObject jSONObject, JSONObject jSONObject2, JSONObject jSONObject3) {
try {
long j = 0;
if (!fVar.c()) {
c cVar = fVar.p;
jSONObject2.put("ishas", 1);
jSONObject2.put("length", cVar.d);
jSONObject2.put("md5", "");
jSONObject2.put(SocialConstants.PARAM_URL, cVar.f7207b);
jSONObject2.put("obbver", cVar.i);
j = 0 + cVar.d;
jSONObject.put("main", jSONObject2);
}
if (!fVar.d()) {
c cVar2 = fVar.q;
jSONObject3.put("ishas", 1);
jSONObject3.put("length", cVar2.d);
jSONObject3.put("md5", "");
jSONObject3.put(SocialConstants.PARAM_URL, cVar2.f7207b);
jSONObject3.put("obbver", cVar2.i);
j += cVar2.d;
jSONObject.put(ExcellianceAppInfo.KEY_PATCH, jSONObject3);
}
if (fVar.c() && fVar.d()) {
return;
}
jSONObject.put(WebActionRouter.KEY_PKG, fVar.c);
jSONObject.put(RankingItem.KEY_VER, fVar.f);
jSONObject.put("size_desc", j);
jSONObject.put("appId", fVar.f7210a);
} catch (JSONException e) {
e.printStackTrace();
az.d("RequestBean", "crearteObbItemJson: json fial e:" + e);
}
}
public static void a(Context context, JSONArray jSONArray) {
if (jSONArray != null) {
JSONObject downLoadGPData = ResponseData.getDownLoadGPData(context);
if (downLoadGPData == null) {
downLoadGPData = new JSONObject();
}
az.d("RequestBean", "saveDownLoadGP 0 jsonObject_root: " + downLoadGPData.toString());
long currentTimeMillis = System.currentTimeMillis();
for (int i = 0; i < jSONArray.length(); i++) {
try {
JSONObject jSONObject = jSONArray.getJSONObject(i);
String optString = jSONObject.optString(WebActionRouter.KEY_PKG);
int optInt = jSONObject.optInt(RankingItem.KEY_ONLINE);
JSONArray optJSONArray = jSONObject.optJSONArray(AppExtraBean.KEY_AREA);
if (optString != null) {
jSONObject.put(RankingItem.KEY_ONLINE, optInt);
jSONObject.put(AppExtraBean.KEY_AREA, optJSONArray);
jSONObject.put("lastTime", currentTimeMillis);
az.d("RequestBean", "saveDownLoadGP jsonObject: " + jSONObject.toString());
downLoadGPData.put(optString, jSONObject);
}
az.d("RequestBean", "saveDownLoadGP jsonObject_root: " + downLoadGPData.toString());
ResponseData.saveDownLoadGPData(context, downLoadGPData);
} catch (JSONException e) {
e.printStackTrace();
az.d("RequestBean", "saveDownLoadGP fail: " + e);
}
}
}
}
}