Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
package com.google.firebase.heartbeatinfo;
import java.util.List;
/* loaded from: classes3.dex */
public final class AutoValue_HeartBeatResult extends HeartBeatResult {
public final List usedDates;
public final String userAgent;
@Override // com.google.firebase.heartbeatinfo.HeartBeatResult
public List getUsedDates() {
return this.usedDates;
}
@Override // com.google.firebase.heartbeatinfo.HeartBeatResult
public String getUserAgent() {
return this.userAgent;
}
public AutoValue_HeartBeatResult(String str, List list) {
if (str == null) {
throw new NullPointerException("Null userAgent");
}
this.userAgent = str;
if (list == null) {
throw new NullPointerException("Null usedDates");
}
this.usedDates = list;
}
public String toString() {
return "HeartBeatResult{userAgent=" + this.userAgent + ", usedDates=" + this.usedDates + "}";
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof HeartBeatResult)) {
return false;
}
HeartBeatResult heartBeatResult = (HeartBeatResult) obj;
return this.userAgent.equals(heartBeatResult.getUserAgent()) && this.usedDates.equals(heartBeatResult.getUsedDates());
}
public int hashCode() {
return ((this.userAgent.hashCode() ^ 1000003) * 1000003) ^ this.usedDates.hashCode();
}
}

View File

