CrackMe.apk
Download file
package com.google.android.gms.common.api.internal;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import android.util.Pair;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.PendingResult;
import com.google.android.gms.common.api.Releasable;
import com.google.android.gms.common.api.Result;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.common.api.ResultTransform;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.common.api.TransformedResult;
import com.google.android.gms.common.internal.ICancelToken;
import com.google.android.gms.common.internal.Preconditions;
import com.google.android.gms.internal.base.zaq;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
/* compiled from: com.google.android.gms:play-services-base@@18.0.1 */
public abstract class BasePendingResult<R extends Result> extends PendingResult<R> {
static final ThreadLocal<Boolean> zaa = new zaq();
public static final /* synthetic */ int zad = 0;
private zas mResultGuardian;
protected final CallbackHandler<R> zab;
protected final WeakReference<GoogleApiClient> zac;
private final Object zae;
private final CountDownLatch zaf;
private final ArrayList<PendingResult.StatusListener> zag;
private ResultCallback<? super R> zah;
private final AtomicReference<zadb> zai;
/* access modifiers changed from: private */
public R zaj;
private Status zak;
private volatile boolean zal;
private boolean zam;
private boolean zan;
private ICancelToken zao;
private volatile zada<R> zap;
private boolean zaq;
@Deprecated
BasePendingResult() {
this.zae = new Object();
this.zaf = new CountDownLatch(1);
this.zag = new ArrayList<>();
this.zai = new AtomicReference<>();
this.zaq = false;
this.zab = new CallbackHandler<>(Looper.getMainLooper());
this.zac = new WeakReference<>((Object) null);
}
private final R zaa() {
R r;
synchronized (this.zae) {
Preconditions.checkState(!this.zal, "Result has already been consumed.");
Preconditions.checkState(isReady(), "Result is not ready.");
r = this.zaj;
this.zaj = null;
this.zah = null;
this.zal = true;
}
zadb andSet = this.zai.getAndSet((Object) null);
if (andSet != null) {
andSet.zaa.zab.remove(this);
}
return (Result) Preconditions.checkNotNull(r);
}
private final void zab(R r) {
this.zaj = r;
this.zak = r.getStatus();
this.zao = null;
this.zaf.countDown();
if (this.zam) {
this.zah = null;
} else {
ResultCallback<? super R> resultCallback = this.zah;
if (resultCallback != null) {
this.zab.removeMessages(2);
this.zab.zaa(resultCallback, zaa());
} else if (this.zaj instanceof Releasable) {
this.mResultGuardian = new zas(this, (zar) null);
}
}
ArrayList<PendingResult.StatusListener> arrayList = this.zag;
int size = arrayList.size();
for (int i = 0; i < size; i++) {
arrayList.get(i).onComplete(this.zak);
}
this.zag.clear();
}
public static void zal(Result result) {
if (result instanceof Releasable) {
try {
((Releasable) result).release();
} catch (RuntimeException e) {
String valueOf = String.valueOf(result);
String.valueOf(valueOf).length();
Log.w("BasePendingResult", "Unable to release ".concat(String.valueOf(valueOf)), e);
}
}
}
public final void addStatusListener(PendingResult.StatusListener statusListener) {
Preconditions.checkArgument(statusListener != null, "Callback cannot be null.");
synchronized (this.zae) {
if (isReady()) {
statusListener.onComplete(this.zak);
} else {
this.zag.add(statusListener);
}
}
}
public final R await() {
Preconditions.checkNotMainThread("await must not be called on the UI thread");
boolean z = true;
Preconditions.checkState(!this.zal, "Result has already been consumed");
if (this.zap != null) {
z = false;
}
Preconditions.checkState(z, "Cannot await if then() has been called.");
try {
this.zaf.await();
} catch (InterruptedException unused) {
forceFailureUnlessReady(Status.RESULT_INTERRUPTED);
}
Preconditions.checkState(isReady(), "Result is not ready.");
return zaa();
}
/* JADX WARNING: Can't wrap try/catch for region: R(6:8|(2:10|11)|12|13|14|15) */
/* JADX WARNING: Code restructure failed: missing block: B:17:0x0027, code lost:
return;
*/
/* JADX WARNING: Missing exception handler attribute for start block: B:12:0x0013 */
/* Code decompiled incorrectly, please refer to instructions dump. */
public void cancel() {
/*
r2 = this;
java.lang.Object r0 = r2.zae
monitor-enter(r0)
boolean r1 = r2.zam // Catch:{ all -> 0x0028 }
if (r1 != 0) goto L_0x0026
boolean r1 = r2.zal // Catch:{ all -> 0x0028 }
if (r1 == 0) goto L_0x000c
goto L_0x0026
L_0x000c:
com.google.android.gms.common.internal.ICancelToken r1 = r2.zao // Catch:{ all -> 0x0028 }
if (r1 == 0) goto L_0x0013
r1.cancel() // Catch:{ RemoteException -> 0x0013 }
L_0x0013:
R r1 = r2.zaj // Catch:{ all -> 0x0028 }
zal(r1) // Catch:{ all -> 0x0028 }
r1 = 1
r2.zam = r1 // Catch:{ all -> 0x0028 }
com.google.android.gms.common.api.Status r1 = com.google.android.gms.common.api.Status.RESULT_CANCELED // Catch:{ all -> 0x0028 }
com.google.android.gms.common.api.Result r1 = r2.createFailedResult(r1) // Catch:{ all -> 0x0028 }
r2.zab(r1) // Catch:{ all -> 0x0028 }
monitor-exit(r0) // Catch:{ all -> 0x0028 }
return
L_0x0026:
monitor-exit(r0) // Catch:{ all -> 0x0028 }
return
L_0x0028:
r1 = move-exception
monitor-exit(r0) // Catch:{ all -> 0x0028 }
throw r1
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.common.api.internal.BasePendingResult.cancel():void");
}
/* access modifiers changed from: protected */
public abstract R createFailedResult(Status status);
@Deprecated
public final void forceFailureUnlessReady(Status status) {
synchronized (this.zae) {
if (!isReady()) {
setResult(createFailedResult(status));
this.zan = true;
}
}
}
public final boolean isCanceled() {
boolean z;
synchronized (this.zae) {
z = this.zam;
}
return z;
}
public final boolean isReady() {
return this.zaf.getCount() == 0;
}
/* access modifiers changed from: protected */
public final void setCancelToken(ICancelToken iCancelToken) {
synchronized (this.zae) {
this.zao = iCancelToken;
}
}
/* JADX WARNING: Code restructure failed: missing block: B:21:0x0039, code lost:
return;
*/
/* Code decompiled incorrectly, please refer to instructions dump. */
public final void setResultCallback(com.google.android.gms.common.api.ResultCallback<? super R> r5) {
/*
r4 = this;
java.lang.Object r0 = r4.zae
monitor-enter(r0)
if (r5 != 0) goto L_0x000a
r5 = 0
r4.zah = r5 // Catch:{ all -> 0x003a }
monitor-exit(r0) // Catch:{ all -> 0x003a }
return
L_0x000a:
boolean r1 = r4.zal // Catch:{ all -> 0x003a }
r2 = 1
r1 = r1 ^ r2
java.lang.String r3 = "Result has already been consumed."
com.google.android.gms.common.internal.Preconditions.checkState(r1, r3) // Catch:{ all -> 0x003a }
com.google.android.gms.common.api.internal.zada<R> r1 = r4.zap // Catch:{ all -> 0x003a }
if (r1 != 0) goto L_0x0018
goto L_0x0019
L_0x0018:
r2 = 0
L_0x0019:
java.lang.String r1 = "Cannot set callbacks if then() has been called."
com.google.android.gms.common.internal.Preconditions.checkState(r2, r1) // Catch:{ all -> 0x003a }
boolean r1 = r4.isCanceled() // Catch:{ all -> 0x003a }
if (r1 == 0) goto L_0x0026
monitor-exit(r0) // Catch:{ all -> 0x003a }
return
L_0x0026:
boolean r1 = r4.isReady() // Catch:{ all -> 0x003a }
if (r1 == 0) goto L_0x0036
com.google.android.gms.common.api.internal.BasePendingResult$CallbackHandler<R> r1 = r4.zab // Catch:{ all -> 0x003a }
com.google.android.gms.common.api.Result r2 = r4.zaa() // Catch:{ all -> 0x003a }
r1.zaa(r5, r2) // Catch:{ all -> 0x003a }
goto L_0x0038
L_0x0036:
r4.zah = r5 // Catch:{ all -> 0x003a }
L_0x0038:
monitor-exit(r0) // Catch:{ all -> 0x003a }
return
L_0x003a:
r5 = move-exception
monitor-exit(r0) // Catch:{ all -> 0x003a }
throw r5
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.common.api.internal.BasePendingResult.setResultCallback(com.google.android.gms.common.api.ResultCallback):void");
}
public final <S extends Result> TransformedResult<S> then(ResultTransform<? super R, ? extends S> resultTransform) {
TransformedResult<S> then;
Preconditions.checkState(!this.zal, "Result has already been consumed.");
synchronized (this.zae) {
boolean z = false;
Preconditions.checkState(this.zap == null, "Cannot call then() twice.");
if (this.zah == null) {
z = true;
}
Preconditions.checkState(z, "Cannot call then() if callbacks are set.");
Preconditions.checkState(!this.zam, "Cannot call then() if result was canceled.");
this.zaq = true;
this.zap = new zada<>(this.zac);
then = this.zap.then(resultTransform);
if (isReady()) {
this.zab.zaa(this.zap, zaa());
} else {
this.zah = this.zap;
}
}
return then;
}
public final void zak() {
boolean z = true;
if (!this.zaq && !zaa.get().booleanValue()) {
z = false;
}
this.zaq = z;
}
public final boolean zam() {
boolean isCanceled;
synchronized (this.zae) {
if (((GoogleApiClient) this.zac.get()) == null || !this.zaq) {
cancel();
}
isCanceled = isCanceled();
}
return isCanceled;
}
public final void zan(zadb zadb) {
this.zai.set(zadb);
}
/* compiled from: com.google.android.gms:play-services-base@@18.0.1 */
public static class CallbackHandler<R extends Result> extends zaq {
public CallbackHandler() {
super(Looper.getMainLooper());
}
public final void handleMessage(Message message) {
int i = message.what;
if (i == 1) {
Pair pair = (Pair) message.obj;
ResultCallback resultCallback = (ResultCallback) pair.first;
Result result = (Result) pair.second;
try {
resultCallback.onResult(result);
} catch (RuntimeException e) {
BasePendingResult.zal(result);
throw e;
}
} else if (i != 2) {
int i2 = message.what;
StringBuilder sb = new StringBuilder(45);
sb.append("Don't know how to handle message: ");
sb.append(i2);
Log.wtf("BasePendingResult", sb.toString(), new Exception());
} else {
((BasePendingResult) message.obj).forceFailureUnlessReady(Status.RESULT_TIMEOUT);
}
}
public final void zaa(ResultCallback<? super R> resultCallback, R r) {
int i = BasePendingResult.zad;
sendMessage(obtainMessage(1, new Pair((ResultCallback) Preconditions.checkNotNull(resultCallback), r)));
}
public CallbackHandler(Looper looper) {
super(looper);
}
}
public final void setResult(R r) {
synchronized (this.zae) {
if (this.zan || this.zam) {
zal(r);
return;
}
isReady();
Preconditions.checkState(!isReady(), "Results have already been set");
Preconditions.checkState(!this.zal, "Result has already been consumed");
zab(r);
}
}
@Deprecated
protected BasePendingResult(Looper looper) {
this.zae = new Object();
this.zaf = new CountDownLatch(1);
this.zag = new ArrayList<>();
this.zai = new AtomicReference<>();
this.zaq = false;
this.zab = new CallbackHandler<>(looper);
this.zac = new WeakReference<>((Object) null);
}
public final R await(long j, TimeUnit timeUnit) {
if (j > 0) {
Preconditions.checkNotMainThread("await must not be called on the UI thread when time is greater than zero.");
}
boolean z = true;
Preconditions.checkState(!this.zal, "Result has already been consumed.");
if (this.zap != null) {
z = false;
}
Preconditions.checkState(z, "Cannot await if then() has been called.");
try {
if (!this.zaf.await(j, timeUnit)) {
forceFailureUnlessReady(Status.RESULT_TIMEOUT);
}
} catch (InterruptedException unused) {
forceFailureUnlessReady(Status.RESULT_INTERRUPTED);
}
Preconditions.checkState(isReady(), "Result is not ready.");
return zaa();
}
/* JADX WARNING: Code restructure failed: missing block: B:21:0x0047, code lost:
return;
*/
/* Code decompiled incorrectly, please refer to instructions dump. */
public final void setResultCallback(com.google.android.gms.common.api.ResultCallback<? super R> r5, long r6, java.util.concurrent.TimeUnit r8) {
/*
r4 = this;
java.lang.Object r0 = r4.zae
monitor-enter(r0)
if (r5 != 0) goto L_0x000a
r5 = 0
r4.zah = r5 // Catch:{ all -> 0x0048 }
monitor-exit(r0) // Catch:{ all -> 0x0048 }
return
L_0x000a:
boolean r1 = r4.zal // Catch:{ all -> 0x0048 }
r2 = 1
r1 = r1 ^ r2
java.lang.String r3 = "Result has already been consumed."
com.google.android.gms.common.internal.Preconditions.checkState(r1, r3) // Catch:{ all -> 0x0048 }
com.google.android.gms.common.api.internal.zada<R> r1 = r4.zap // Catch:{ all -> 0x0048 }
if (r1 != 0) goto L_0x0018
goto L_0x0019
L_0x0018:
r2 = 0
L_0x0019:
java.lang.String r1 = "Cannot set callbacks if then() has been called."
com.google.android.gms.common.internal.Preconditions.checkState(r2, r1) // Catch:{ all -> 0x0048 }
boolean r1 = r4.isCanceled() // Catch:{ all -> 0x0048 }
if (r1 == 0) goto L_0x0026
monitor-exit(r0) // Catch:{ all -> 0x0048 }
return
L_0x0026:
boolean r1 = r4.isReady() // Catch:{ all -> 0x0048 }
if (r1 == 0) goto L_0x0036
com.google.android.gms.common.api.internal.BasePendingResult$CallbackHandler<R> r6 = r4.zab // Catch:{ all -> 0x0048 }
com.google.android.gms.common.api.Result r7 = r4.zaa() // Catch:{ all -> 0x0048 }
r6.zaa(r5, r7) // Catch:{ all -> 0x0048 }
goto L_0x0046
L_0x0036:
r4.zah = r5 // Catch:{ all -> 0x0048 }
com.google.android.gms.common.api.internal.BasePendingResult$CallbackHandler<R> r5 = r4.zab // Catch:{ all -> 0x0048 }
long r6 = r8.toMillis(r6) // Catch:{ all -> 0x0048 }
r8 = 2
android.os.Message r8 = r5.obtainMessage(r8, r4) // Catch:{ all -> 0x0048 }
r5.sendMessageDelayed(r8, r6) // Catch:{ all -> 0x0048 }
L_0x0046:
monitor-exit(r0) // Catch:{ all -> 0x0048 }
return
L_0x0048:
r5 = move-exception
monitor-exit(r0) // Catch:{ all -> 0x0048 }
throw r5
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.common.api.internal.BasePendingResult.setResultCallback(com.google.android.gms.common.api.ResultCallback, long, java.util.concurrent.TimeUnit):void");
}
protected BasePendingResult(GoogleApiClient googleApiClient) {
this.zae = new Object();
this.zaf = new CountDownLatch(1);
this.zag = new ArrayList<>();
this.zai = new AtomicReference<>();
this.zaq = false;
this.zab = new CallbackHandler<>(googleApiClient != null ? googleApiClient.getLooper() : Looper.getMainLooper());
this.zac = new WeakReference<>(googleApiClient);
}
protected BasePendingResult(CallbackHandler<R> callbackHandler) {
this.zae = new Object();
this.zaf = new CountDownLatch(1);
this.zag = new ArrayList<>();
this.zai = new AtomicReference<>();
this.zaq = false;
this.zab = (CallbackHandler) Preconditions.checkNotNull(callbackHandler, "CallbackHandler must not be null");
this.zac = new WeakReference<>((Object) null);
}
}
Download file