what-the-bank/sources/com/huawei/hms/hatool/p0.java

100 lines
2.7 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.huawei.hms.hatool;
import java.util.Calendar;
import java.util.UUID;
/* loaded from: classes2.dex */
public class p0 {
private long a = 1800000;
private volatile boolean b = false;
private a c = null;
public boolean b() {
a aVar = this.c;
if (aVar != null) {
return aVar.b;
}
v.f("hmsSdk", "isFirstEvent(): session not prepared. onEvent() must be called first.");
return false;
}
/* loaded from: classes2.dex */
class a {
String a;
boolean b;
private long c;
final p0 d;
void a(long j) {
if (this.d.b) {
this.d.b = false;
b(j);
} else if (b(this.c, j) || a(this.c, j)) {
b(j);
} else {
this.c = j;
this.b = false;
}
}
private boolean b(long j, long j2) {
return j2 - j >= this.d.a;
}
private void b(long j) {
v.c("hmsSdk", "getNewSession() session is flush!");
String obj = UUID.randomUUID().toString();
this.a = obj;
this.a = obj.replace("-", "");
StringBuilder sb = new StringBuilder();
sb.append(this.a);
sb.append("_");
sb.append(j);
this.a = sb.toString();
this.c = j;
this.b = true;
}
private boolean a(long j, long j2) {
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(j);
Calendar calendar2 = Calendar.getInstance();
calendar2.setTimeInMillis(j2);
return (calendar.get(1) == calendar2.get(1) && calendar.get(6) == calendar2.get(6)) ? false : true;
}
a(p0 p0Var, long j) {
this.d = p0Var;
this.a = UUID.randomUUID().toString().replace("-", "");
StringBuilder sb = new StringBuilder();
sb.append(this.a);
sb.append("_");
sb.append(j);
this.a = sb.toString();
this.c = j;
this.b = true;
p0Var.b = false;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public void a(long j) {
a aVar = this.c;
if (aVar != null) {
aVar.a(j);
} else {
v.c("hmsSdk", "Session is first flush");
this.c = new a(this, j);
}
}
public String a() {
a aVar = this.c;
if (aVar != null) {
return aVar.a;
}
v.f("hmsSdk", "getSessionName(): session not prepared. onEvent() must be called first.");
return "";
}
}