九游游戏中心HD v4.6.8.1版本的 MD5 值为:78c397802cc5ffdcc7f5502ede90502e
以下内容为反编译后的 a.java 源代码,内容仅作参考
package com.uc.webview.export.internal.d.a;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.support.v4.media.session.PlaybackStateCompat;
import android.util.Pair;
import cn.ninegame.im.push.model.message.MessageInfo;
import cn.ninegame.library.network.net.model.Body;
import com.UCMobile.Apollo.Global;
import com.uc.webview.export.Build;
import com.uc.webview.export.cyclone.UCCyclone;
import com.uc.webview.export.cyclone.UCLogger;
import com.uc.webview.export.internal.d;
import com.uc.webview.export.internal.interfaces.IWaStat;
import com.uc.webview.export.internal.utility.Log;
import com.uc.webview.export.utility.Utils;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.json.JSONArray;
import org.json.JSONObject;
public final class a {
private static a f4498a;
private Context b;
private Handler d;
private Map<String, C0154a> e;
private List<b> f;
private SimpleDateFormat g = new SimpleDateFormat("yyyyMMdd");
private SimpleDateFormat h = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private Object i = new Object();
private HandlerThread c = new HandlerThread("SDKWaStatThread", 0);
static String a(a aVar, SharedPreferences sharedPreferences) {
String string = sharedPreferences.getString(Global.APOLLO_SERIES, "");
if (com.uc.webview.export.internal.utility.a.a(string)) {
String uuid = UUID.randomUUID().toString();
SharedPreferences.Editor edit = aVar.b.getSharedPreferences("UC_WA_STAT", 0).edit();
edit.putString(Global.APOLLO_SERIES, uuid);
edit.commit();
return uuid;
}
return string;
}
static void a(a aVar, long j, String str) {
SharedPreferences.Editor edit = aVar.b.getSharedPreferences("UC_WA_STAT", 0).edit();
edit.putLong("1", j);
if (str != null) {
edit.putString("4", str);
}
edit.commit();
}
static byte[] a(a aVar, String[] strArr) {
Object[] g = aVar.g();
if (g == null) {
return null;
}
StringBuilder sb = new StringBuilder();
sb.append("lt=uc");
Map map = (Map) g[0];
List list = (List) g[1];
List<PackageInfo> b2 = b(aVar.b);
List<String[]> b3 = aVar.b(b2);
strArr[0] = b(map, list);
Iterator it = map.entrySet().iterator();
while (true) {
if (!it.hasNext()) {
break;
}
Map.Entry entry = (Map.Entry) it.next();
if (sb.length() < 11264) {
String b4 = b(((C0154a) entry.getValue()).b);
sb.append("\n");
for (String[] strArr2 : b3) {
a(sb, strArr2[0], strArr2[1]);
}
if (b4.equals(strArr[0])) {
for (String[] strArr3 : aVar.a(b2, strArr[0])) {
a(sb, strArr3[0], strArr3[1]);
}
}
for (Map.Entry<String, Integer> entry2 : ((C0154a) entry.getValue()).f4502a.entrySet()) {
a(sb, entry2.getKey(), String.valueOf(entry2.getValue()));
}
for (Map.Entry<String, String> entry3 : ((C0154a) entry.getValue()).b.entrySet()) {
a(sb, entry3.getKey(), entry3.getValue());
}
for (Map.Entry<String, Integer> entry4 : d.x.entrySet()) {
a(sb, entry4.getKey(), String.valueOf(entry4.getValue().intValue()));
}
} else if (Utils.sWAPrintLog) {
Log.d("SDKWaStat", "getUploadData MergeData size(" + sb.length() + ") more then 11264");
}
}
Iterator it2 = list.iterator();
while (true) {
if (!it2.hasNext()) {
break;
}
b bVar = (b) it2.next();
if (sb.length() < 11264) {
sb.append("\n");
for (String[] strArr4 : b3) {
a(sb, strArr4[0], strArr4[1]);
}
for (Map.Entry<String, String> entry5 : bVar.b.entrySet()) {
a(sb, entry5.getKey(), entry5.getValue());
}
} else if (Utils.sWAPrintLog) {
Log.d("SDKWaStat", "getUploadData UnMergeData size(" + sb.length() + ") more then 11264");
}
}
if (Utils.sWAPrintLog) {
Log.i("SDKWaStat", "getUploadData:\n" + sb.toString());
}
sb.append("\n");
a(sb, "stat_size", String.valueOf(sb.toString().getBytes().length));
return sb.toString().getBytes();
}
public class C0154a {
Map<String, Integer> f4502a;
Map<String, String> b;
private C0154a() {
this.f4502a = new HashMap();
this.b = new HashMap();
}
C0154a(a aVar, byte b) {
this();
}
public final String toString() {
return "Int Data: " + this.f4502a.toString() + " String Data: " + this.b.toString();
}
}
public class b {
String f4503a;
Map<String, String> b;
public b(String str, Map<String, String> map) {
this.f4503a = str;
this.b = map;
}
public final String toString() {
return "Key: " + this.f4503a + " Data: " + this.b.toString();
}
}
private a() {
this.c.start();
this.d = new Handler(this.c.getLooper());
}
public static a a() {
if (f4498a == null && d.e != null) {
a(d.e);
}
return f4498a;
}
public static synchronized void a(Context context) {
synchronized (a.class) {
if (!d.f) {
if (f4498a == null) {
f4498a = new a();
}
f4498a.b = context.getApplicationContext();
}
}
}
private static boolean d() {
return ((Boolean) d.a(10006, "stat", true)).booleanValue();
}
public final void a(String str) {
if (d() && !d.f && !com.uc.webview.export.internal.utility.a.a(str)) {
String lowerCase = str.toLowerCase();
if (lowerCase.startsWith("http://") || lowerCase.startsWith("https://")) {
if (Utils.sWAPrintLog) {
Log.d("SDKWaStat", "statPV:" + lowerCase);
}
b("sum_pv");
}
}
}
public final void b(String str) {
if (d() && !d.f) {
a(str, 0, 1, null);
}
}
public final void a(String str, int i) {
if (d() && !d.f) {
a(str, 0, i, null);
}
}
public final void a(String str, String str2) {
if (d() && !d.f) {
a(str, 1, 0, str2);
}
}
public static void a(Pair<String, HashMap<String, String>> pair) {
UCLogger create = UCLogger.create("d", "SDKWaStat");
if (create != null) {
StringBuilder sb = new StringBuilder();
sb.append("ev_ac=").append((String) pair.first);
for (Map.Entry entry : ((HashMap) pair.second).entrySet()) {
sb.append("`").append((String) entry.getKey()).append("=").append((String) entry.getValue());
}
create.print(sb.toString(), new Throwable[0]);
}
}
public final void b(Pair<String, HashMap<String, String>> pair) {
a(pair);
if (d() && !d.f) {
if (100 < ((HashMap) pair.second).toString().length() && Utils.sWAPrintLog) {
Log.d("SDKWaStat", "second length(" + ((HashMap) pair.second).toString().length() + ") more then 100");
}
synchronized (this.i) {
if (this.f == null) {
this.f = new ArrayList();
}
((HashMap) pair.second).put("tm", this.h.format(new Date(System.currentTimeMillis())));
this.f.add(new b((String) pair.first, (Map) pair.second));
}
}
}
private void a(String str, int i, int i2, String str2) {
C0154a c0154a;
Date date = new Date(System.currentTimeMillis());
int intValue = ((Boolean) d.a(10010, new Object[0])).booleanValue() ? ((Integer) d.a(10020, new Object[0])).intValue() : 0;
if (intValue != 2 && intValue != 0) {
intValue = (intValue * 10) + d.n;
}
String str3 = this.g.format(date) + "~" + intValue;
synchronized (this.i) {
if (this.e == null) {
this.e = new HashMap();
}
C0154a c0154a2 = this.e.get(str3);
if (c0154a2 == null) {
C0154a c0154a3 = new C0154a(this, (byte) 0);
this.e.put(str3, c0154a3);
c0154a = c0154a3;
} else {
c0154a = c0154a2;
}
c0154a.b.put("tm", this.h.format(date));
switch (i) {
case 0:
Integer num = c0154a.f4502a.get(str);
if (num == null) {
c0154a.f4502a.put(str, Integer.valueOf(i2));
break;
} else {
c0154a.f4502a.put(str, Integer.valueOf(num.intValue() + i2));
break;
}
case 1:
c0154a.b.put(str, str2);
break;
}
}
}
public final void a(boolean z) {
if (!d.f && d()) {
try {
new Thread() {
@Override
public final void run() {
a.this.e();
}
}.start();
if (z) {
Thread.sleep(20L);
}
} catch (Exception e) {
Log.e("SDKWaStat", "saveData", e);
}
}
}
public synchronized void e() {
if (!d.f && d()) {
try {
if (Utils.sWAPrintLog) {
Log.d("SDKWaStat", "saveData");
}
HashMap hashMap = new HashMap();
ArrayList arrayList = new ArrayList();
synchronized (this.i) {
if (((Boolean) d.a(10010, new Object[0])).booleanValue() && !a(this.e)) {
hashMap.putAll(this.e);
this.e.clear();
}
if (!a(this.f)) {
arrayList.addAll(this.f);
this.f.clear();
}
}
a(hashMap, arrayList);
} catch (Exception e) {
}
}
}
public final void b() {
if (!d.f && d()) {
this.d.postDelayed(new Runnable() {
@Override
public final void run() {
try {
a.this.c();
} catch (Throwable th) {
Log.i("SDKWaStat", "update", th);
}
}
}, 15000L);
}
}
public String f() {
String str = this.b.getApplicationContext().getApplicationInfo().dataDir + "/ucwa";
File file = new File(str);
if (!file.exists()) {
file.mkdir();
}
return str;
}
private static boolean a(List list) {
return list == null || list.size() == 0;
}
private static boolean a(Map map) {
return map == null || map.size() == 0;
}
private void a(Map<String, C0154a> map, List<b> list) {
BufferedWriter bufferedWriter;
FileWriter fileWriter;
Closeable closeable;
FileWriter fileWriter2;
int i;
String[] split;
int i2 = 0;
BufferedWriter bufferedWriter2 = null;
if (a(map) && a(list)) {
return;
}
File file = new File(f(), "wa_upload_new.wa");
if (Utils.sWAPrintLog) {
Log.d("SDKWaStat", "savePVToFile:" + file);
}
try {
if (file.exists()) {
FileInputStream fileInputStream = new FileInputStream(file);
try {
int available = fileInputStream.available();
fileInputStream.close();
i = available;
} catch (Exception e) {
fileWriter2 = null;
closeable = fileInputStream;
UCCyclone.close(bufferedWriter2);
UCCyclone.close(fileWriter2);
UCCyclone.close(closeable);
} catch (Throwable th) {
bufferedWriter = null;
fileWriter = null;
bufferedWriter2 = fileInputStream;
th = th;
UCCyclone.close(bufferedWriter);
UCCyclone.close(fileWriter);
UCCyclone.close(bufferedWriter2);
throw th;
}
} else {
i = 0;
}
if (i >= 10240) {
if (Utils.sWAPrintLog) {
Log.d("SDKWaStat", "file size(" + i + ") more then 10240");
}
UCCyclone.close(null);
UCCyclone.close(null);
UCCyclone.close(null);
return;
}
fileWriter = new FileWriter(file, true);
try {
bufferedWriter = new BufferedWriter(fileWriter, MessageInfo.FLAG_STATE_UNREAD);
} catch (Exception e2) {
closeable = null;
fileWriter2 = fileWriter;
} catch (Throwable th2) {
th = th2;
bufferedWriter = null;
}
try {
Iterator<Map.Entry<String, C0154a>> it = map.entrySet().iterator();
int i3 = 0;
while (true) {
if (!it.hasNext()) {
break;
}
Map.Entry<String, C0154a> next = it.next();
if (i3 + i < 10240) {
bufferedWriter.write("@0");
bufferedWriter.write("@k@");
int i4 = i3 + 2 + 3;
String key = next.getKey();
if (key.split("~")[1].equals("0")) {
int intValue = ((Integer) d.a(10020, new Object[0])).intValue();
if (intValue != 2) {
intValue = (intValue * 10) + d.n;
}
key = split[0] + "~" + intValue;
}
bufferedWriter.write(key);
bufferedWriter.write("@d@");
i3 = a(bufferedWriter, next.getValue().f4502a, 0) + key.length() + i4 + 3 + a(bufferedWriter, next.getValue().b, 1);
bufferedWriter.newLine();
} else if (Utils.sWAPrintLog) {
Log.d("SDKWaStat", "write merge data, size(" + (i3 + i) + ") more then 10240");
}
}
while (true) {
if (i2 >= 10 || i2 >= list.size()) {
break;
} else if (i3 + i >= 10240) {
break;
} else {
b bVar = list.get(i2);
bufferedWriter.write("@1");
bufferedWriter.write("@k@");
bufferedWriter.write(bVar.f4503a);
bufferedWriter.write("@d@");
int a2 = a(bufferedWriter, bVar.b, 1) + i3 + 2 + 3 + bVar.f4503a.length() + 3;
bufferedWriter.newLine();
i2++;
i3 = a2;
}
}
UCCyclone.close(bufferedWriter);
UCCyclone.close(fileWriter);
UCCyclone.close(null);
} catch (Exception e3) {
closeable = null;
fileWriter2 = fileWriter;
bufferedWriter2 = bufferedWriter;
UCCyclone.close(bufferedWriter2);
UCCyclone.close(fileWriter2);
UCCyclone.close(closeable);
} catch (Throwable th3) {
th = th3;
UCCyclone.close(bufferedWriter);
UCCyclone.close(fileWriter);
UCCyclone.close(bufferedWriter2);
throw th;
}
} catch (Exception e4) {
closeable = null;
fileWriter2 = null;
} catch (Throwable th4) {
th = th4;
bufferedWriter = null;
fileWriter = null;
}
}
private static <T> int a(BufferedWriter bufferedWriter, Map<String, T> map, int i) {
int i2 = 0;
if (a(map)) {
return 0;
}
Iterator<Map.Entry<String, T>> it = map.entrySet().iterator();
while (true) {
int i3 = i2;
if (it.hasNext()) {
Map.Entry<String, T> next = it.next();
bufferedWriter.write(next.getKey());
bufferedWriter.write("=");
bufferedWriter.write("#" + i);
bufferedWriter.write(next.getValue() + "`");
i2 = (next.getValue() + "`").length() + next.getKey().length() + 1 + ("#" + i).length() + i3;
} else {
return i3;
}
}
}
private Object[] g() {
FileReader fileReader;
BufferedReader bufferedReader;
Throwable th;
C0154a c0154a;
File file = new File(f(), "wa_upload_new.wa");
if (Utils.sWAPrintLog) {
Log.d("SDKWaStat", "getPVFromFile:" + file + " exists:" + file.exists());
}
if (file.exists()) {
FileReader fileReader2 = null;
BufferedReader bufferedReader2 = null;
HashMap hashMap = new HashMap();
ArrayList arrayList = new ArrayList();
try {
fileReader = new FileReader(file);
try {
bufferedReader = new BufferedReader(fileReader, MessageInfo.FLAG_STATE_UNREAD);
int i = 0;
while (true) {
try {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
if (Utils.sWAPrintLog) {
Log.d("SDKWaStat", readLine);
}
if (!com.uc.webview.export.internal.utility.a.a(readLine)) {
if (readLine.length() + i <= 11264) {
int length = i + readLine.length();
String trim = readLine.trim();
if (trim.startsWith("@0") || trim.startsWith("@1")) {
int indexOf = trim.indexOf("@k@");
int indexOf2 = trim.indexOf("@d@");
if (indexOf >= 0 && indexOf2 >= 0) {
String substring = trim.substring(indexOf + 3, indexOf2);
String[] split = trim.substring(indexOf2 + 3).split("`");
if (trim.startsWith("@0")) {
String[] split2 = substring.split("~");
if (split2.length == 2 && split2[0].length() == 8 && split2[1].length() <= 2) {
C0154a c0154a2 = (C0154a) hashMap.get(substring);
if (c0154a2 == null) {
if (hashMap.size() == 8) {
if (arrayList.size() == 10) {
break;
}
} else {
C0154a c0154a3 = new C0154a(this, (byte) 0);
hashMap.put(substring, c0154a3);
c0154a = c0154a3;
}
} else {
c0154a = c0154a2;
}
for (String str : split) {
String[] split3 = str.split("=");
if (split3.length == 2 && split3[1].length() > 2) {
String substring2 = split3[1].substring(2);
if (split3[1].startsWith("#0")) {
Integer num = c0154a.f4502a.get(split3[0]);
if (num == null) {
c0154a.f4502a.put(split3[0], Integer.valueOf(Integer.parseInt(substring2)));
} else {
c0154a.f4502a.put(split3[0], Integer.valueOf(num.intValue() + Integer.parseInt(substring2)));
}
} else if (split3[1].startsWith("#1")) {
c0154a.b.put(split3[0], substring2);
}
}
}
c0154a.b.put("core_t", split2[1]);
i = length;
}
} else if (arrayList.size() != 10) {
HashMap hashMap2 = new HashMap(split.length);
for (String str2 : split) {
String[] split4 = str2.split("=");
if (split4.length == 2) {
hashMap2.put(split4[0], split4[1].substring(2));
}
}
hashMap2.put("ev_ac", substring);
arrayList.add(new b(substring, hashMap2));
i = length;
}
}
}
i = length;
} else if (Utils.sWAPrintLog) {
Log.d("SDKWaStat", "upload data size(" + (i + readLine.length()) + ") more then 11264");
}
}
} catch (Exception e) {
bufferedReader2 = bufferedReader;
fileReader2 = fileReader;
UCCyclone.close(bufferedReader2);
UCCyclone.close(fileReader2);
return null;
} catch (Throwable th2) {
th = th2;
UCCyclone.close(bufferedReader);
UCCyclone.close(fileReader);
throw th;
}
}
} catch (Exception e2) {
fileReader2 = fileReader;
} catch (Throwable th3) {
bufferedReader = null;
th = th3;
}
} catch (Exception e3) {
} catch (Throwable th4) {
fileReader = null;
bufferedReader = null;
th = th4;
}
if (hashMap.size() <= 0 && arrayList.size() <= 0) {
UCCyclone.close(bufferedReader);
UCCyclone.close(fileReader);
return null;
}
Object[] objArr = {hashMap, arrayList};
UCCyclone.close(bufferedReader);
UCCyclone.close(fileReader);
return objArr;
}
return null;
}
private List<String[]> b(List<PackageInfo> list) {
int i;
Iterator<PackageInfo> it = list.iterator();
while (true) {
if (!it.hasNext()) {
i = 0;
break;
}
PackageInfo next = it.next();
if (!next.packageName.equals("com.UCMobile")) {
if (next.packageName.equals("com.UCMobile.intl")) {
i = 2;
break;
}
} else {
i = 1;
break;
}
}
ArrayList arrayList = new ArrayList();
arrayList.add(new String[]{"lt", "ev"});
arrayList.add(new String[]{"ct", "corepv"});
arrayList.add(new String[]{Body.CONST_CLIENT_VERSION, Build.Version.NAME});
arrayList.add(new String[]{"pkg", this.b.getPackageName()});
arrayList.add(new String[]{"sdk_sn", Build.TIME});
String[] strArr = new String[2];
strArr[0] = "sdk_pm";
strArr[1] = com.uc.webview.export.internal.utility.a.a(android.os.Build.MODEL) ? "unknown" : android.os.Build.MODEL.trim().replaceAll("[`|=]", "");
arrayList.add(strArr);
String[] strArr2 = new String[2];
strArr2[0] = "sdk_f";
StringBuilder sb = new StringBuilder();
sb.append((((Boolean) d.a(10003, 524288L)).booleanValue() || d.a(10036, this.b) == null) ? "0" : "1").append(((Boolean) d.a(10003, 1L)).booleanValue() ? "1" : "0").append(d.k ? "1" : "0").append(((Boolean) d.a(10003, 2L)).booleanValue() ? "1" : "0").append(((Boolean) d.a(10003, 4L)).booleanValue() ? "1" : "0").append(((Boolean) d.a(10003, 8L)).booleanValue() ? "1" : "0").append(((Boolean) d.a(10003, 16L)).booleanValue() ? "1" : "0").append(((Boolean) d.a(10003, 32L)).booleanValue() ? "1" : "0").append(((Boolean) d.a(10003, 64L)).booleanValue() ? "1" : "0").append(((Boolean) d.a(10003, 128L)).booleanValue() ? "1" : "0").append(((Boolean) d.a(10003, 256L)).booleanValue() ? "1" : "0").append(((Boolean) d.a(10003, 512L)).booleanValue() ? "1" : "0").append(((Boolean) d.a(10003, Long.valueOf((long) PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID))).booleanValue() ? "1" : "0").append(((Boolean) d.a(10003, Long.valueOf((long) PlaybackStateCompat.ACTION_PLAY_FROM_SEARCH))).booleanValue() ? "1" : "0").append(((Boolean) d.a(10003, Long.valueOf((long) PlaybackStateCompat.ACTION_SKIP_TO_QUEUE_ITEM))).booleanValue() ? "1" : "0").append(((Boolean) d.a(10003, Long.valueOf((long) PlaybackStateCompat.ACTION_PLAY_FROM_URI))).booleanValue() ? "1" : "0").append(((Boolean) d.a(10003, 16384L)).booleanValue() ? "1" : "0").append(((Boolean) d.a(10003, 32768L)).booleanValue() ? "1" : "0").append(((Boolean) d.a(10003, 65536L)).booleanValue() ? "1" : "0").append(((Boolean) d.a(10003, 131072L)).booleanValue() ? "1" : "0").append(((Boolean) d.a(10003, 262144L)).booleanValue() ? "1" : "0");
strArr2[1] = sb.toString();
arrayList.add(strArr2);
arrayList.add(new String[]{"sdk_uf", String.valueOf(i)});
String[] strArr3 = new String[2];
strArr3[0] = "sdk_bd";
strArr3[1] = com.uc.webview.export.internal.utility.a.a(android.os.Build.BRAND) ? "unknown" : android.os.Build.BRAND.trim().replaceAll("[`|=]", "");
arrayList.add(strArr3);
arrayList.add(new String[]{"sdk_osv", Build.VERSION.RELEASE});
arrayList.add(new String[]{"sdk_prd", com.uc.webview.export.Build.SDK_PRD});
arrayList.add(new String[]{"sdk_cos", com.uc.webview.export.internal.utility.d.c()});
if (!com.uc.webview.export.internal.utility.a.a(com.uc.webview.export.Build.CORE_VERSION)) {
arrayList.add(new String[]{"sdk_sdk_cv", com.uc.webview.export.Build.CORE_VERSION.trim()});
}
if (i == 0) {
String[] strArr4 = new String[2];
strArr4[0] = "sdk_ucbackup";
strArr4[1] = new File("/sdcard/Backucup/com.UCMobile").exists() ? "1" : "0";
arrayList.add(strArr4);
}
String[] strArr5 = new String[2];
strArr5[0] = IWaStat.VIDEO_AC;
strArr5[1] = ((Boolean) d.a(10003, 1048576L)).booleanValue() ? "1" : "0";
arrayList.add(strArr5);
return arrayList;
}
private List<String[]> a(List<PackageInfo> list, String str) {
if (str == null) {
return new ArrayList(0);
}
ArrayList arrayList = new ArrayList();
String string = this.b.getSharedPreferences("UC_WA_STAT", 0).getString("4", null);
if (string == null || !string.equals(str)) {
arrayList.add(new String[]{"sdk_3rdappf", c(list)});
return arrayList;
}
return arrayList;
}
private static String b(Map<String, C0154a> map, List<b> list) {
String str = null;
for (Map.Entry<String, C0154a> entry : map.entrySet()) {
String b2 = b(entry.getValue().b);
if (b2 == null || !b2.endsWith("01") || (str != null && b2.compareTo(str) <= 0)) {
b2 = str;
}
str = b2;
}
for (b bVar : list) {
String b3 = b(bVar.b);
if (b3 != null && b3.endsWith("01") && (str == null || b3.compareTo(str) > 0)) {
str = b3;
}
}
return str;
}
private static String b(Map<String, String> map) {
String str = map.get("tm");
if (str == null || str.length() <= 10) {
return null;
}
return str.substring(0, 10);
}
private static void a(StringBuilder sb, String str, String str2) {
sb.append(str).append("=").append(str2).append("`");
}
public String a(String str, String[] strArr) {
Object[] g = g();
if (g == null) {
return null;
}
Map map = (Map) g[0];
List<b> list = (List) g[1];
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put(Body.CONST_CLIENT_UUID, str);
List<PackageInfo> b2 = b(this.b);
for (String[] strArr2 : b(b2)) {
jSONObject.put(strArr2[0], strArr2[1]);
}
strArr[0] = b(map, list);
for (String[] strArr3 : a(b2, strArr[0])) {
jSONObject.put(strArr3[0], strArr3[1]);
}
for (Map.Entry<String, Integer> entry : d.x.entrySet()) {
jSONObject.put(entry.getKey(), entry.getValue().intValue());
}
JSONArray jSONArray = new JSONArray();
for (Map.Entry entry2 : map.entrySet()) {
JSONObject jSONObject2 = new JSONObject();
for (Map.Entry<String, Integer> entry3 : ((C0154a) entry2.getValue()).f4502a.entrySet()) {
jSONObject2.put(entry3.getKey(), String.valueOf(entry3.getValue()));
}
for (Map.Entry<String, String> entry4 : ((C0154a) entry2.getValue()).b.entrySet()) {
jSONObject2.put(entry4.getKey(), entry4.getValue());
}
jSONArray.put(jSONObject2);
}
for (b bVar : list) {
JSONObject jSONObject3 = new JSONObject();
for (Map.Entry<String, String> entry5 : bVar.b.entrySet()) {
jSONObject3.put(entry5.getKey(), entry5.getValue());
}
jSONArray.put(jSONObject3);
}
jSONObject.put("items", jSONArray);
jSONObject.put("stat_size", String.valueOf(jSONObject.toString().length()));
return jSONObject.toString();
} catch (Exception e) {
Log.e("SDKWaStat", "getJsonUploadData", e);
return null;
}
}
public final void c() {
if (!d.f && d()) {
new Thread() {
@Override
public final void run() {
try {
a.this.e();
synchronized (a.this) {
SharedPreferences sharedPreferences = a.this.b.getSharedPreferences("UC_WA_STAT", 0);
long j = sharedPreferences.getLong("1", 0L);
if (Utils.sWAPrintLog) {
Log.d("SDKWaStat", "==handlUpload==last upload time:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(j)));
}
long currentTimeMillis = System.currentTimeMillis();
if (j != 0 && currentTimeMillis - j < 43200000) {
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(j);
int i = calendar.get(11);
calendar.setTimeInMillis(currentTimeMillis);
int i2 = calendar.get(11);
if ((i >= 0 && i < 12 && i2 >= 12) || (i >= 12 && i2 >= 0 && i2 < 12)) {
if (Utils.sWAPrintLog) {
Log.d("SDKWaStat", "跨0点或12点");
}
} else {
if (Utils.sWAPrintLog) {
Log.d("SDKWaStat", "时间间隔小于12小时,不上传");
}
return;
}
}
boolean z = false;
String[] strArr = {null};
if (j != 0) {
String a2 = a.a(a.this, sharedPreferences);
if (d.v != null) {
try {
String a3 = a.this.a(a2, strArr);
if (a3 != null) {
Log.i("SDKWaStat", a3);
d.v.onReceiveValue(a3);
z = true;
}
} catch (Exception e) {
Log.d("SDKWaStat", "第三方上传数据出错!", e);
}
} else {
byte[] a4 = a.a(a.this, strArr);
if (a4 != null) {
boolean z2 = false;
try {
a4 = com.uc.webview.export.internal.d.a.b.a(a4);
z2 = true;
if (Utils.sWAPrintLog) {
Log.d("SDKWaStat", "getUploadData encrypt:" + a4.length);
}
} catch (Exception e2) {
Log.e("SDKWaStat", "data encrypt error:", e2);
}
String valueOf = String.valueOf(System.currentTimeMillis());
String a5 = com.uc.webview.export.internal.d.a.b.a("27120f2b4115" + a2 + valueOf + "AppChk#2014");
StringBuilder sb = new StringBuilder("https://applog.uc.cn/collect?uc_param_str=&chk=");
sb.append(a5.substring(a5.length() - 8, a5.length())).append("&vno=").append(valueOf).append("&uuid=").append(a2).append("&app=").append("27120f2b4115");
if (z2) {
sb.append("&enc=aes");
}
String sb2 = sb.toString();
if (Utils.sWAPrintLog) {
Log.d("SDKWaStat", "request url:" + sb2);
}
int i3 = 3;
while (true) {
int i4 = i3 - 1;
if (i3 <= 0) {
break;
} else if (a.b(sb2, a4)) {
z = true;
break;
} else {
i3 = i4;
}
}
} else {
return;
}
}
}
if (z) {
new File(a.this.f(), "wa_upload_new.wa").delete();
a.a(a.this, currentTimeMillis, strArr[0]);
}
if (j == 0) {
Log.d("SDKWaStat", "首次不上传数据");
a.a(a.this, currentTimeMillis, strArr[0]);
}
}
} catch (Throwable th) {
Log.i("SDKWaStat", "handlUpload", th);
}
}
}.start();
}
}
public static boolean b(java.lang.String r9, byte[] r10) {
throw new UnsupportedOperationException("Method not decompiled: com.uc.webview.export.internal.d.a.a.b(java.lang.String, byte[]):boolean");
}
private static List<PackageInfo> b(Context context) {
return context.getPackageManager().getInstalledPackages(0);
}
private static String c(List<PackageInfo> list) {
long currentTimeMillis = System.currentTimeMillis();
HashSet hashSet = new HashSet(list.size());
for (PackageInfo packageInfo : list) {
hashSet.add(Integer.valueOf(packageInfo.packageName.hashCode()));
}
StringBuilder sb = new StringBuilder();
int[] iArr = {744792033, -796004189, 1536737232, -1864872766, -245593387, 559984781, 1254578009, 460049591, -103524201, -191341086, 2075805265, -860300598, 195266379, 851655498, -172581751, -1692253156, -1709882794, 978047406, -1447376190, 1085732649, 400412247, 1007750384, 321803898, 1319538838, -1459422248, -173313837, 1488133239, 551552610, 1310504938, 633261597, -548160304, 1971200218, 757982267, 996952171, 1855462465, 2049668591, -189253699, -761937585, -1102972298};
for (int i = 0; i < 39; i++) {
if (hashSet.contains(Integer.valueOf(iArr[i]))) {
sb.append("1");
} else {
sb.append("0");
}
}
Log.i("SDKWaStat", "getOtherAppInstallFlag用时:" + (System.currentTimeMillis() - currentTimeMillis) + " " + ((Object) sb));
return sb.toString();
}
}