what-the-bank/sources/com/google/firebase/iid/zzbh.java

129 lines
4.5 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.google.firebase.iid;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.util.Log;
import com.google.android.gms.common.stats.ConnectionTracker;
import com.google.android.gms.common.util.concurrent.NamedThreadFactory;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/* loaded from: classes2.dex */
public final class zzbh implements ServiceConnection {
private final Context zza;
private final Intent zzb;
private final ScheduledExecutorService zzc;
private final Queue<zzbg> zzd;
private zzbc zze;
private boolean zzf;
public zzbh(Context context, String str) {
this(context, str, new ScheduledThreadPoolExecutor(0, new NamedThreadFactory("Firebase-FirebaseInstanceIdServiceConnection")));
}
private zzbh(Context context, String str, ScheduledExecutorService scheduledExecutorService) {
this.zzd = new ArrayDeque();
this.zzf = false;
Context applicationContext = context.getApplicationContext();
this.zza = applicationContext;
this.zzb = new Intent(str).setPackage(applicationContext.getPackageName());
this.zzc = scheduledExecutorService;
}
public final Task<Void> zza(Intent intent) {
Task<Void> zza;
synchronized (this) {
final zzbg zzbgVar = new zzbg(intent);
ScheduledExecutorService scheduledExecutorService = this.zzc;
final ScheduledFuture<?> schedule = scheduledExecutorService.schedule(new Runnable(zzbgVar) { // from class: com.google.firebase.iid.zzbj
private final zzbg zza;
@Override // java.lang.Runnable
public final void run() {
this.zza.zzc();
}
/* JADX INFO: Access modifiers changed from: package-private */
{
this.zza = zzbgVar;
}
}, 9000L, TimeUnit.MILLISECONDS);
zzbgVar.zza().addOnCompleteListener(scheduledExecutorService, new OnCompleteListener(schedule) { // from class: com.google.firebase.iid.zzbi
private final ScheduledFuture zza;
@Override // com.google.android.gms.tasks.OnCompleteListener
public final void onComplete(Task task) {
this.zza.cancel(false);
}
/* JADX INFO: Access modifiers changed from: package-private */
{
this.zza = schedule;
}
});
this.zzd.add(zzbgVar);
zza();
zza = zzbgVar.zza();
}
return zza;
}
private final void zza() {
synchronized (this) {
while (!this.zzd.isEmpty()) {
zzbc zzbcVar = this.zze;
if (zzbcVar != null && zzbcVar.isBinderAlive()) {
this.zze.zza(this.zzd.poll());
} else {
Log.isLoggable("FirebaseInstanceId", 3);
if (!this.zzf) {
this.zzf = true;
try {
if (ConnectionTracker.getInstance().bindService(this.zza, this.zzb, this, 65)) {
return;
}
} catch (SecurityException unused) {
}
this.zzf = false;
zzb();
}
return;
}
}
}
}
private final void zzb() {
while (!this.zzd.isEmpty()) {
this.zzd.poll().zzb();
}
}
@Override // android.content.ServiceConnection
public final void onServiceConnected(ComponentName componentName, IBinder iBinder) {
synchronized (this) {
this.zzf = false;
if (!(iBinder instanceof zzbc)) {
zzb();
} else {
this.zze = (zzbc) iBinder;
zza();
}
}
}
@Override // android.content.ServiceConnection
public final void onServiceDisconnected(ComponentName componentName) {
zza();
}
}