TIM v2.3.1版本的 MD5 值为:d6957e3ee7ce901ccc491cefdea0da8c
以下内容为反编译后的 ClubContentJsonTask.java 源代码,内容仅作参考
package com.tencent.mobileqq.vas;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.TextUtils;
import com.tencent.common.app.AppInterface;
import com.tencent.common.app.BaseApplicationImpl;
import com.tencent.mobileqq.app.QQAppInterface;
import com.tencent.mobileqq.bubble.BubbleManager;
import com.tencent.mobileqq.emosm.EmosmConstant;
import com.tencent.mobileqq.emosm.EmosmUtils;
import com.tencent.mobileqq.emoticonview.EmotionPanelData;
import com.tencent.mobileqq.msf.core.NetConnInfoCenter;
import com.tencent.mobileqq.msf.sdk.MsfSdkUtils;
import com.tencent.mobileqq.remind.Remind;
import com.tencent.mobileqq.statistics.ReportController;
import com.tencent.mobileqq.statistics.StatisticCollector;
import com.tencent.mobileqq.utils.FileUtils;
import com.tencent.mobileqq.utils.NetworkUtil;
import com.tencent.mobileqq.vas.IndividuationUrlHelper;
import com.tencent.mobileqq.vas.VasUserData;
import com.tencent.mobileqq.vip.DownloadListener;
import com.tencent.mobileqq.vip.DownloadTask;
import com.tencent.mobileqq.vip.DownloaderFactory;
import com.tencent.qphone.base.util.QLog;
import java.io.File;
import java.util.HashMap;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class ClubContentJsonTask {
private static final byte f94799a = 0;
public static final int f34147a = 1;
public static PersonalCardUrlInfo f34148a = null;
public static final String f34151a = "ClubContentJsonTask";
private static final byte f94800b = 2;
public static final int f34154b = 2;
public static final String f34156b = "clubContentVersion";
public static final int f94801c = 3;
public static final String f34158c = "";
private static final int d = 5;
public static final String f34160d = "clubContentPendantMarketJsonUpdate";
public static final String f34162f = "individuation_predownload_resource_config";
public static final String f34163g = "pendant_id_list";
private static final String f34164h = "checked";
private static final String f34165i = "counter";
public static TaskInfo f34149a = new TaskInfo("recommendEmotion.json", "http://i.gtimg.cn/qqshow/admindata/comdata/vipData_emoji_aioPanal/", "http://i.gtimg.cn/qqshow/admindata/comdata/vipData_emoji_aioPanal/xydata.json", "recommendEmotionVersion", "vipData_emoji_aio_recommend.json");
public static TaskInfo f34155b = new TaskInfo("IndividuationUrls.json", "", "http://i.gtimg.cn/qqshow/admindata/comdata/vipData_individuation_url/android.json", "individuationUrlJsonNewVersion", "vipData_individuation_url_json");
public static TaskInfo f34157c = new TaskInfo("personalCard.json", "", "http://i.gtimg.cn/qqshow/admindata/comdata/vip_personal_card/config.json", "personalCardVersion", "personal_card_json");
public static TaskInfo f34159d = new TaskInfo("Individuation.json", "http://i.gtimg.cn/qqshow/admindata/comdata/vipData_individuation/", "http://i.gtimg.cn/qqshow/admindata/comdata/vipData_individuation/xydata.json", "IndividuationVersion", "individ_json");
public static TaskInfo e = new TaskInfo("EmoticonWording.json", "", "http://i.gtimg.cn/club/item/parcel/client_wording.json", "EmoticonWordingVersion", "wording_json");
public static TaskInfo f = new TaskInfo("keyword.json", "", IndividuationUrlHelper.a(IndividuationUrlHelper.UrlId.F), "EmoticonKeywordVersion", "keyword.json");
public static TaskInfo g = new TaskInfo("themeActivity.json", "", "http://i.gtimg.cn/qqshow/admindata/comdata/viptheme_act_autoswitch/xydata.json", "ThemeActivityVersion", "theme_autoswitch_json");
public static TaskInfo h = new TaskInfo("themeDIYDataList.json", "", "http://i.gtimg.cn/qqshow/admindata/comdata/vipList_diytheme_data/diythemeData.json", "themeDIYDataListVersion", "diytheme_data_json");
public static TaskInfo i = new TaskInfo("WebviewCrashReport.json", "", "http://i.gtimg.cn/qqshow/admindata/comdata/vip_crash_report/WebviewCrashReport.json", "WebviewCrashJSONVersion", "WebviewCrashReport.json");
public static TaskInfo j = new TaskInfo("Qutu_xydata.json", "", "http://i.gtimg.cn/qqshow/admindata/comdata/vipQutu_release_zip/xydata.json", "QutuXYDataJsonVersion", "xydata.json");
public static TaskInfo k = new TaskInfo("iRedPacket_v2.json", "http://i.gtimg.cn/qqshow/admindata/comdata/vipRedPacketDataV2/", "http://i.gtimg.cn/qqshow/admindata/comdata/vipRedPacketDataV2/xydata.mobile.v1.json", "vipRedPacketData_json_v2", "vipRedPacketData_json_v2");
public static TaskInfo l = new TaskInfo("UrlIntercept.json", "http://i.gtimg.cn/qqshow/admindata/comdata/vipData_url_to_api", "http://i.gtimg.cn/qqshow/admindata/comdata/vipData_url_to_api/android.json", "UrlIntercept_json", "UrlIntercept_json");
public static TaskInfo m = new TaskInfo("pendant_market.json", "", "http://i.gtimg.cn/qqshow/admindata/comdata/vipList_faceAddon_data/xydata.android.v1.json", "pendantMarketVersion", "pendant_market_json");
public static TaskInfo n = new TaskInfo("font_info.json", "http://i.gtimg.cn/qqshow/admindata/comdata/vipList_font_data", "http://i.gtimg.cn/qqshow/admindata/comdata/vipList_font_data/version.json", "FontInfoList_json", "FontInfoList_json");
public static TaskInfo o = new TaskInfo("changeVoice.json", "", "http://i.gtimg.cn/xydata/changeVoice/app/List/xydata.json", "changeVoice.json", "changeVoice.json");
public static TaskInfo[] f34153a = {f34149a, f34159d, e};
public static String f34161e = "http://i.gtimg.cn/xydata";
public static HashMap f34152a = new HashMap();
static DownloadListener f34150a = new vrp();
public class PersonalCardUrlInfo {
public int f94802a;
public String f34166a;
public int f94803b = 25489;
public String f34167b;
}
public class PromotionEmoticonPkg extends EmotionPanelData {
public static int i;
public String f34168a;
public String f34169b;
public String f34170c;
public String f34171d;
public String f34172e;
public String f34173f;
public String f34174g;
public int n;
public int o;
public int p;
public int q;
public int r;
public int s;
public static int f94804a = 1;
public static int f94805b = 2;
public static int f94806c = 3;
public static int d = 4;
public static int e = 5;
public static int f = 6;
public static int g = 7;
public static int h = 8;
public static int j = 1;
public static int k = 6;
public static int l = 1;
public static int m = 2;
}
public class TaskInfo {
public static final String f94807a = "TaskInfo";
public JSONObject f34175a;
public String f94808b;
public String f94809c;
public String d;
public String e;
public String f;
public TaskInfo(String str, String str2, String str3, String str4, String str5) {
this.f94808b = str;
this.d = str2;
this.f94809c = str3;
this.e = str4;
this.f = str5;
}
public synchronized JSONObject a(Context context) {
JSONObject jSONObject = null;
synchronized (this) {
if (this.f34175a != null) {
jSONObject = this.f34175a;
} else if (context == null || TextUtils.isEmpty(this.f94808b)) {
QLog.e(f94807a, 1, "readLocalJsonFile, context or json_name null, context=" + context + ", json_name=" + this.f94808b);
} else {
File file = new File(context.getFilesDir(), this.f94808b);
if (file.exists()) {
try {
this.f34175a = new JSONObject(FileUtils.a(file));
} catch (Exception e) {
this.f34175a = null;
QLog.e(f94807a, 1, "readLocalJsonFile, exception=" + MsfSdkUtils.getStackTraceString(e));
}
}
jSONObject = this.f34175a;
}
}
return jSONObject;
}
}
public static void a(QQAppInterface qQAppInterface, TaskInfo taskInfo) {
int i2 = 0;
if (qQAppInterface != null && taskInfo != null) {
File file = new File(qQAppInterface.getApplication().getApplicationContext().getFilesDir(), taskInfo.f94808b);
if (!file.exists()) {
if (QLog.isColorLevel()) {
QLog.d(f34151a, 2, "downloadIfNotExist, not exist: " + taskInfo.f94808b);
}
try {
String valueOf = String.valueOf(NetConnInfoCenter.getServerTime());
String substring = valueOf.substring(0, valueOf.length() <= 10 ? valueOf.length() : 10);
if (Long.parseLong(substring) < 2147483647L) {
i2 = Integer.parseInt(substring);
}
} catch (Exception e2) {
QLog.e(f34151a, 1, "downloadIfNotExist, Integer.parseInt Err:" + e2.getMessage());
}
Bundle bundle = new Bundle();
bundle.putInt("version", i2);
bundle.putString("version_key", taskInfo.e);
bundle.putString(Remind.RemindColumns.f27009c, "downloadIfNotExist");
bundle.putString("ifromet", "null1");
a(qQAppInterface, taskInfo, EmosmUtils.a(EmosmConstant.f21854X, taskInfo.f94809c), file, bundle);
} else if (QLog.isColorLevel()) {
QLog.d(f34151a, 2, "downloadIfNotExist, exists.");
}
}
}
public static void m9537a(QQAppInterface qQAppInterface) {
qQAppInterface.getApplication().getApplicationContext();
for (int i2 = 0; i2 < f34153a.length; i2++) {
a(qQAppInterface, f34153a[i2]);
}
}
public static void a(Context context, String str, int i2) {
if (QLog.isColorLevel()) {
QLog.d(f34151a, 2, "setJsonVersion ,key=" + str + ",version:" + i2);
}
context.getSharedPreferences(f34156b, 0).edit().putInt(str, i2).commit();
}
public static int a(Context context, String str) {
SharedPreferences sharedPreferences = context.getSharedPreferences(f34156b, 0);
if (QLog.isColorLevel()) {
QLog.d(f34151a, 2, "--getJsonVersion ,key=" + str + ",version:" + sharedPreferences.getInt(str, 0));
}
return sharedPreferences.getInt(str, 0);
}
public static void a(QQAppInterface qQAppInterface, TaskInfo taskInfo, int i2, boolean z) {
File file = new File(qQAppInterface.getApplication().getApplicationContext().getFilesDir(), taskInfo.f94808b);
Bundle bundle = new Bundle();
bundle.putInt("version", i2);
bundle.putString("version_key", taskInfo.e);
bundle.putString(Remind.RemindColumns.f27009c, "updateJson");
bundle.putString("ifromet", String.valueOf(z));
a(qQAppInterface, taskInfo, null, file, bundle);
}
public static synchronized void a(AppInterface appInterface, TaskInfo taskInfo, String str, File file, Bundle bundle) {
synchronized (ClubContentJsonTask.class) {
if (file != null) {
if (str == null) {
if (taskInfo != null) {
str = taskInfo.f94809c;
}
}
String name = taskInfo != null ? taskInfo.f94808b : file.getName();
String string = bundle.getString(Remind.RemindColumns.f27009c);
String str2 = string == null ? "other" : string;
String string2 = bundle.getString("ifromet");
String str3 = string2 == null ? "false" : string2;
boolean z = bundle.containsKey("forceUpdate") ? bundle.getBoolean("forceUpdate") : false;
int i2 = bundle.getInt("version", 0);
String str4 = name + "_" + i2;
if (QLog.isColorLevel()) {
QLog.d(f34151a, 2, "club_downloadFile,method:" + str2 + ",key:" + name + ", server version:" + i2 + ",ifromet:" + str3);
}
if (z || !f34152a.containsKey(str4) || !((Boolean) f34152a.get(str4)).booleanValue()) {
f34152a.put(str4, true);
DownloadTask downloadTask = new DownloadTask(str, file);
downloadTask.f34367l = true;
downloadTask.f34335a = name;
if (o.f94808b.equals(name)) {
downloadTask.f34346b = true;
}
((DownloaderFactory) appInterface.getManager(46)).a(1).a(downloadTask, f34150a, bundle);
if (QLog.isColorLevel()) {
QLog.d(f34151a, 2, str2 + ",cdownloadFile url=" + str);
}
try {
HashMap hashMap = new HashMap();
hashMap.put("param_key", name);
hashMap.put("param_ifromet", str3);
StatisticCollector.a(appInterface.getApplication().getApplicationContext()).a(appInterface.getAccount(), "VipClubContentJsonTaskLoad", true, 1L, 0L, hashMap, "", false);
} catch (Exception e2) {
if (QLog.isColorLevel()) {
QLog.i(f34151a, 2, "downloadFile, downloadFile error=" + e2.toString());
}
}
}
}
}
}
public static void a() {
JSONObject jSONObject;
boolean z;
int i2;
String[] split;
JSONArray jSONArray;
QQAppInterface qQAppInterface = (QQAppInterface) BaseApplicationImpl.f6970a.m1871a();
if (qQAppInterface == null) {
if (QLog.isColorLevel()) {
QLog.e(f34151a, 2, "checkPredownloadResource, app null, return");
return;
}
return;
}
SharedPreferences sharedPreferences = qQAppInterface.getApp().getSharedPreferences(f34162f, 0);
if (sharedPreferences.getBoolean(f34164h, false)) {
if (QLog.isColorLevel()) {
QLog.d(f34151a, 2, "checkPredownloadResource, checked, abort");
return;
}
return;
}
int i3 = sharedPreferences.getInt(f34165i, 0);
if (i3 >= 5) {
if (QLog.isColorLevel()) {
QLog.d(f34151a, 2, "checkPredownloadResource, checkedCount achieve max try count, abort");
return;
}
return;
}
SharedPreferences.Editor edit = sharedPreferences.edit();
File file = new File(qQAppInterface.getApplication().getFilesDir(), f34159d.f94808b);
if (file != null && file.exists()) {
edit.putInt(f34165i, i3 + 1);
try {
JSONObject a2 = f34159d.a(qQAppInterface.getApplication().getApplicationContext());
if (a2 != null && a2.has("data")) {
JSONObject jSONObject2 = a2.getJSONObject("data");
if (jSONObject2 != null && jSONObject2.has("redPacketPrepare")) {
JSONArray jSONArray2 = jSONObject2.getJSONArray("redPacketPrepare");
if (jSONArray2 != null && jSONArray2.length() > 0 && (jSONObject = jSONArray2.getJSONObject(0)) != null) {
if (jSONObject.has("weihao") && (jSONArray = jSONObject.getJSONArray("weihao")) != null && jSONArray.length() > 0) {
String currentAccountUin = qQAppInterface.getCurrentAccountUin();
int length = jSONArray.length();
for (int i4 = 0; i4 < length; i4++) {
if (currentAccountUin.endsWith(String.valueOf(jSONArray.getInt(i4)))) {
z = true;
break;
}
}
}
z = false;
boolean z2 = false;
if (jSONObject.has("switch")) {
z2 = jSONObject.getInt("switch") == 1;
}
if (QLog.isColorLevel()) {
QLog.d(f34151a, 2, "checkPredownloadResource, uinMatchResult=" + z + ", downloadSwitchOn=" + z2);
}
if (z && z2) {
try {
i2 = NetworkUtil.a((Context) qQAppInterface.getApplication());
} catch (Exception e2) {
i2 = 0;
}
if (QLog.isColorLevel()) {
QLog.d(f34151a, 2, "checkPredownloadResource, netType=" + i2);
}
if (i2 != 0) {
String string = jSONObject.getString("network");
boolean z3 = false;
if ("2G".equals(string)) {
z3 = true;
} else if ("3G".equals(string)) {
if (i2 != 2) {
z3 = true;
}
} else if ("4G".equals(string)) {
if (i2 != 2 && i2 != 3) {
z3 = true;
}
} else if ("wifi".equals(string)) {
if (i2 == 1) {
z3 = true;
}
} else if (i2 == 1) {
z3 = true;
}
if (QLog.isColorLevel()) {
QLog.d(f34151a, 2, "checkPredownloadResource, network=" + string + ", shouldDownload=" + z3);
}
if (z3) {
edit.putBoolean(f34164h, true);
if (jSONObject.has("bubble")) {
String string2 = jSONObject.getString("bubble");
if (QLog.isColorLevel()) {
QLog.d(f34151a, 2, "checkPredownloadResource, bubbleIds=" + string2);
}
if (!TextUtils.isEmpty(string2) && (split = string2.split(",")) != null && split.length > 0) {
ReportController.b(null, "dc01332", "redPacketPrepare", "", "0X8006293", "0X8006293", 0, 1, "bubble", "", "", "");
BubbleManager bubbleManager = (BubbleManager) qQAppInterface.getManager(43);
try {
for (String str : split) {
if (!TextUtils.isEmpty(str)) {
bubbleManager.c(Integer.parseInt(str), null);
}
}
} catch (Exception e3) {
if (QLog.isColorLevel()) {
QLog.e(f34151a, 2, "checkPredownloadResource, parse bubble id, exception=" + MsfSdkUtils.getStackTraceString(e3));
}
}
}
}
if (jSONObject.has("faceAddon")) {
String string3 = jSONObject.getString("faceAddon");
if (QLog.isColorLevel()) {
QLog.d(f34151a, 2, "checkPredownloadResource, pendantStr=" + string3);
}
}
}
} else if (QLog.isColorLevel()) {
QLog.e(f34151a, 2, "checkPredownloadResource, no network");
}
} else if (!z2) {
edit.putBoolean(f34164h, true);
if (QLog.isColorLevel()) {
QLog.d(f34151a, 2, "checkPredownloadResource, downloadSwitchOn false");
}
}
}
} else {
edit.putBoolean(f34164h, true);
if (QLog.isColorLevel()) {
QLog.d(f34151a, 2, "checkPredownloadResource, no config for redPacketPrepare");
}
}
}
} catch (Exception e4) {
if (QLog.isColorLevel()) {
QLog.e(f34151a, 2, "jsonDownloadListener, onDone, exception=" + MsfSdkUtils.getStackTraceString(e4));
}
}
edit.commit();
}
}
public static boolean a(JSONObject jSONObject, String str, boolean z) {
try {
JSONArray jSONArray = (jSONObject.has("AList") && (jSONObject.get("AList") instanceof JSONArray)) ? jSONObject.getJSONArray("AList") : new JSONArray();
for (int i2 = 0; i2 < jSONArray.length(); i2++) {
if (str.equals(jSONArray.getString(i2))) {
return true;
}
}
JSONArray jSONArray2 = (jSONObject.has("BList") && (jSONObject.get("BList") instanceof JSONArray)) ? jSONObject.getJSONArray("BList") : new JSONArray();
for (int i3 = 0; i3 < jSONArray2.length(); i3++) {
if (str.equals(jSONArray2.getString(i3))) {
return false;
}
}
int parseInt = Integer.parseInt(jSONObject.getString("ARate"));
int parseInt2 = Integer.parseInt(str.substring(str.length() - 2));
if (z) {
if (parseInt2 >= parseInt) {
return false;
}
} else if (parseInt2 > parseInt) {
return false;
}
} catch (Exception e2) {
if (QLog.isColorLevel()) {
QLog.d(f34151a, 2, e2.getMessage());
}
}
return true;
}
public static void b(QQAppInterface qQAppInterface) {
JSONObject jSONObject;
int i2;
int i3 = 0;
JSONObject a2 = a(qQAppInterface, f34157c, false);
if (a2 != null) {
try {
f34148a = new PersonalCardUrlInfo();
f34148a.f94802a = a2.has("h5Pay") ? a2.getInt("h5Pay") : 0;
f34148a.f94803b = a2.has("x5KernelVer") ? a2.getInt("x5KernelVer") : 0;
int optInt = a2.optInt("frequency");
if (optInt != 0) {
VasUserData.a(qQAppInterface, VasUserData.Key.d, Integer.toString(optInt));
}
JSONArray jSONArray = a2.has("vipPersonalCard") ? a2.getJSONArray("vipPersonalCard") : null;
if (jSONArray != null && jSONArray.length() > 0) {
while (true) {
int i4 = i3;
if (i4 < jSONArray.length()) {
jSONObject = (JSONObject) jSONArray.get(i4);
i2 = jSONObject.has("platformid") ? jSONObject.getInt("platformid") : -1;
if (i2 == 0 || i2 == 2) {
break;
}
i3 = i4 + 1;
} else {
return;
}
}
String string = jSONObject.has("masterUrl") ? jSONObject.getString("masterUrl") : "";
String string2 = jSONObject.has("guestUrl") ? jSONObject.getString("guestUrl") : "";
f34148a.f34166a = string;
f34148a.f34167b = string2;
if (QLog.isColorLevel()) {
QLog.d(f34151a, 2, "personalcardurlInfo : platformId = " + i2 + ";masterUrl = " + string + ";guestUrl = " + string2);
}
}
} catch (JSONException e2) {
if (QLog.isColorLevel()) {
QLog.d(f34151a, 2, "jsonexception");
}
e2.printStackTrace();
}
}
}
public static JSONArray a(QQAppInterface qQAppInterface) {
a(qQAppInterface, e);
String a2 = FileUtils.a(new File(qQAppInterface.getApplication().getApplicationContext().getFilesDir(), e.f94808b));
if (a2 != null) {
try {
return new JSONObject(a2).getJSONArray("wording");
} catch (Exception e2) {
if (QLog.isColorLevel()) {
QLog.d(f34151a, 2, e2.getMessage());
}
}
}
return null;
}
public static JSONObject a(QQAppInterface qQAppInterface, TaskInfo taskInfo, boolean z) {
String str;
Context applicationContext = qQAppInterface.getApplication().getApplicationContext();
String str2 = taskInfo.f94808b;
File file = new File(applicationContext.getFilesDir(), str2);
if (file.exists()) {
try {
str = FileUtils.a(file);
} catch (OutOfMemoryError e2) {
if (QLog.isColorLevel()) {
QLog.e(f34151a, 2, "getJsonOOM,json_name:" + str2 + e2.getMessage());
}
str = null;
}
if (str != null) {
try {
return new JSONObject(str);
} catch (ArrayIndexOutOfBoundsException e3) {
if (QLog.isColorLevel()) {
QLog.e(f34151a, 2, "getJsonError,ArrayIndexOutOfBoundsException:" + str2 + e3.getMessage());
}
file.delete();
return null;
} catch (ArrayStoreException e4) {
if (QLog.isColorLevel()) {
QLog.e(f34151a, 2, "getJsonError,ArrayStoreException:" + str2 + e4.getMessage());
}
file.delete();
return null;
} catch (NumberFormatException e5) {
if (QLog.isColorLevel()) {
QLog.e(f34151a, 2, "getJsonError,NumberFormatException:" + str2 + e5.getMessage());
}
file.delete();
return null;
} catch (Exception e6) {
if (QLog.isColorLevel()) {
QLog.e(f34151a, 2, "getJsonError,Exception:" + str2 + e6.getMessage());
}
file.delete();
return null;
} catch (OutOfMemoryError e7) {
if (QLog.isColorLevel()) {
QLog.e(f34151a, 2, "getJsonError,JSONObject_OOM:" + str2 + e7.getMessage());
}
file.delete();
return null;
} catch (JSONException e8) {
if (QLog.isColorLevel()) {
QLog.e(f34151a, 2, "getJsonError,JSONException:" + str2 + e8.getMessage());
}
file.delete();
return null;
}
}
} else {
if (QLog.isColorLevel()) {
QLog.w(f34151a, 2, "getJsonFromLocalFile not exist,json_name:" + str2 + " _ " + z);
}
if (z) {
a(qQAppInterface, taskInfo);
}
}
return null;
}
}