402 lines
18 KiB
Java
402 lines
18 KiB
Java
package com.google.firebase.heartbeatinfo;
|
|
|
|
import android.content.Context;
|
|
import android.os.Process;
|
|
import android.os.SystemClock;
|
|
import android.text.TextUtils;
|
|
import android.util.Base64OutputStream;
|
|
import android.view.ViewConfiguration;
|
|
import com.google.android.gms.tasks.Task;
|
|
import com.google.android.gms.tasks.Tasks;
|
|
import com.google.common.base.Ascii;
|
|
import com.google.firebase.FirebaseApp;
|
|
import com.google.firebase.components.Component;
|
|
import com.google.firebase.components.ComponentContainer;
|
|
import com.google.firebase.components.ComponentFactory;
|
|
import com.google.firebase.components.Dependency;
|
|
import com.google.firebase.heartbeatinfo.HeartBeatInfo;
|
|
import com.google.firebase.inject.Provider;
|
|
import com.google.firebase.platforminfo.UserAgentPublisher;
|
|
import com.pingan.ai.p;
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.lang.reflect.Method;
|
|
import java.util.Collection;
|
|
import java.util.List;
|
|
import java.util.Set;
|
|
import java.util.concurrent.Callable;
|
|
import java.util.concurrent.Executor;
|
|
import java.util.concurrent.LinkedBlockingQueue;
|
|
import java.util.concurrent.ThreadFactory;
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.zip.GZIPOutputStream;
|
|
import o.Nhs;
|
|
import o.VMo;
|
|
import o.xzZ;
|
|
import org.bouncycastle.crypto.tls.CipherSuite;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class DefaultHeartBeatController implements HeartBeatController, HeartBeatInfo {
|
|
private static final ThreadFactory THREAD_FACTORY;
|
|
private static char a;
|
|
private static int b;
|
|
private static long c;
|
|
private static int d;
|
|
private final Context applicationContext;
|
|
private final Executor backgroundExecutor;
|
|
private final Set<HeartBeatConsumer> consumers;
|
|
private final Provider<HeartBeatInfoStorage> storageProvider;
|
|
private final Provider<UserAgentPublisher> userAgentProvider;
|
|
private static final byte[] $$a = {Ascii.CAN, -103, 8, 6};
|
|
private static final int $$b = CipherSuite.TLS_PSK_WITH_AES_256_GCM_SHA384;
|
|
private static int $10 = 0;
|
|
private static int $11 = 1;
|
|
private static int e = 1;
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:10:0x0025 */
|
|
/* JADX WARN: Removed duplicated region for block: B:7:0x001d */
|
|
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:10:0x0025 -> B:4:0x002c). Please report as a decompilation issue!!! */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
private static void g(int r6, short r7, short r8, java.lang.Object[] r9) {
|
|
/*
|
|
int r6 = r6 + 4
|
|
int r8 = 115 - r8
|
|
byte[] r0 = com.google.firebase.heartbeatinfo.DefaultHeartBeatController.$$a
|
|
int r7 = r7 * 4
|
|
int r7 = 1 - r7
|
|
byte[] r1 = new byte[r7]
|
|
r2 = 0
|
|
if (r0 != 0) goto L13
|
|
r3 = r8
|
|
r4 = r2
|
|
r8 = r6
|
|
goto L2c
|
|
L13:
|
|
r3 = r2
|
|
L14:
|
|
byte r4 = (byte) r8
|
|
r1[r3] = r4
|
|
int r3 = r3 + 1
|
|
int r6 = r6 + 1
|
|
if (r3 != r7) goto L25
|
|
java.lang.String r6 = new java.lang.String
|
|
r6.<init>(r1, r2)
|
|
r9[r2] = r6
|
|
return
|
|
L25:
|
|
r4 = r0[r6]
|
|
r5 = r8
|
|
r8 = r6
|
|
r6 = r4
|
|
r4 = r3
|
|
r3 = r5
|
|
L2c:
|
|
int r6 = r6 + r3
|
|
r3 = r4
|
|
r5 = r8
|
|
r8 = r6
|
|
r6 = r5
|
|
goto L14
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.google.firebase.heartbeatinfo.DefaultHeartBeatController.g(int, short, short, java.lang.Object[]):void");
|
|
}
|
|
|
|
static {
|
|
b = 0;
|
|
e();
|
|
THREAD_FACTORY = new ThreadFactory() { // from class: com.google.firebase.heartbeatinfo.DefaultHeartBeatController$$ExternalSyntheticLambda0
|
|
@Override // java.util.concurrent.ThreadFactory
|
|
public final Thread newThread(Runnable runnable) {
|
|
return DefaultHeartBeatController.lambda$static$0(runnable);
|
|
}
|
|
};
|
|
int i = e + 83;
|
|
b = i % 128;
|
|
if (i % 2 == 0) {
|
|
return;
|
|
}
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static /* synthetic */ Thread lambda$static$0(Runnable runnable) {
|
|
int i = 2 % 2;
|
|
Thread thread = new Thread(runnable, "heartbeat-information-executor");
|
|
int i2 = e + 85;
|
|
b = i2 % 128;
|
|
if (i2 % 2 == 0) {
|
|
return thread;
|
|
}
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
public Task<Void> registerHeartBeat() {
|
|
int i = 2 % 2;
|
|
if (this.consumers.size() <= 0) {
|
|
Task<Void> forResult = Tasks.forResult(null);
|
|
int i2 = e + 9;
|
|
b = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
return forResult;
|
|
}
|
|
if (!VMo.d(this.applicationContext)) {
|
|
return Tasks.forResult(null);
|
|
}
|
|
Task<Void> call = Tasks.call(this.backgroundExecutor, new Callable(this) { // from class: com.google.firebase.heartbeatinfo.DefaultHeartBeatController$$ExternalSyntheticLambda2
|
|
public final DefaultHeartBeatController f$0;
|
|
|
|
@Override // java.util.concurrent.Callable
|
|
public final Object call() {
|
|
return this.f$0.m260x785c653();
|
|
}
|
|
|
|
{
|
|
this.f$0 = this;
|
|
}
|
|
});
|
|
int i4 = b + 87;
|
|
e = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
return call;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* renamed from: lambda$registerHeartBeat$1$com-google-firebase-heartbeatinfo-DefaultHeartBeatController, reason: not valid java name */
|
|
public /* synthetic */ Void m260x785c653() throws Exception {
|
|
synchronized (this) {
|
|
this.storageProvider.get().storeHeartBeat(System.currentTimeMillis(), this.userAgentProvider.get().getUserAgent());
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override // com.google.firebase.heartbeatinfo.HeartBeatController
|
|
public Task<String> getHeartBeatsHeader() {
|
|
int i = 2 % 2;
|
|
int i2 = b + 97;
|
|
e = i2 % 128;
|
|
if (i2 % 2 != 0 ? (!VMo.d(this.applicationContext)) : VMo.d(this.applicationContext)) {
|
|
Task<String> forResult = Tasks.forResult("");
|
|
int i3 = e + 87;
|
|
b = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
return forResult;
|
|
}
|
|
return Tasks.call(this.backgroundExecutor, new Callable(this) { // from class: com.google.firebase.heartbeatinfo.DefaultHeartBeatController$$ExternalSyntheticLambda1
|
|
public final DefaultHeartBeatController f$0;
|
|
|
|
@Override // java.util.concurrent.Callable
|
|
public final Object call() {
|
|
return this.f$0.m259xc85c8491();
|
|
}
|
|
|
|
{
|
|
this.f$0 = this;
|
|
}
|
|
});
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* renamed from: lambda$getHeartBeatsHeader$2$com-google-firebase-heartbeatinfo-DefaultHeartBeatController, reason: not valid java name */
|
|
public /* synthetic */ String m259xc85c8491() throws Exception {
|
|
String byteArrayOutputStream;
|
|
synchronized (this) {
|
|
HeartBeatInfoStorage heartBeatInfoStorage = this.storageProvider.get();
|
|
List<HeartBeatResult> allHeartBeats = heartBeatInfoStorage.getAllHeartBeats();
|
|
heartBeatInfoStorage.deleteAllHeartBeats();
|
|
JSONArray jSONArray = new JSONArray();
|
|
for (int i = 0; i < allHeartBeats.size(); i++) {
|
|
HeartBeatResult heartBeatResult = allHeartBeats.get(i);
|
|
JSONObject jSONObject = new JSONObject();
|
|
jSONObject.put("agent", heartBeatResult.getUserAgent());
|
|
jSONObject.put("dates", new JSONArray((Collection) heartBeatResult.getUsedDates()));
|
|
jSONArray.put(jSONObject);
|
|
}
|
|
JSONObject jSONObject2 = new JSONObject();
|
|
jSONObject2.put("heartbeats", jSONArray);
|
|
Object[] objArr = new Object[1];
|
|
f((char) ((ViewConfiguration.getScrollBarSize() >> 8) + 38144), 838533883 + (ViewConfiguration.getScrollDefaultDelay() >> 16), new char[]{64484, 64258, '1', 21653}, new char[]{50392}, new char[]{0, 0, 0, 0}, objArr);
|
|
jSONObject2.put("version", ((String) objArr[0]).intern());
|
|
ByteArrayOutputStream byteArrayOutputStream2 = new ByteArrayOutputStream();
|
|
Base64OutputStream base64OutputStream = new Base64OutputStream(byteArrayOutputStream2, 11);
|
|
try {
|
|
GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(base64OutputStream);
|
|
try {
|
|
gZIPOutputStream.write(jSONObject2.toString().getBytes("UTF-8"));
|
|
gZIPOutputStream.close();
|
|
base64OutputStream.close();
|
|
byteArrayOutputStream = byteArrayOutputStream2.toString("UTF-8");
|
|
} finally {
|
|
}
|
|
} finally {
|
|
}
|
|
}
|
|
return byteArrayOutputStream;
|
|
}
|
|
|
|
private DefaultHeartBeatController(final Context context, final String str, Set<HeartBeatConsumer> set, Provider<UserAgentPublisher> provider) {
|
|
this(new Provider(context, str) { // from class: com.google.firebase.heartbeatinfo.DefaultHeartBeatController$$ExternalSyntheticLambda4
|
|
public final Context f$0;
|
|
public final String f$1;
|
|
|
|
@Override // com.google.firebase.inject.Provider
|
|
public final Object get() {
|
|
return DefaultHeartBeatController.lambda$new$3(this.f$0, this.f$1);
|
|
}
|
|
|
|
{
|
|
this.f$0 = context;
|
|
this.f$1 = str;
|
|
}
|
|
}, set, new ThreadPoolExecutor(0, 1, 30L, TimeUnit.SECONDS, new LinkedBlockingQueue(), THREAD_FACTORY), provider, context);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static /* synthetic */ HeartBeatInfoStorage lambda$new$3(Context context, String str) {
|
|
int i = 2 % 2;
|
|
HeartBeatInfoStorage heartBeatInfoStorage = new HeartBeatInfoStorage(context, str);
|
|
int i2 = e + 89;
|
|
b = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
return heartBeatInfoStorage;
|
|
}
|
|
|
|
private static void f(char c2, int i, char[] cArr, char[] cArr2, char[] cArr3, Object[] objArr) {
|
|
int i2 = 2;
|
|
int i3 = 2 % 2;
|
|
Nhs nhs = new Nhs();
|
|
int length = cArr.length;
|
|
char[] cArr4 = new char[length];
|
|
int length2 = cArr3.length;
|
|
char[] cArr5 = new char[length2];
|
|
System.arraycopy(cArr, 0, cArr4, 0, length);
|
|
System.arraycopy(cArr3, 0, cArr5, 0, length2);
|
|
cArr4[0] = (char) (cArr4[0] ^ c2);
|
|
cArr5[2] = (char) (cArr5[2] + ((char) i));
|
|
int length3 = cArr2.length;
|
|
char[] cArr6 = new char[length3];
|
|
nhs.a = 0;
|
|
while (nhs.a < length3) {
|
|
int i4 = $11 + 57;
|
|
$10 = i4 % 128;
|
|
int i5 = i4 % i2;
|
|
try {
|
|
Object[] objArr2 = {nhs};
|
|
Object obj = xzZ.y.get(263693715);
|
|
if (obj == null) {
|
|
obj = ((Class) xzZ.c(46 - (SystemClock.currentThreadTimeMillis() > (-1L) ? 1 : (SystemClock.currentThreadTimeMillis() == (-1L) ? 0 : -1)), 5 - (ViewConfiguration.getKeyRepeatDelay() >> 16), (char) (ViewConfiguration.getPressedStateDuration() >> 16))).getMethod("t", Object.class);
|
|
xzZ.y.put(263693715, obj);
|
|
}
|
|
int intValue = ((Integer) ((Method) obj).invoke(null, objArr2)).intValue();
|
|
Object[] objArr3 = {nhs};
|
|
Object obj2 = xzZ.y.get(-484664112);
|
|
if (obj2 == null) {
|
|
Class cls = (Class) xzZ.c(353 - (SystemClock.currentThreadTimeMillis() > (-1L) ? 1 : (SystemClock.currentThreadTimeMillis() == (-1L) ? 0 : -1)), 5 - (ViewConfiguration.getKeyRepeatTimeout() >> 16), (char) (TextUtils.getOffsetBefore("", 0) + 52128));
|
|
byte b2 = (byte) (-1);
|
|
byte b3 = (byte) (b2 + 1);
|
|
Object[] objArr4 = new Object[1];
|
|
g(b2, b3, b3, objArr4);
|
|
obj2 = cls.getMethod((String) objArr4[0], Object.class);
|
|
xzZ.y.put(-484664112, obj2);
|
|
}
|
|
int intValue2 = ((Integer) ((Method) obj2).invoke(null, objArr3)).intValue();
|
|
Object[] objArr5 = {nhs, Integer.valueOf(cArr4[nhs.a % 4] * 32718), Integer.valueOf(cArr5[intValue])};
|
|
Object obj3 = xzZ.y.get(430099516);
|
|
if (obj3 == null) {
|
|
obj3 = ((Class) xzZ.c(749 - (ViewConfiguration.getZoomControlsTimeout() > 0L ? 1 : (ViewConfiguration.getZoomControlsTimeout() == 0L ? 0 : -1)), 6 - (ViewConfiguration.getGlobalActionKeyTimeout() > 0L ? 1 : (ViewConfiguration.getGlobalActionKeyTimeout() == 0L ? 0 : -1)), (char) ((Process.getThreadPriority(0) + 20) >> 6))).getMethod(p.a, Object.class, Integer.TYPE, Integer.TYPE);
|
|
xzZ.y.put(430099516, obj3);
|
|
}
|
|
((Method) obj3).invoke(null, objArr5);
|
|
Object[] objArr6 = {Integer.valueOf(cArr4[intValue2] * 32718), Integer.valueOf(cArr5[intValue])};
|
|
Object obj4 = xzZ.y.get(1019894806);
|
|
if (obj4 == null) {
|
|
Class cls2 = (Class) xzZ.c(402 - (ViewConfiguration.getTouchSlop() >> 8), 4 - TextUtils.indexOf((CharSequence) "", '0', 0), (char) (21607 - TextUtils.indexOf((CharSequence) "", '0', 0)));
|
|
byte b4 = (byte) (-1);
|
|
byte b5 = (byte) (b4 + 1);
|
|
Object[] objArr7 = new Object[1];
|
|
g(b4, b5, (byte) (b5 + 1), objArr7);
|
|
obj4 = cls2.getMethod((String) objArr7[0], Integer.TYPE, Integer.TYPE);
|
|
xzZ.y.put(1019894806, obj4);
|
|
}
|
|
cArr5[intValue2] = ((Character) ((Method) obj4).invoke(null, objArr6)).charValue();
|
|
cArr4[intValue2] = nhs.c;
|
|
cArr6[nhs.a] = (char) ((((cArr4[intValue2] ^ cArr2[nhs.a]) ^ (c ^ 9051040786702654117L)) ^ ((int) (d ^ 9051040786702654117L))) ^ ((char) (a ^ 9051040786702654117L)));
|
|
nhs.a++;
|
|
i2 = 2;
|
|
} catch (Throwable th) {
|
|
Throwable cause = th.getCause();
|
|
if (cause == null) {
|
|
throw th;
|
|
}
|
|
throw cause;
|
|
}
|
|
}
|
|
String str = new String(cArr6);
|
|
int i6 = $10 + 99;
|
|
$11 = i6 % 128;
|
|
if (i6 % 2 == 0) {
|
|
throw null;
|
|
}
|
|
objArr[0] = str;
|
|
}
|
|
|
|
DefaultHeartBeatController(Provider<HeartBeatInfoStorage> provider, Set<HeartBeatConsumer> set, Executor executor, Provider<UserAgentPublisher> provider2, Context context) {
|
|
this.storageProvider = provider;
|
|
this.consumers = set;
|
|
this.backgroundExecutor = executor;
|
|
this.userAgentProvider = provider2;
|
|
this.applicationContext = context;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static /* synthetic */ DefaultHeartBeatController lambda$component$4(ComponentContainer componentContainer) {
|
|
int i = 2 % 2;
|
|
DefaultHeartBeatController defaultHeartBeatController = new DefaultHeartBeatController((Context) componentContainer.get(Context.class), ((FirebaseApp) componentContainer.get(FirebaseApp.class)).getPersistenceKey(), componentContainer.setOf(HeartBeatConsumer.class), componentContainer.getProvider(UserAgentPublisher.class));
|
|
int i2 = e + 115;
|
|
b = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
return defaultHeartBeatController;
|
|
}
|
|
|
|
public static Component<DefaultHeartBeatController> component() {
|
|
int i = 2 % 2;
|
|
Component<DefaultHeartBeatController> build = Component.builder(DefaultHeartBeatController.class, HeartBeatController.class, HeartBeatInfo.class).add(Dependency.required(Context.class)).add(Dependency.required(FirebaseApp.class)).add(Dependency.setOf(HeartBeatConsumer.class)).add(Dependency.requiredProvider(UserAgentPublisher.class)).factory(new ComponentFactory() { // from class: com.google.firebase.heartbeatinfo.DefaultHeartBeatController$$ExternalSyntheticLambda3
|
|
@Override // com.google.firebase.components.ComponentFactory
|
|
public final Object create(ComponentContainer componentContainer) {
|
|
return DefaultHeartBeatController.lambda$component$4(componentContainer);
|
|
}
|
|
}).build();
|
|
int i2 = b + 75;
|
|
e = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
return build;
|
|
}
|
|
|
|
@Override // com.google.firebase.heartbeatinfo.HeartBeatInfo
|
|
public HeartBeatInfo.HeartBeat getHeartBeatCode(String str) {
|
|
synchronized (this) {
|
|
long currentTimeMillis = System.currentTimeMillis();
|
|
HeartBeatInfoStorage heartBeatInfoStorage = this.storageProvider.get();
|
|
if (heartBeatInfoStorage.shouldSendGlobalHeartBeat(currentTimeMillis)) {
|
|
heartBeatInfoStorage.postHeartBeatCleanUp();
|
|
return HeartBeatInfo.HeartBeat.GLOBAL;
|
|
}
|
|
return HeartBeatInfo.HeartBeat.NONE;
|
|
}
|
|
}
|
|
|
|
static void e() {
|
|
c = 9051040786702654117L;
|
|
d = 452713125;
|
|
a = (char) 36736;
|
|
}
|
|
}
|