924 lines
34 KiB
Java
924 lines
34 KiB
Java
package c.i.a.f.e.h.j;
|
|
|
|
import android.app.ActivityManager;
|
|
import android.app.Application;
|
|
import android.app.PendingIntent;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.pm.PackageManager;
|
|
import android.os.Bundle;
|
|
import android.os.DeadObjectException;
|
|
import android.os.Handler;
|
|
import android.os.HandlerThread;
|
|
import android.os.Looper;
|
|
import android.os.Message;
|
|
import android.os.RemoteException;
|
|
import android.util.Log;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.annotation.WorkerThread;
|
|
import androidx.collection.ArrayMap;
|
|
import androidx.collection.ArraySet;
|
|
import c.i.a.f.e.e;
|
|
import c.i.a.f.e.h.a;
|
|
import c.i.a.f.e.h.c;
|
|
import c.i.a.f.e.h.j.k;
|
|
import c.i.a.f.e.k.b;
|
|
import c.i.a.f.e.k.s;
|
|
import c.i.a.f.e.k.z;
|
|
import c.i.a.f.j.b.e.i;
|
|
import c.i.a.f.j.b.e.v;
|
|
import c.i.a.f.l.f;
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
import com.google.android.gms.common.ConnectionResult;
|
|
import com.google.android.gms.common.Feature;
|
|
import com.google.android.gms.common.GoogleApiAvailability;
|
|
import com.google.android.gms.common.api.GoogleApiActivity;
|
|
import com.google.android.gms.common.api.Scope;
|
|
import com.google.android.gms.common.api.Status;
|
|
import com.google.android.gms.common.api.UnsupportedApiCallException;
|
|
import com.google.android.gms.tasks.TaskCompletionSource;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.HashMap;
|
|
import java.util.HashSet;
|
|
import java.util.Iterator;
|
|
import java.util.LinkedList;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Objects;
|
|
import java.util.Queue;
|
|
import java.util.Set;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
import org.checkerframework.checker.initialization.qual.NotOnlyInitialized;
|
|
/* compiled from: com.google.android.gms:play-services-base@@17.3.0 */
|
|
public class g implements Handler.Callback {
|
|
public static final Status i = new Status(4, "Sign-out occurred while this API call was in progress.");
|
|
public static final Status j = new Status(4, "The user must be signed in to make this API call.");
|
|
public static final Object k = new Object();
|
|
@Nullable
|
|
public static g l;
|
|
public long m = 10000;
|
|
public final Context n;
|
|
public final GoogleApiAvailability o;
|
|
public final s p;
|
|
public final AtomicInteger q;
|
|
public final AtomicInteger r;
|
|
|
|
/* renamed from: s reason: collision with root package name */
|
|
public final Map<b<?>, a<?>> f1048s;
|
|
@Nullable
|
|
public a1 t;
|
|
public final Set<b<?>> u;
|
|
public final Set<b<?>> v;
|
|
@NotOnlyInitialized
|
|
public final Handler w;
|
|
|
|
/* renamed from: x reason: collision with root package name */
|
|
public volatile boolean f1049x;
|
|
|
|
/* compiled from: com.google.android.gms:play-services-base@@17.3.0 */
|
|
public class a<O extends a.d> implements c.a, c.b {
|
|
public final Queue<s> a = new LinkedList();
|
|
@NotOnlyInitialized
|
|
public final a.f b;
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public final a.b f1050c;
|
|
public final b<O> d;
|
|
public final x0 e;
|
|
public final Set<r0> f = new HashSet();
|
|
public final Map<k.a<?>, d0> g = new HashMap();
|
|
public final int h;
|
|
@Nullable
|
|
public final g0 i;
|
|
public boolean j;
|
|
public final List<c> k = new ArrayList();
|
|
@Nullable
|
|
public ConnectionResult l = null;
|
|
|
|
@WorkerThread
|
|
public a(c.i.a.f.e.h.b<O> bVar) {
|
|
Looper looper = g.this.w.getLooper();
|
|
c.i.a.f.e.k.c a = bVar.a().a();
|
|
c.i.a.f.e.h.a<O> aVar = bVar.b;
|
|
AnimatableValueParser.G(aVar.a != null, "This API was constructed with a SimpleClientBuilder. Use getSimpleClientBuilder");
|
|
a.AbstractC0105a<?, O> aVar2 = aVar.a;
|
|
Objects.requireNonNull(aVar2, "null reference");
|
|
a.f a2 = aVar2.a(bVar.a, looper, a, bVar.f1043c, this, this);
|
|
this.b = a2;
|
|
if (!(a2 instanceof z)) {
|
|
this.f1050c = a2;
|
|
this.d = bVar.d;
|
|
this.e = new x0();
|
|
this.h = bVar.f;
|
|
if (a2.o()) {
|
|
this.i = new g0(g.this.n, g.this.w, bVar.a().a());
|
|
} else {
|
|
this.i = null;
|
|
}
|
|
} else {
|
|
z zVar = (z) a2;
|
|
throw new NoSuchMethodError();
|
|
}
|
|
}
|
|
|
|
@Nullable
|
|
@WorkerThread
|
|
public final Feature a(@Nullable Feature[] featureArr) {
|
|
if (!(featureArr == null || featureArr.length == 0)) {
|
|
Feature[] m = this.b.m();
|
|
if (m == null) {
|
|
m = new Feature[0];
|
|
}
|
|
ArrayMap arrayMap = new ArrayMap(m.length);
|
|
for (Feature feature : m) {
|
|
arrayMap.put(feature.i, Long.valueOf(feature.v0()));
|
|
}
|
|
for (Feature feature2 : featureArr) {
|
|
Long l = arrayMap.get(feature2.i);
|
|
if (l == null || l.longValue() < feature2.v0()) {
|
|
return feature2;
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@WorkerThread
|
|
public final void b() {
|
|
AnimatableValueParser.s(g.this.w);
|
|
Status status = g.i;
|
|
f(status);
|
|
x0 x0Var = this.e;
|
|
Objects.requireNonNull(x0Var);
|
|
x0Var.a(false, status);
|
|
for (k.a aVar : (k.a[]) this.g.keySet().toArray(new k.a[0])) {
|
|
j(new p0(aVar, new TaskCompletionSource()));
|
|
}
|
|
n(new ConnectionResult(4));
|
|
if (this.b.j()) {
|
|
this.b.i(new x(this));
|
|
}
|
|
}
|
|
|
|
@WorkerThread
|
|
public final void c(int i) {
|
|
q();
|
|
this.j = true;
|
|
x0 x0Var = this.e;
|
|
String n = this.b.n();
|
|
Objects.requireNonNull(x0Var);
|
|
StringBuilder sb = new StringBuilder("The connection to Google Play services was lost");
|
|
if (i == 1) {
|
|
sb.append(" due to service disconnection.");
|
|
} else if (i == 3) {
|
|
sb.append(" due to dead object exception.");
|
|
}
|
|
if (n != null) {
|
|
sb.append(" Last reason for disconnect: ");
|
|
sb.append(n);
|
|
}
|
|
x0Var.a(true, new Status(20, sb.toString()));
|
|
Handler handler = g.this.w;
|
|
Message obtain = Message.obtain(handler, 9, this.d);
|
|
Objects.requireNonNull(g.this);
|
|
handler.sendMessageDelayed(obtain, 5000);
|
|
Handler handler2 = g.this.w;
|
|
Message obtain2 = Message.obtain(handler2, 11, this.d);
|
|
Objects.requireNonNull(g.this);
|
|
handler2.sendMessageDelayed(obtain2, 120000);
|
|
g.this.p.a.clear();
|
|
for (d0 d0Var : this.g.values()) {
|
|
d0Var.f1047c.run();
|
|
}
|
|
}
|
|
|
|
@WorkerThread
|
|
public final void d(@NonNull ConnectionResult connectionResult, @Nullable Exception exc) {
|
|
f fVar;
|
|
AnimatableValueParser.s(g.this.w);
|
|
g0 g0Var = this.i;
|
|
if (!(g0Var == null || (fVar = g0Var.g) == null)) {
|
|
fVar.h();
|
|
}
|
|
q();
|
|
g.this.p.a.clear();
|
|
n(connectionResult);
|
|
if (connectionResult.k == 4) {
|
|
f(g.j);
|
|
} else if (this.a.isEmpty()) {
|
|
this.l = connectionResult;
|
|
} else if (exc != null) {
|
|
AnimatableValueParser.s(g.this.w);
|
|
i(null, exc, false);
|
|
} else if (!g.this.f1049x) {
|
|
Status p = p(connectionResult);
|
|
AnimatableValueParser.s(g.this.w);
|
|
i(p, null, false);
|
|
} else {
|
|
i(p(connectionResult), null, true);
|
|
if (!this.a.isEmpty() && !l(connectionResult) && !g.this.c(connectionResult, this.h)) {
|
|
if (connectionResult.k == 18) {
|
|
this.j = true;
|
|
}
|
|
if (this.j) {
|
|
Handler handler = g.this.w;
|
|
Message obtain = Message.obtain(handler, 9, this.d);
|
|
Objects.requireNonNull(g.this);
|
|
handler.sendMessageDelayed(obtain, 5000);
|
|
return;
|
|
}
|
|
Status p2 = p(connectionResult);
|
|
AnimatableValueParser.s(g.this.w);
|
|
i(p2, null, false);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // c.i.a.f.e.h.j.f
|
|
public final void e(int i) {
|
|
if (Looper.myLooper() == g.this.w.getLooper()) {
|
|
c(i);
|
|
} else {
|
|
g.this.w.post(new v(this, i));
|
|
}
|
|
}
|
|
|
|
@WorkerThread
|
|
public final void f(Status status) {
|
|
AnimatableValueParser.s(g.this.w);
|
|
i(status, null, false);
|
|
}
|
|
|
|
@Override // c.i.a.f.e.h.j.l
|
|
@WorkerThread
|
|
public final void g(@NonNull ConnectionResult connectionResult) {
|
|
d(connectionResult, null);
|
|
}
|
|
|
|
@Override // c.i.a.f.e.h.j.f
|
|
public final void h(@Nullable Bundle bundle) {
|
|
if (Looper.myLooper() == g.this.w.getLooper()) {
|
|
t();
|
|
} else {
|
|
g.this.w.post(new u(this));
|
|
}
|
|
}
|
|
|
|
@WorkerThread
|
|
public final void i(@Nullable Status status, @Nullable Exception exc, boolean z2) {
|
|
AnimatableValueParser.s(g.this.w);
|
|
boolean z3 = true;
|
|
boolean z4 = status == null;
|
|
if (exc != null) {
|
|
z3 = false;
|
|
}
|
|
if (z4 != z3) {
|
|
Iterator<s> it = this.a.iterator();
|
|
while (it.hasNext()) {
|
|
s next = it.next();
|
|
if (!z2 || next.a == 2) {
|
|
if (status != null) {
|
|
next.b(status);
|
|
} else {
|
|
next.e(exc);
|
|
}
|
|
it.remove();
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
throw new IllegalArgumentException("Status XOR exception should be null");
|
|
}
|
|
|
|
@WorkerThread
|
|
public final void j(s sVar) {
|
|
AnimatableValueParser.s(g.this.w);
|
|
if (!this.b.j()) {
|
|
this.a.add(sVar);
|
|
ConnectionResult connectionResult = this.l;
|
|
if (connectionResult == null || !connectionResult.v0()) {
|
|
r();
|
|
} else {
|
|
d(this.l, null);
|
|
}
|
|
} else if (m(sVar)) {
|
|
w();
|
|
} else {
|
|
this.a.add(sVar);
|
|
}
|
|
}
|
|
|
|
@WorkerThread
|
|
public final boolean k(boolean z2) {
|
|
AnimatableValueParser.s(g.this.w);
|
|
if (!this.b.j() || this.g.size() != 0) {
|
|
return false;
|
|
}
|
|
x0 x0Var = this.e;
|
|
if (!x0Var.a.isEmpty() || !x0Var.b.isEmpty()) {
|
|
if (z2) {
|
|
w();
|
|
}
|
|
return false;
|
|
}
|
|
this.b.c("Timing out service connection.");
|
|
return true;
|
|
}
|
|
|
|
@WorkerThread
|
|
public final boolean l(@NonNull ConnectionResult connectionResult) {
|
|
synchronized (g.k) {
|
|
g gVar = g.this;
|
|
if (gVar.t == null || !gVar.u.contains(this.d)) {
|
|
return false;
|
|
}
|
|
g.this.t.n(connectionResult, this.h);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
@WorkerThread
|
|
public final boolean m(s sVar) {
|
|
if (!(sVar instanceof m0)) {
|
|
o(sVar);
|
|
return true;
|
|
}
|
|
m0 m0Var = (m0) sVar;
|
|
Feature a = a(m0Var.f(this));
|
|
if (a == null) {
|
|
o(sVar);
|
|
return true;
|
|
}
|
|
String name = this.f1050c.getClass().getName();
|
|
String str = a.i;
|
|
long v0 = a.v0();
|
|
StringBuilder O = c.d.b.a.a.O(c.d.b.a.a.b(str, name.length() + 77), name, " could not execute call because it requires feature (", str, ", ");
|
|
O.append(v0);
|
|
O.append(").");
|
|
Log.w("GoogleApiManager", O.toString());
|
|
if (!g.this.f1049x || !m0Var.g(this)) {
|
|
m0Var.e(new UnsupportedApiCallException(a));
|
|
return true;
|
|
}
|
|
c cVar = new c(this.d, a, null);
|
|
int indexOf = this.k.indexOf(cVar);
|
|
if (indexOf >= 0) {
|
|
c cVar2 = this.k.get(indexOf);
|
|
g.this.w.removeMessages(15, cVar2);
|
|
Handler handler = g.this.w;
|
|
Message obtain = Message.obtain(handler, 15, cVar2);
|
|
Objects.requireNonNull(g.this);
|
|
handler.sendMessageDelayed(obtain, 5000);
|
|
return false;
|
|
}
|
|
this.k.add(cVar);
|
|
Handler handler2 = g.this.w;
|
|
Message obtain2 = Message.obtain(handler2, 15, cVar);
|
|
Objects.requireNonNull(g.this);
|
|
handler2.sendMessageDelayed(obtain2, 5000);
|
|
Handler handler3 = g.this.w;
|
|
Message obtain3 = Message.obtain(handler3, 16, cVar);
|
|
Objects.requireNonNull(g.this);
|
|
handler3.sendMessageDelayed(obtain3, 120000);
|
|
ConnectionResult connectionResult = new ConnectionResult(2, null);
|
|
if (l(connectionResult)) {
|
|
return false;
|
|
}
|
|
g.this.c(connectionResult, this.h);
|
|
return false;
|
|
}
|
|
|
|
@WorkerThread
|
|
public final void n(ConnectionResult connectionResult) {
|
|
Iterator<r0> it = this.f.iterator();
|
|
if (it.hasNext()) {
|
|
r0 next = it.next();
|
|
if (AnimatableValueParser.j0(connectionResult, ConnectionResult.i)) {
|
|
this.b.f();
|
|
}
|
|
Objects.requireNonNull(next);
|
|
throw null;
|
|
}
|
|
this.f.clear();
|
|
}
|
|
|
|
@WorkerThread
|
|
public final void o(s sVar) {
|
|
sVar.d(this.e, s());
|
|
try {
|
|
sVar.c(this);
|
|
} catch (DeadObjectException unused) {
|
|
e(1);
|
|
this.b.c("DeadObjectException thrown while running ApiCallRunner.");
|
|
} catch (Throwable th) {
|
|
throw new IllegalStateException(String.format("Error in GoogleApi implementation for client %s.", this.f1050c.getClass().getName()), th);
|
|
}
|
|
}
|
|
|
|
public final Status p(ConnectionResult connectionResult) {
|
|
String str = this.d.b.f1042c;
|
|
String valueOf = String.valueOf(connectionResult);
|
|
return new Status(17, c.d.b.a.a.h(valueOf.length() + c.d.b.a.a.b(str, 63), "API: ", str, " is not available on this device. Connection failed with: ", valueOf));
|
|
}
|
|
|
|
@WorkerThread
|
|
public final void q() {
|
|
AnimatableValueParser.s(g.this.w);
|
|
this.l = null;
|
|
}
|
|
|
|
@WorkerThread
|
|
public final void r() {
|
|
AnimatableValueParser.s(g.this.w);
|
|
if (!this.b.j() && !this.b.e()) {
|
|
try {
|
|
g gVar = g.this;
|
|
int a = gVar.p.a(gVar.n, this.b);
|
|
if (a != 0) {
|
|
ConnectionResult connectionResult = new ConnectionResult(a, null);
|
|
String name = this.f1050c.getClass().getName();
|
|
String valueOf = String.valueOf(connectionResult);
|
|
StringBuilder sb = new StringBuilder(name.length() + 35 + valueOf.length());
|
|
sb.append("The service for ");
|
|
sb.append(name);
|
|
sb.append(" is not available: ");
|
|
sb.append(valueOf);
|
|
Log.w("GoogleApiManager", sb.toString());
|
|
d(connectionResult, null);
|
|
return;
|
|
}
|
|
g gVar2 = g.this;
|
|
a.f fVar = this.b;
|
|
b bVar = new b(fVar, this.d);
|
|
if (fVar.o()) {
|
|
g0 g0Var = this.i;
|
|
Objects.requireNonNull(g0Var, "null reference");
|
|
f fVar2 = g0Var.g;
|
|
if (fVar2 != null) {
|
|
fVar2.h();
|
|
}
|
|
g0Var.f.h = Integer.valueOf(System.identityHashCode(g0Var));
|
|
a.AbstractC0105a<? extends f, c.i.a.f.l.a> aVar = g0Var.d;
|
|
Context context = g0Var.b;
|
|
Looper looper = g0Var.f1052c.getLooper();
|
|
c.i.a.f.e.k.c cVar = g0Var.f;
|
|
g0Var.g = (f) aVar.a(context, looper, cVar, cVar.g, g0Var, g0Var);
|
|
g0Var.h = bVar;
|
|
Set<Scope> set = g0Var.e;
|
|
if (set == null || set.isEmpty()) {
|
|
g0Var.f1052c.post(new f0(g0Var));
|
|
} else {
|
|
g0Var.g.p();
|
|
}
|
|
}
|
|
try {
|
|
this.b.g(bVar);
|
|
} catch (SecurityException e) {
|
|
d(new ConnectionResult(10), e);
|
|
}
|
|
} catch (IllegalStateException e2) {
|
|
d(new ConnectionResult(10), e2);
|
|
}
|
|
}
|
|
}
|
|
|
|
public final boolean s() {
|
|
return this.b.o();
|
|
}
|
|
|
|
@WorkerThread
|
|
public final void t() {
|
|
q();
|
|
n(ConnectionResult.i);
|
|
v();
|
|
Iterator<d0> it = this.g.values().iterator();
|
|
while (it.hasNext()) {
|
|
d0 next = it.next();
|
|
Objects.requireNonNull(next.a);
|
|
if (a(null) != null) {
|
|
it.remove();
|
|
} else {
|
|
try {
|
|
m<a.b, ?> mVar = next.a;
|
|
a.b bVar = this.f1050c;
|
|
TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
|
|
v vVar = (v) mVar;
|
|
Objects.requireNonNull(vVar);
|
|
vVar.b.a((c.i.a.f.j.b.e.f) bVar, i.j(vVar.f1224c, taskCompletionSource));
|
|
} catch (DeadObjectException unused) {
|
|
e(3);
|
|
this.b.c("DeadObjectException thrown while calling register listener method.");
|
|
} catch (RemoteException unused2) {
|
|
it.remove();
|
|
}
|
|
}
|
|
}
|
|
u();
|
|
w();
|
|
}
|
|
|
|
@WorkerThread
|
|
public final void u() {
|
|
ArrayList arrayList = new ArrayList(this.a);
|
|
int size = arrayList.size();
|
|
int i = 0;
|
|
while (i < size) {
|
|
Object obj = arrayList.get(i);
|
|
i++;
|
|
s sVar = (s) obj;
|
|
if (!this.b.j()) {
|
|
return;
|
|
}
|
|
if (m(sVar)) {
|
|
this.a.remove(sVar);
|
|
}
|
|
}
|
|
}
|
|
|
|
@WorkerThread
|
|
public final void v() {
|
|
if (this.j) {
|
|
g.this.w.removeMessages(11, this.d);
|
|
g.this.w.removeMessages(9, this.d);
|
|
this.j = false;
|
|
}
|
|
}
|
|
|
|
public final void w() {
|
|
g.this.w.removeMessages(12, this.d);
|
|
Handler handler = g.this.w;
|
|
handler.sendMessageDelayed(handler.obtainMessage(12, this.d), g.this.m);
|
|
}
|
|
}
|
|
|
|
/* compiled from: com.google.android.gms:play-services-base@@17.3.0 */
|
|
public class b implements h0, b.c {
|
|
public final a.f a;
|
|
public final b<?> b;
|
|
@Nullable
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public c.i.a.f.e.k.g f1051c = null;
|
|
@Nullable
|
|
public Set<Scope> d = null;
|
|
public boolean e = false;
|
|
|
|
public b(a.f fVar, b<?> bVar) {
|
|
this.a = fVar;
|
|
this.b = bVar;
|
|
}
|
|
|
|
@Override // c.i.a.f.e.k.b.c
|
|
public final void a(@NonNull ConnectionResult connectionResult) {
|
|
g.this.w.post(new z(this, connectionResult));
|
|
}
|
|
|
|
@WorkerThread
|
|
public final void b(ConnectionResult connectionResult) {
|
|
a<?> aVar = g.this.f1048s.get(this.b);
|
|
if (aVar != null) {
|
|
AnimatableValueParser.s(g.this.w);
|
|
a.f fVar = aVar.b;
|
|
String name = aVar.f1050c.getClass().getName();
|
|
String valueOf = String.valueOf(connectionResult);
|
|
fVar.c(c.d.b.a.a.h(valueOf.length() + name.length() + 25, "onSignInFailed for ", name, " with ", valueOf));
|
|
aVar.d(connectionResult, null);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* compiled from: com.google.android.gms:play-services-base@@17.3.0 */
|
|
public static class c {
|
|
public final b<?> a;
|
|
public final Feature b;
|
|
|
|
public c(b bVar, Feature feature, t tVar) {
|
|
this.a = bVar;
|
|
this.b = feature;
|
|
}
|
|
|
|
public final boolean equals(@Nullable Object obj) {
|
|
if (obj != null && (obj instanceof c)) {
|
|
c cVar = (c) obj;
|
|
if (AnimatableValueParser.j0(this.a, cVar.a) && AnimatableValueParser.j0(this.b, cVar.b)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final int hashCode() {
|
|
return Arrays.hashCode(new Object[]{this.a, this.b});
|
|
}
|
|
|
|
public final String toString() {
|
|
c.i.a.f.e.k.k kVar = new c.i.a.f.e.k.k(this, null);
|
|
kVar.a("key", this.a);
|
|
kVar.a("feature", this.b);
|
|
return kVar.toString();
|
|
}
|
|
}
|
|
|
|
public g(Context context, Looper looper, GoogleApiAvailability googleApiAvailability) {
|
|
boolean z2 = true;
|
|
this.q = new AtomicInteger(1);
|
|
this.r = new AtomicInteger(0);
|
|
this.f1048s = new ConcurrentHashMap(5, 0.75f, 1);
|
|
this.t = null;
|
|
this.u = new ArraySet();
|
|
this.v = new ArraySet();
|
|
this.f1049x = true;
|
|
this.n = context;
|
|
c.i.a.f.h.e.c cVar = new c.i.a.f.h.e.c(looper, this);
|
|
this.w = cVar;
|
|
this.o = googleApiAvailability;
|
|
this.p = new s(googleApiAvailability);
|
|
PackageManager packageManager = context.getPackageManager();
|
|
if (c.i.a.f.e.o.c.d == null) {
|
|
c.i.a.f.e.o.c.d = Boolean.valueOf((!c.i.a.f.e.o.c.R() || !packageManager.hasSystemFeature("android.hardware.type.automotive")) ? false : z2);
|
|
}
|
|
if (c.i.a.f.e.o.c.d.booleanValue()) {
|
|
this.f1049x = false;
|
|
}
|
|
cVar.sendMessage(cVar.obtainMessage(6));
|
|
}
|
|
|
|
public static g a(Context context) {
|
|
g gVar;
|
|
synchronized (k) {
|
|
if (l == null) {
|
|
HandlerThread handlerThread = new HandlerThread("GoogleApiHandler", 9);
|
|
handlerThread.start();
|
|
Looper looper = handlerThread.getLooper();
|
|
Context applicationContext = context.getApplicationContext();
|
|
Object obj = GoogleApiAvailability.f2366c;
|
|
l = new g(applicationContext, looper, GoogleApiAvailability.d);
|
|
}
|
|
gVar = l;
|
|
}
|
|
return gVar;
|
|
}
|
|
|
|
public final void b(@NonNull a1 a1Var) {
|
|
synchronized (k) {
|
|
if (this.t != a1Var) {
|
|
this.t = a1Var;
|
|
this.u.clear();
|
|
}
|
|
this.u.addAll(a1Var.n);
|
|
}
|
|
}
|
|
|
|
public final boolean c(ConnectionResult connectionResult, int i2) {
|
|
PendingIntent pendingIntent;
|
|
GoogleApiAvailability googleApiAvailability = this.o;
|
|
Context context = this.n;
|
|
Objects.requireNonNull(googleApiAvailability);
|
|
if (connectionResult.v0()) {
|
|
pendingIntent = connectionResult.l;
|
|
} else {
|
|
Intent a2 = googleApiAvailability.a(context, connectionResult.k, null);
|
|
pendingIntent = a2 == null ? null : PendingIntent.getActivity(context, 0, a2, 134217728);
|
|
}
|
|
if (pendingIntent == null) {
|
|
return false;
|
|
}
|
|
int i3 = connectionResult.k;
|
|
int i4 = GoogleApiActivity.i;
|
|
Intent intent = new Intent(context, GoogleApiActivity.class);
|
|
intent.putExtra("pending_intent", pendingIntent);
|
|
intent.putExtra("failing_client_id", i2);
|
|
intent.putExtra("notify_manager", true);
|
|
googleApiAvailability.i(context, i3, PendingIntent.getActivity(context, 0, intent, 134217728));
|
|
return true;
|
|
}
|
|
|
|
@WorkerThread
|
|
public final a<?> d(c.i.a.f.e.h.b<?> bVar) {
|
|
b<?> bVar2 = bVar.d;
|
|
a<?> aVar = this.f1048s.get(bVar2);
|
|
if (aVar == null) {
|
|
aVar = new a<>(bVar);
|
|
this.f1048s.put(bVar2, aVar);
|
|
}
|
|
if (aVar.s()) {
|
|
this.v.add(bVar2);
|
|
}
|
|
aVar.r();
|
|
return aVar;
|
|
}
|
|
|
|
@Override // android.os.Handler.Callback
|
|
@WorkerThread
|
|
public boolean handleMessage(Message message) {
|
|
a<?> aVar;
|
|
Feature[] f;
|
|
int i2 = message.what;
|
|
int i3 = 0;
|
|
long j2 = 300000;
|
|
switch (i2) {
|
|
case 1:
|
|
if (((Boolean) message.obj).booleanValue()) {
|
|
j2 = 10000;
|
|
}
|
|
this.m = j2;
|
|
this.w.removeMessages(12);
|
|
for (b<?> bVar : this.f1048s.keySet()) {
|
|
Handler handler = this.w;
|
|
handler.sendMessageDelayed(handler.obtainMessage(12, bVar), this.m);
|
|
}
|
|
break;
|
|
case 2:
|
|
Objects.requireNonNull((r0) message.obj);
|
|
throw null;
|
|
case 3:
|
|
for (a<?> aVar2 : this.f1048s.values()) {
|
|
aVar2.q();
|
|
aVar2.r();
|
|
}
|
|
break;
|
|
case 4:
|
|
case 8:
|
|
case 13:
|
|
c0 c0Var = (c0) message.obj;
|
|
a<?> aVar3 = this.f1048s.get(c0Var.f1046c.d);
|
|
if (aVar3 == null) {
|
|
aVar3 = d(c0Var.f1046c);
|
|
}
|
|
if (!aVar3.s() || this.r.get() == c0Var.b) {
|
|
aVar3.j(c0Var.a);
|
|
break;
|
|
} else {
|
|
c0Var.a.b(i);
|
|
aVar3.b();
|
|
break;
|
|
}
|
|
case 5:
|
|
int i4 = message.arg1;
|
|
ConnectionResult connectionResult = (ConnectionResult) message.obj;
|
|
Iterator<a<?>> it = this.f1048s.values().iterator();
|
|
while (true) {
|
|
if (it.hasNext()) {
|
|
aVar = it.next();
|
|
if (aVar.h == i4) {
|
|
}
|
|
} else {
|
|
aVar = null;
|
|
}
|
|
}
|
|
if (aVar != null) {
|
|
GoogleApiAvailability googleApiAvailability = this.o;
|
|
int i5 = connectionResult.k;
|
|
Objects.requireNonNull(googleApiAvailability);
|
|
boolean z2 = e.a;
|
|
String x0 = ConnectionResult.x0(i5);
|
|
String str = connectionResult.m;
|
|
Status status = new Status(17, c.d.b.a.a.h(c.d.b.a.a.b(str, c.d.b.a.a.b(x0, 69)), "Error resolution was canceled by the user, original error message: ", x0, ": ", str));
|
|
AnimatableValueParser.s(g.this.w);
|
|
aVar.i(status, null, false);
|
|
break;
|
|
} else {
|
|
StringBuilder sb = new StringBuilder(76);
|
|
sb.append("Could not find API instance ");
|
|
sb.append(i4);
|
|
sb.append(" while trying to fail enqueued calls.");
|
|
Log.wtf("GoogleApiManager", sb.toString(), new Exception());
|
|
break;
|
|
}
|
|
case 6:
|
|
if (this.n.getApplicationContext() instanceof Application) {
|
|
c.a((Application) this.n.getApplicationContext());
|
|
c cVar = c.i;
|
|
t tVar = new t(this);
|
|
Objects.requireNonNull(cVar);
|
|
synchronized (cVar) {
|
|
cVar.l.add(tVar);
|
|
}
|
|
if (!cVar.k.get()) {
|
|
ActivityManager.RunningAppProcessInfo runningAppProcessInfo = new ActivityManager.RunningAppProcessInfo();
|
|
ActivityManager.getMyMemoryState(runningAppProcessInfo);
|
|
if (!cVar.k.getAndSet(true) && runningAppProcessInfo.importance > 100) {
|
|
cVar.j.set(true);
|
|
}
|
|
}
|
|
if (!cVar.j.get()) {
|
|
this.m = 300000;
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 7:
|
|
d((c.i.a.f.e.h.b) message.obj);
|
|
break;
|
|
case 9:
|
|
if (this.f1048s.containsKey(message.obj)) {
|
|
a<?> aVar4 = this.f1048s.get(message.obj);
|
|
AnimatableValueParser.s(g.this.w);
|
|
if (aVar4.j) {
|
|
aVar4.r();
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 10:
|
|
for (b<?> bVar2 : this.v) {
|
|
a<?> remove = this.f1048s.remove(bVar2);
|
|
if (remove != null) {
|
|
remove.b();
|
|
}
|
|
}
|
|
this.v.clear();
|
|
break;
|
|
case 11:
|
|
if (this.f1048s.containsKey(message.obj)) {
|
|
a<?> aVar5 = this.f1048s.get(message.obj);
|
|
AnimatableValueParser.s(g.this.w);
|
|
if (aVar5.j) {
|
|
aVar5.v();
|
|
g gVar = g.this;
|
|
Status status2 = gVar.o.c(gVar.n) == 18 ? new Status(8, "Connection timed out while waiting for Google Play services update to complete.") : new Status(8, "API failed to connect while resuming due to an unknown error.");
|
|
AnimatableValueParser.s(g.this.w);
|
|
aVar5.i(status2, null, false);
|
|
aVar5.b.c("Timing out connection while resuming.");
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case 12:
|
|
if (this.f1048s.containsKey(message.obj)) {
|
|
this.f1048s.get(message.obj).k(true);
|
|
break;
|
|
}
|
|
break;
|
|
case 14:
|
|
Objects.requireNonNull((b1) message.obj);
|
|
if (!this.f1048s.containsKey(null)) {
|
|
throw null;
|
|
}
|
|
this.f1048s.get(null).k(false);
|
|
throw null;
|
|
case 15:
|
|
c cVar2 = (c) message.obj;
|
|
if (this.f1048s.containsKey(cVar2.a)) {
|
|
a<?> aVar6 = this.f1048s.get(cVar2.a);
|
|
if (aVar6.k.contains(cVar2) && !aVar6.j) {
|
|
if (!aVar6.b.j()) {
|
|
aVar6.r();
|
|
break;
|
|
} else {
|
|
aVar6.u();
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
case 16:
|
|
c cVar3 = (c) message.obj;
|
|
if (this.f1048s.containsKey(cVar3.a)) {
|
|
a<?> aVar7 = this.f1048s.get(cVar3.a);
|
|
if (aVar7.k.remove(cVar3)) {
|
|
g.this.w.removeMessages(15, cVar3);
|
|
g.this.w.removeMessages(16, cVar3);
|
|
Feature feature = cVar3.b;
|
|
ArrayList arrayList = new ArrayList(aVar7.a.size());
|
|
for (s sVar : aVar7.a) {
|
|
if ((sVar instanceof m0) && (f = ((m0) sVar).f(aVar7)) != null) {
|
|
int length = f.length;
|
|
int i6 = 0;
|
|
while (true) {
|
|
if (i6 >= length) {
|
|
i6 = -1;
|
|
} else if (!AnimatableValueParser.j0(f[i6], feature)) {
|
|
i6++;
|
|
}
|
|
}
|
|
if (i6 >= 0) {
|
|
arrayList.add(sVar);
|
|
}
|
|
}
|
|
}
|
|
int size = arrayList.size();
|
|
while (i3 < size) {
|
|
Object obj = arrayList.get(i3);
|
|
i3++;
|
|
s sVar2 = (s) obj;
|
|
aVar7.a.remove(sVar2);
|
|
sVar2.e(new UnsupportedApiCallException(feature));
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
default:
|
|
StringBuilder sb2 = new StringBuilder(31);
|
|
sb2.append("Unknown message id: ");
|
|
sb2.append(i2);
|
|
Log.w("GoogleApiManager", sb2.toString());
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|