@@ -0,0 +1,162 @@
package com.google.firebase.heartbeatinfo;
import android.content.Context;
import android.util.Base64OutputStream;
import androidx.core.os.UserManagerCompat;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.Tasks;
import com.google.firebase.FirebaseApp;
import com.google.firebase.annotations.concurrent.Background;
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.components.Qualified;
import com.google.firebase.heartbeatinfo.HeartBeatInfo;
import com.google.firebase.inject.Provider;
import com.google.firebase.platforminfo.UserAgentPublisher;
import java.io.ByteArrayOutputStream;
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.zip.GZIPOutputStream;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes3.dex */
public class DefaultHeartBeatController implements HeartBeatController, HeartBeatInfo {
public final Context applicationContext;
public final Executor backgroundExecutor;
public final Set consumers;
public final Provider storageProvider;
public final Provider userAgentProvider;
public Task registerHeartBeat() {
if (this.consumers.size() <= 0) {
return Tasks.forResult(null);
}
if (!UserManagerCompat.isUserUnlocked(this.applicationContext)) {
return Tasks.forResult(null);
}
return Tasks.call(this.backgroundExecutor, new Callable() { // from class: com.google.firebase.heartbeatinfo.DefaultHeartBeatController$$ExternalSyntheticLambda2
@Override // java.util.concurrent.Callable
public final Object call() {
Void lambda$registerHeartBeat$0;
lambda$registerHeartBeat$0 = DefaultHeartBeatController.this.lambda$registerHeartBeat$0();
return lambda$registerHeartBeat$0;
}
});
}
public final /* synthetic */ Void lambda$registerHeartBeat$0() {
synchronized (this) {
((HeartBeatInfoStorage) this.storageProvider.get()).storeHeartBeat(System.currentTimeMillis(), ((UserAgentPublisher) this.userAgentProvider.get()).getUserAgent());
}
return null;
}
@Override // com.google.firebase.heartbeatinfo.HeartBeatController
public Task getHeartBeatsHeader() {
if (!UserManagerCompat.isUserUnlocked(this.applicationContext)) {
return Tasks.forResult("");
}
return Tasks.call(this.backgroundExecutor, new Callable() { // from class: com.google.firebase.heartbeatinfo.DefaultHeartBeatController$$ExternalSyntheticLambda1
@Override // java.util.concurrent.Callable
public final Object call() {
String lambda$getHeartBeatsHeader$1;
lambda$getHeartBeatsHeader$1 = DefaultHeartBeatController.this.lambda$getHeartBeatsHeader$1();
return lambda$getHeartBeatsHeader$1;
}
});
}
public final /* synthetic */ String lambda$getHeartBeatsHeader$1() {
String byteArrayOutputStream;
synchronized (this) {
try {
HeartBeatInfoStorage heartBeatInfoStorage = (HeartBeatInfoStorage) this.storageProvider.get();
List allHeartBeats = heartBeatInfoStorage.getAllHeartBeats();
heartBeatInfoStorage.deleteAllHeartBeats();
JSONArray jSONArray = new JSONArray();
for (int i = 0; i < allHeartBeats.size(); i++) {
HeartBeatResult 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);
jSONObject2.put("version", "2");
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 {
}
} catch (Throwable th) {
throw th;
}
}
return byteArrayOutputStream;
}
public DefaultHeartBeatController(final Context context, final String str, Set set, Provider provider, Executor executor) {
this(new Provider() { // from class: com.google.firebase.heartbeatinfo.DefaultHeartBeatController$$ExternalSyntheticLambda3
@Override // com.google.firebase.inject.Provider
public final Object get() {
HeartBeatInfoStorage lambda$new$2;
lambda$new$2 = DefaultHeartBeatController.lambda$new$2(context, str);
return lambda$new$2;
}
}, set, executor, provider, context);
}
public static /* synthetic */ HeartBeatInfoStorage lambda$new$2(Context context, String str) {
return new HeartBeatInfoStorage(context, str);
}
public DefaultHeartBeatController(Provider provider, Set set, Executor executor, Provider provider2, Context context) {
this.storageProvider = provider;
this.consumers = set;
this.backgroundExecutor = executor;
this.userAgentProvider = provider2;
this.applicationContext = context;
}
public static Component component() {
final Qualified qualified = Qualified.qualified(Background.class, Executor.class);
return 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)).add(Dependency.required(qualified)).factory(new ComponentFactory() { // from class: com.google.firebase.heartbeatinfo.DefaultHeartBeatController$$ExternalSyntheticLambda0
@Override // com.google.firebase.components.ComponentFactory
public final Object create(ComponentContainer componentContainer) {
DefaultHeartBeatController lambda$component$3;
lambda$component$3 = DefaultHeartBeatController.lambda$component$3(Qualified.this, componentContainer);
return lambda$component$3;
}
}).build();
}
public static /* synthetic */ DefaultHeartBeatController lambda$component$3(Qualified qualified, ComponentContainer componentContainer) {
return new DefaultHeartBeatController((Context) componentContainer.get(Context.class), ((FirebaseApp) componentContainer.get(FirebaseApp.class)).getPersistenceKey(), componentContainer.setOf(HeartBeatConsumer.class), componentContainer.getProvider(UserAgentPublisher.class), (Executor) componentContainer.get(qualified));
}
@Override // com.google.firebase.heartbeatinfo.HeartBeatInfo
public synchronized HeartBeatInfo.HeartBeat getHeartBeatCode(String str) {
long currentTimeMillis = System.currentTimeMillis();
HeartBeatInfoStorage heartBeatInfoStorage = (HeartBeatInfoStorage) this.storageProvider.get();
if (heartBeatInfoStorage.shouldSendGlobalHeartBeat(currentTimeMillis)) {
heartBeatInfoStorage.postHeartBeatCleanUp();
return HeartBeatInfo.HeartBeat.GLOBAL;
}
return HeartBeatInfo.HeartBeat.NONE;
}
}

View File

@@ -0,0 +1,5 @@
package com.google.firebase.heartbeatinfo;
/* loaded from: classes3.dex */
public interface HeartBeatConsumer {
}

View File

@@ -0,0 +1,11 @@
package com.google.firebase.heartbeatinfo;
import com.google.firebase.components.Component;
/* loaded from: classes3.dex */
public abstract class HeartBeatConsumerComponent {
public static Component create() {
return Component.intoSet(new HeartBeatConsumer() { // from class: com.google.firebase.heartbeatinfo.HeartBeatConsumerComponent.1
}, HeartBeatConsumer.class);
}
}

