what-the-bank/sources/com/google/android/gms/common/api/internal/zap.java

130 lines
4.6 KiB
Java

package com.google.android.gms.common.api.internal;
import android.app.PendingIntent;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import java.util.concurrent.atomic.AtomicReference;
import o.ksw;
/* loaded from: classes.dex */
public abstract class zap extends LifecycleCallback implements DialogInterface.OnCancelListener {
protected volatile boolean zaa;
protected final AtomicReference<zam> zab;
protected final GoogleApiAvailability zac;
private final Handler zad;
/* JADX INFO: Access modifiers changed from: package-private */
public zap(LifecycleFragment lifecycleFragment, GoogleApiAvailability googleApiAvailability) {
super(lifecycleFragment);
this.zab = new AtomicReference<>(null);
this.zad = new com.google.android.gms.internal.base.zaq(Looper.getMainLooper());
this.zac = googleApiAvailability;
}
/* JADX INFO: Access modifiers changed from: private */
public final void zaa(ConnectionResult connectionResult, int i) {
this.zab.set(null);
zab(connectionResult, i);
}
/* JADX INFO: Access modifiers changed from: private */
public final void zad() {
this.zab.set(null);
zac();
}
@Override // com.google.android.gms.common.api.internal.LifecycleCallback
public final void onActivityResult(int i, int i2, Intent intent) {
zam zamVar = this.zab.get();
if (i != 1) {
if (i == 2) {
int isGooglePlayServicesAvailable = this.zac.isGooglePlayServicesAvailable(getActivity());
if (isGooglePlayServicesAvailable == 0) {
zad();
return;
} else {
if (zamVar == null) {
return;
}
if (zamVar.zab().getErrorCode() == 18 && isGooglePlayServicesAvailable == 18) {
return;
}
}
}
} else if (i2 == -1) {
zad();
return;
} else if (i2 == 0) {
if (zamVar == null) {
return;
}
zaa(new ConnectionResult(intent != null ? intent.getIntExtra("<<ResolutionFailureErrorDetail>>", 13) : 13, null, zamVar.zab().toString()), zae(zamVar));
return;
}
if (zamVar != null) {
zaa(zamVar.zab(), zamVar.zaa());
}
}
@Override // android.content.DialogInterface.OnCancelListener
public final void onCancel(DialogInterface dialogInterface) {
zaa(new ConnectionResult(13, null), zae(this.zab.get()));
}
@Override // com.google.android.gms.common.api.internal.LifecycleCallback
public final void onCreate(Bundle bundle) {
super.onCreate(bundle);
if (bundle != null) {
this.zab.set(bundle.getBoolean("resolving_error", false) ? new zam(new ConnectionResult(bundle.getInt("failed_status"), (PendingIntent) bundle.getParcelable("failed_resolution")), bundle.getInt("failed_client_id", -1)) : null);
}
}
@Override // com.google.android.gms.common.api.internal.LifecycleCallback
public final void onSaveInstanceState(Bundle bundle) {
super.onSaveInstanceState(bundle);
zam zamVar = this.zab.get();
if (zamVar == null) {
return;
}
bundle.putBoolean("resolving_error", true);
bundle.putInt("failed_client_id", zamVar.zaa());
bundle.putInt("failed_status", zamVar.zab().getErrorCode());
bundle.putParcelable("failed_resolution", zamVar.zab().getResolution());
}
@Override // com.google.android.gms.common.api.internal.LifecycleCallback
public void onStart() {
super.onStart();
this.zaa = true;
}
@Override // com.google.android.gms.common.api.internal.LifecycleCallback
public void onStop() {
super.onStop();
this.zaa = false;
}
protected abstract void zab(ConnectionResult connectionResult, int i);
protected abstract void zac();
public final void zah(ConnectionResult connectionResult, int i) {
zam zamVar = new zam(connectionResult, i);
if (ksw.a(this.zab, null, zamVar)) {
this.zad.post(new zao(this, zamVar));
}
}
private static final int zae(zam zamVar) {
if (zamVar == null) {
return -1;
}
return zamVar.zaa();
}
}