整点视频 v3.3.0版本的 MD5 值为:cba0457dc37421eed445b30f92de25d3
以下内容为反编译后的 tk.java 源代码,内容仅作参考
package armadillo;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import com.bytedance.android.live.base.api.push.model.PushUIConfig;
import com.bytedance.sdk.openadsdk.TTAdConstant;
import com.ss.android.socialbase.downloader.constants.DBDefinition;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public final class tk {
public Context a;
public long b;
public int c;
public boolean d;
public class a implements gn {
public List a;
public a(List list) {
this.a = list;
}
@Override
public final void a(boolean z) {
if (z) {
kn.c("[UserInfo] Successfully uploaded user info.", new Object[0]);
long currentTimeMillis = System.currentTimeMillis();
for (sk skVar : this.a) {
skVar.g = currentTimeMillis;
tk.a(tk.this, skVar, true);
}
}
}
}
public class b implements Runnable {
public b() {
}
@Override
public final void run() {
try {
tk.this.c();
} catch (Throwable th) {
kn.a(th);
}
}
}
public class c implements Runnable {
public boolean b;
public sk c;
public c(sk skVar, boolean z) {
this.c = skVar;
this.b = z;
}
@Override
public final void run() {
xk D;
try {
if (this.c != null) {
sk skVar = this.c;
if (skVar != null && (D = xk.D()) != null) {
skVar.k = D.j();
}
kn.c("[UserInfo] Record user info.", new Object[0]);
tk.a(tk.this, this.c, false);
}
if (this.b) {
tk tkVar = tk.this;
jn b = jn.b();
if (b != null) {
b.a(new b());
}
}
} catch (Throwable th) {
if (kn.a(th)) {
return;
}
th.printStackTrace();
}
}
}
public class d implements Runnable {
public d() {
}
@Override
public final void run() {
long currentTimeMillis = System.currentTimeMillis();
tk tkVar = tk.this;
if (currentTimeMillis < tkVar.b) {
jn.b().a(new d(), (tk.this.b - currentTimeMillis) + PushUIConfig.dismissTime);
return;
}
tkVar.a(3, false, 0L);
tk.this.a();
}
}
public class e implements Runnable {
public long b;
public e(long j) {
this.b = 21600000L;
this.b = j;
}
@Override
public final void run() {
tk tkVar = tk.this;
jn b = jn.b();
if (b != null) {
b.a(new b());
}
tk tkVar2 = tk.this;
long j = this.b;
jn.b().a(new e(j), j);
}
}
public tk(Context context, boolean z) {
this.d = true;
this.a = context;
this.d = z;
}
public static void a(tk tkVar, sk skVar, boolean z) {
ContentValues contentValues;
List<sk> a2;
if (skVar != null) {
if (!z && skVar.c != 1 && (a2 = tkVar.a(xk.a(tkVar.a).e)) != null && a2.size() >= 20) {
kn.a("[UserInfo] There are too many user info in local: %d", Integer.valueOf(a2.size()));
return;
}
try {
contentValues = new ContentValues();
long j = skVar.b;
if (j > 0) {
contentValues.put(DBDefinition.ID, Long.valueOf(j));
}
contentValues.put("_tm", Long.valueOf(skVar.f));
contentValues.put("_ut", Long.valueOf(skVar.g));
contentValues.put("_tp", Integer.valueOf(skVar.c));
contentValues.put("_pc", skVar.d);
contentValues.put("_dt", mn.a(skVar));
} catch (Throwable th) {
if (!kn.a(th)) {
th.printStackTrace();
}
contentValues = null;
}
long a3 = cn.a().a("t_ui", contentValues, (bn) null);
if (a3 >= 0) {
kn.c("[Database] insert %s success with ID: %d", "t_ui", Long.valueOf(a3));
skVar.b = a3;
}
}
}
public static void a(List<sk> list) {
if (list == null || list.size() == 0) {
return;
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < list.size() && i < 50; i++) {
sb.append(" or _id");
sb.append(" = ");
sb.append(list.get(i).b);
}
String sb2 = sb.toString();
if (sb2.length() > 0) {
sb2 = sb2.substring(4);
}
sb.setLength(0);
try {
kn.c("[Database] deleted %s data %d", "t_ui", Integer.valueOf(cn.a().a("t_ui", sb2, (String[]) null, (bn) null)));
} catch (Throwable th) {
if (kn.a(th)) {
return;
}
th.printStackTrace();
}
}
public final List<sk> a(String str) {
Cursor cursor;
String str2;
sk skVar;
try {
if (mn.a(str)) {
str2 = null;
} else {
str2 = "_pc = '" + str + "'";
}
cursor = cn.a().a("t_ui", null, str2, null, null, true);
if (cursor == null) {
return null;
}
try {
StringBuilder sb = new StringBuilder();
ArrayList arrayList = new ArrayList();
while (cursor.moveToNext()) {
byte[] blob = cursor.getBlob(cursor.getColumnIndex("_dt"));
if (blob == null) {
skVar = null;
} else {
long j = cursor.getLong(cursor.getColumnIndex(DBDefinition.ID));
skVar = (sk) mn.a(blob, sk.CREATOR);
if (skVar != null) {
skVar.b = j;
}
}
if (skVar != null) {
arrayList.add(skVar);
} else {
long j2 = cursor.getLong(cursor.getColumnIndex(DBDefinition.ID));
sb.append(" or _id");
sb.append(" = ");
sb.append(j2);
}
}
String sb2 = sb.toString();
if (sb2.length() > 0) {
kn.d("[Database] deleted %s error data %d", "t_ui", Integer.valueOf(cn.a().a("t_ui", sb2.substring(4), (String[]) null, (bn) null)));
}
cursor.close();
return arrayList;
} catch (Throwable th) {
th = th;
try {
if (!kn.a(th)) {
th.printStackTrace();
}
if (cursor != null) {
cursor.close();
}
return null;
} finally {
if (cursor != null) {
cursor.close();
}
}
}
} catch (Throwable th2) {
th = th2;
cursor = null;
}
}
public final void a() {
this.b = mn.b() + 86400000;
jn.b().a(new d(), (this.b - System.currentTimeMillis()) + PushUIConfig.dismissTime);
}
public final void a(int i, boolean z, long j) {
bl c2 = bl.c();
if (c2 != null && !c2.b().e && i != 1 && i != 3) {
kn.e("UserInfo is disable", new Object[0]);
return;
}
if (i == 1 || i == 3) {
this.c++;
}
xk a2 = xk.a(this.a);
sk skVar = new sk();
skVar.c = i;
skVar.d = a2.e;
skVar.e = a2.l();
skVar.f = System.currentTimeMillis();
skVar.g = -1L;
skVar.o = a2.B;
skVar.p = i != 1 ? 0 : 1;
skVar.m = a2.R;
skVar.n = a2.S;
skVar.h = a2.T;
skVar.i = a2.U;
skVar.j = a2.V;
skVar.l = a2.W;
skVar.s = a2.a();
skVar.t = a2.c();
skVar.q = a2.d();
skVar.r = a2.N;
jn.b().a(new c(skVar, z), 0L);
}
public final void b() {
jn b2 = jn.b();
if (b2 != null) {
b2.a(new b());
}
}
public final synchronized void c() {
boolean z;
mm a2;
int i;
if (this.d) {
hn d2 = hn.d();
if (d2 == null) {
return;
}
bl c2 = bl.c();
if (c2 == null) {
return;
}
if (!c2.a() || d2.b(1001)) {
String str = xk.a(this.a).e;
ArrayList arrayList = new ArrayList();
List<sk> a3 = a(str);
if (a3 != null) {
int size = a3.size() - 20;
if (size > 0) {
int i2 = 0;
while (i2 < a3.size() - 1) {
int i3 = i2 + 1;
for (int i4 = i3; i4 < a3.size(); i4++) {
if (a3.get(i2).f > a3.get(i4).f) {
a3.set(i2, a3.get(i4));
a3.set(i4, a3.get(i2));
}
}
i2 = i3;
}
for (int i5 = 0; i5 < size; i5++) {
arrayList.add(a3.get(i5));
}
}
Iterator<sk> it = a3.iterator();
int i6 = 0;
while (it.hasNext()) {
sk next = it.next();
if (next.g != -1) {
it.remove();
if (next.f < mn.b()) {
arrayList.add(next);
}
}
if (next.f > System.currentTimeMillis() - TTAdConstant.AD_MAX_EVENT_TIME && ((i = next.c) == 1 || i == 4 || i == 3)) {
i6++;
}
}
if (i6 > 15) {
kn.d("[UserInfo] Upload user info too many times in 10 min: %d", Integer.valueOf(i6));
z = false;
if (arrayList.size() > 0) {
a(arrayList);
}
if (z && a3.size() != 0) {
kn.c("[UserInfo] Upload user info(size: %d)", Integer.valueOf(a3.size()));
a2 = sl.a(a3, this.c != 1 ? 1 : 2);
if (a2 != null) {
kn.d("[UserInfo] Failed to create UserInfoPackage.", new Object[0]);
return;
}
byte[] a4 = sl.a((wm) a2);
if (a4 == null) {
kn.d("[UserInfo] Failed to encode data.", new Object[0]);
return;
}
hm a5 = sl.a(this.a, d2.s ? 840 : 640, a4);
if (a5 == null) {
kn.d("[UserInfo] Request package is null.", new Object[0]);
return;
}
a aVar = new a(a3);
zk b2 = bl.c().b();
hn.d().a(1001, a5, d2.s ? b2.o : b2.q, d2.s ? zk.w : "http://rqd.uu.qq.com/rqd/sync", aVar, this.c == 1);
return;
}
kn.c("[UserInfo] There is no user info in local database.", new Object[0]);
}
} else {
a3 = new ArrayList<>();
}
z = true;
if (arrayList.size() > 0) {
}
if (z) {
kn.c("[UserInfo] Upload user info(size: %d)", Integer.valueOf(a3.size()));
a2 = sl.a(a3, this.c != 1 ? 1 : 2);
if (a2 != null) {
}
}
kn.c("[UserInfo] There is no user info in local database.", new Object[0]);
}
}
}
}