View File

@@ -0,0 +1,8 @@
package com.google.firebase.heartbeatinfo;
import com.google.android.gms.tasks.Task;
/* loaded from: classes3.dex */
public interface HeartBeatController {
Task getHeartBeatsHeader();
}

View File

@@ -0,0 +1,23 @@
package com.google.firebase.heartbeatinfo;
/* loaded from: classes3.dex */
public interface HeartBeatInfo {
HeartBeat getHeartBeatCode(String str);
public enum HeartBeat {
NONE(0),
SDK(1),
GLOBAL(2),
COMBINED(3);
private final int code;
public int getCode() {
return this.code;
}
HeartBeat(int i) {
this.code = i;
}
}
}

View File

@@ -0,0 +1,191 @@
package com.google.firebase.heartbeatinfo;
import android.content.Context;
import android.content.SharedPreferences;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
/* loaded from: classes3.dex */
public class HeartBeatInfoStorage {
public final SharedPreferences firebaseSharedPreferences;
public HeartBeatInfoStorage(Context context, String str) {
this.firebaseSharedPreferences = context.getSharedPreferences("FirebaseHeartBeat" + str, 0);
}
public synchronized void deleteAllHeartBeats() {
try {
SharedPreferences.Editor edit = this.firebaseSharedPreferences.edit();
int i = 0;
for (Map.Entry<String, ?> entry : this.firebaseSharedPreferences.getAll().entrySet()) {
if (entry.getValue() instanceof Set) {
Set set = (Set) entry.getValue();
String formattedDate = getFormattedDate(System.currentTimeMillis());
String key = entry.getKey();
if (set.contains(formattedDate)) {
HashSet hashSet = new HashSet();
hashSet.add(formattedDate);
i++;
edit.putStringSet(key, hashSet);
} else {
edit.remove(key);
}
}
}
if (i == 0) {
edit.remove("fire-count");
} else {
edit.putLong("fire-count", i);
}
edit.commit();
} catch (Throwable th) {
throw th;
}
}
public synchronized List getAllHeartBeats() {
ArrayList arrayList;
try {
arrayList = new ArrayList();
for (Map.Entry<String, ?> entry : this.firebaseSharedPreferences.getAll().entrySet()) {
if (entry.getValue() instanceof Set) {
HashSet hashSet = new HashSet((Set) entry.getValue());
hashSet.remove(getFormattedDate(System.currentTimeMillis()));
if (!hashSet.isEmpty()) {
arrayList.add(HeartBeatResult.create(entry.getKey(), new ArrayList(hashSet)));
}
}
}
updateGlobalHeartBeat(System.currentTimeMillis());
} catch (Throwable th) {
throw th;
}
return arrayList;
}
public final synchronized String getStoredUserAgentString(String str) {
for (Map.Entry<String, ?> entry : this.firebaseSharedPreferences.getAll().entrySet()) {
if (entry.getValue() instanceof Set) {
Iterator it = ((Set) entry.getValue()).iterator();
while (it.hasNext()) {
if (str.equals((String) it.next())) {
return entry.getKey();
}
}
}
}
return null;
}
public final synchronized void updateStoredUserAgent(String str, String str2) {
removeStoredDate(str2);
HashSet hashSet = new HashSet(this.firebaseSharedPreferences.getStringSet(str, new HashSet()));
hashSet.add(str2);
this.firebaseSharedPreferences.edit().putStringSet(str, hashSet).commit();
}
public final synchronized void removeStoredDate(String str) {
try {
String storedUserAgentString = getStoredUserAgentString(str);
if (storedUserAgentString == null) {
return;
}
HashSet hashSet = new HashSet(this.firebaseSharedPreferences.getStringSet(storedUserAgentString, new HashSet()));
hashSet.remove(str);
if (hashSet.isEmpty()) {
this.firebaseSharedPreferences.edit().remove(storedUserAgentString).commit();
} else {
this.firebaseSharedPreferences.edit().putStringSet(storedUserAgentString, hashSet).commit();
}
} catch (Throwable th) {
throw th;
}
}
public synchronized void postHeartBeatCleanUp() {
String formattedDate = getFormattedDate(System.currentTimeMillis());
this.firebaseSharedPreferences.edit().putString("last-used-date", formattedDate).commit();
removeStoredDate(formattedDate);
}
public final synchronized String getFormattedDate(long j) {
return new Date(j).toInstant().atOffset(ZoneOffset.UTC).toLocalDateTime().format(DateTimeFormatter.ISO_LOCAL_DATE);
}
public synchronized void storeHeartBeat(long j, String str) {
String formattedDate = getFormattedDate(j);
if (this.firebaseSharedPreferences.getString("last-used-date", "").equals(formattedDate)) {
String storedUserAgentString = getStoredUserAgentString(formattedDate);
if (storedUserAgentString == null) {
return;
}
if (storedUserAgentString.equals(str)) {
return;
}
updateStoredUserAgent(str, formattedDate);
return;
}
long j2 = this.firebaseSharedPreferences.getLong("fire-count", 0L);
if (j2 + 1 == 30) {
cleanUpStoredHeartBeats();
j2 = this.firebaseSharedPreferences.getLong("fire-count", 0L);
}
HashSet hashSet = new HashSet(this.firebaseSharedPreferences.getStringSet(str, new HashSet()));
hashSet.add(formattedDate);
this.firebaseSharedPreferences.edit().putStringSet(str, hashSet).putLong("fire-count", j2 + 1).putString("last-used-date", formattedDate).commit();
}
public final synchronized void cleanUpStoredHeartBeats() {
try {
long j = this.firebaseSharedPreferences.getLong("fire-count", 0L);
String str = "";
String str2 = null;
for (Map.Entry<String, ?> entry : this.firebaseSharedPreferences.getAll().entrySet()) {
if (entry.getValue() instanceof Set) {
for (String str3 : (Set) entry.getValue()) {
if (str2 != null && str2.compareTo(str3) <= 0) {
}
str = entry.getKey();
str2 = str3;
}
}
}
HashSet hashSet = new HashSet(this.firebaseSharedPreferences.getStringSet(str, new HashSet()));
hashSet.remove(str2);
this.firebaseSharedPreferences.edit().putStringSet(str, hashSet).putLong("fire-count", j - 1).commit();
} catch (Throwable th) {
throw th;
}
}
public synchronized void updateGlobalHeartBeat(long j) {
this.firebaseSharedPreferences.edit().putLong("fire-global", j).commit();
}
public synchronized boolean isSameDateUtc(long j, long j2) {
return getFormattedDate(j).equals(getFormattedDate(j2));
}
public synchronized boolean shouldSendSdkHeartBeat(String str, long j) {
if (this.firebaseSharedPreferences.contains(str)) {
if (isSameDateUtc(this.firebaseSharedPreferences.getLong(str, -1L), j)) {
return false;
}
this.firebaseSharedPreferences.edit().putLong(str, j).commit();
return true;
}
this.firebaseSharedPreferences.edit().putLong(str, j).commit();
return true;
}
public synchronized boolean shouldSendGlobalHeartBeat(long j) {
return shouldSendSdkHeartBeat("fire-global", j);
}
}

View File

@@ -0,0 +1,14 @@
package com.google.firebase.heartbeatinfo;
import java.util.List;
/* loaded from: classes3.dex */
public abstract class HeartBeatResult {
public abstract List getUsedDates();
public abstract String getUserAgent();
public static HeartBeatResult create(String str, List list) {
return new AutoValue_HeartBeatResult(str, list);
}
}