2021-08-09 22:50:52 +00:00
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 ;
2021-10-11 07:48:45 +00:00
import c.c.a.a0.d ;
2021-08-09 22:50:52 +00:00
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.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 ;
2021-11-01 07:19:03 +00:00
public final AtomicInteger r ;
2021-08-09 22:50:52 +00:00
2021-11-01 07:19:03 +00:00
/* renamed from: s reason: collision with root package name */
2021-11-05 21:05:33 +00:00
public final Map < b < ? > , a < ? > > f1079s ;
2021-08-09 22:50:52 +00:00
@Nullable
2021-09-07 07:54:21 +00:00
public a1 t ;
2021-08-09 22:50:52 +00:00
public final Set < b < ? > > u ;
public final Set < b < ? > > v ;
@NotOnlyInitialized
2021-11-01 07:19:03 +00:00
public final Handler w ;
2021-08-09 22:50:52 +00:00
/* renamed from: x reason: collision with root package name */
2021-11-05 21:05:33 +00:00
public volatile boolean f1080x ;
2021-08-09 22:50:52 +00:00
/* 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 */
2021-11-05 21:05:33 +00:00
public final a . b f1081c ;
2021-08-09 22:50:52 +00:00
public final b < O > d ;
2021-09-07 07:54:21 +00:00
public final x0 e ;
public final Set < r0 > f = new HashSet ( ) ;
2021-08-09 22:50:52 +00:00
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 ) {
2021-11-01 07:19:03 +00:00
Looper looper = g . this . w . getLooper ( ) ;
2021-08-09 22:50:52 +00:00
c . i . a . f . e . k . c a = bVar . a ( ) . a ( ) ;
c . i . a . f . e . h . a < O > aVar = bVar . b ;
2021-10-11 07:48:45 +00:00
d . G ( aVar . a ! = null , " This API was constructed with a SimpleClientBuilder. Use getSimpleClientBuilder " ) ;
2021-11-05 21:05:33 +00:00
a . AbstractC0105a < ? , O > aVar2 = aVar . a ;
2021-08-09 22:50:52 +00:00
Objects . requireNonNull ( aVar2 , " null reference " ) ;
2021-11-05 21:05:33 +00:00
a . f a2 = aVar2 . a ( bVar . a , looper , a , bVar . f1074c , this , this ) ;
2021-08-09 22:50:52 +00:00
this . b = a2 ;
if ( ! ( a2 instanceof z ) ) {
2021-11-05 21:05:33 +00:00
this . f1081c = a2 ;
2021-08-09 22:50:52 +00:00
this . d = bVar . d ;
2021-09-07 07:54:21 +00:00
this . e = new x0 ( ) ;
2021-08-09 22:50:52 +00:00
this . h = bVar . f ;
if ( a2 . o ( ) ) {
2021-11-01 07:19:03 +00:00
this . i = new g0 ( g . this . n , g . this . w , bVar . a ( ) . a ( ) ) ;
2021-08-09 22:50:52 +00:00
} 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 ) {
2021-11-05 21:05:33 +00:00
arrayMap . put ( feature . i , Long . valueOf ( feature . w0 ( ) ) ) ;
2021-08-09 22:50:52 +00:00
}
for ( Feature feature2 : featureArr ) {
Long l = arrayMap . get ( feature2 . i ) ;
2021-11-05 21:05:33 +00:00
if ( l = = null | | l . longValue ( ) < feature2 . w0 ( ) ) {
2021-08-09 22:50:52 +00:00
return feature2 ;
}
}
}
return null ;
}
@WorkerThread
public final void b ( ) {
2021-11-01 07:19:03 +00:00
d . s ( g . this . w ) ;
2021-08-09 22:50:52 +00:00
Status status = g . i ;
f ( status ) ;
2021-09-07 07:54:21 +00:00
x0 x0Var = this . e ;
Objects . requireNonNull ( x0Var ) ;
x0Var . a ( false , status ) ;
2021-08-09 22:50:52 +00:00
for ( k . a aVar : ( k . a [ ] ) this . g . keySet ( ) . toArray ( new k . a [ 0 ] ) ) {
2021-09-07 07:54:21 +00:00
j ( new p0 ( aVar , new TaskCompletionSource ( ) ) ) ;
2021-08-09 22:50:52 +00:00
}
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 ;
2021-09-07 07:54:21 +00:00
x0 x0Var = this . e ;
2021-08-09 22:50:52 +00:00
String n = this . b . n ( ) ;
2021-09-07 07:54:21 +00:00
Objects . requireNonNull ( x0Var ) ;
2021-08-09 22:50:52 +00:00
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 ) ;
}
2021-09-07 07:54:21 +00:00
x0Var . a ( true , new Status ( 20 , sb . toString ( ) ) ) ;
2021-11-01 07:19:03 +00:00
Handler handler = g . this . w ;
2021-08-09 22:50:52 +00:00
Message obtain = Message . obtain ( handler , 9 , this . d ) ;
Objects . requireNonNull ( g . this ) ;
handler . sendMessageDelayed ( obtain , 5000 ) ;
2021-11-01 07:19:03 +00:00
Handler handler2 = g . this . w ;
2021-08-09 22:50:52 +00:00
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 ( ) ) {
2021-11-05 21:05:33 +00:00
d0Var . f1078c . run ( ) ;
2021-08-09 22:50:52 +00:00
}
}
@WorkerThread
public final void d ( @NonNull ConnectionResult connectionResult , @Nullable Exception exc ) {
f fVar ;
2021-11-01 07:19:03 +00:00
d . s ( g . this . w ) ;
2021-08-09 22:50:52 +00:00
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 ) {
2021-11-01 07:19:03 +00:00
d . s ( g . this . w ) ;
2021-08-09 22:50:52 +00:00
i ( null , exc , false ) ;
2021-11-05 21:05:33 +00:00
} else if ( ! g . this . f1080x ) {
2021-08-09 22:50:52 +00:00
Status p = p ( connectionResult ) ;
2021-11-01 07:19:03 +00:00
d . s ( g . this . w ) ;
2021-08-09 22:50:52 +00:00
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 ) {
2021-11-01 07:19:03 +00:00
Handler handler = g . this . w ;
2021-08-09 22:50:52 +00:00
Message obtain = Message . obtain ( handler , 9 , this . d ) ;
Objects . requireNonNull ( g . this ) ;
handler . sendMessageDelayed ( obtain , 5000 ) ;
return ;
}
Status p2 = p ( connectionResult ) ;
2021-11-01 07:19:03 +00:00
d . s ( g . this . w ) ;
2021-08-09 22:50:52 +00:00
i ( p2 , null , false ) ;
}
}
}
@Override // c.i.a.f.e.h.j.f
public final void e ( int i ) {
2021-11-01 07:19:03 +00:00
if ( Looper . myLooper ( ) = = g . this . w . getLooper ( ) ) {
2021-08-09 22:50:52 +00:00
c ( i ) ;
} else {
2021-11-01 07:19:03 +00:00
g . this . w . post ( new v ( this , i ) ) ;
2021-08-09 22:50:52 +00:00
}
}
@WorkerThread
public final void f ( Status status ) {
2021-11-01 07:19:03 +00:00
d . s ( g . this . w ) ;
2021-08-09 22:50:52 +00:00
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 ) {
2021-11-01 07:19:03 +00:00
if ( Looper . myLooper ( ) = = g . this . w . getLooper ( ) ) {
2021-08-09 22:50:52 +00:00
t ( ) ;
} else {
2021-11-01 07:19:03 +00:00
g . this . w . post ( new u ( this ) ) ;
2021-08-09 22:50:52 +00:00
}
}
@WorkerThread
public final void i ( @Nullable Status status , @Nullable Exception exc , boolean z2 ) {
2021-11-01 07:19:03 +00:00
d . s ( g . this . w ) ;
2021-08-09 22:50:52 +00:00
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 ) {
2021-11-01 07:19:03 +00:00
d . s ( g . this . w ) ;
2021-08-09 22:50:52 +00:00
if ( ! this . b . j ( ) ) {
this . a . add ( sVar ) ;
ConnectionResult connectionResult = this . l ;
2021-11-05 21:05:33 +00:00
if ( connectionResult = = null | | ! connectionResult . w0 ( ) ) {
2021-08-09 22:50:52 +00:00
r ( ) ;
} else {
d ( this . l , null ) ;
}
} else if ( m ( sVar ) ) {
w ( ) ;
} else {
this . a . add ( sVar ) ;
}
}
@WorkerThread
public final boolean k ( boolean z2 ) {
2021-11-01 07:19:03 +00:00
d . s ( g . this . w ) ;
2021-08-09 22:50:52 +00:00
if ( ! this . b . j ( ) | | this . g . size ( ) ! = 0 ) {
return false ;
}
2021-09-07 07:54:21 +00:00
x0 x0Var = this . e ;
if ( ! x0Var . a . isEmpty ( ) | | ! x0Var . b . isEmpty ( ) ) {
2021-08-09 22:50:52 +00:00
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 ) {
2021-09-07 07:54:21 +00:00
if ( ! ( sVar instanceof m0 ) ) {
2021-08-09 22:50:52 +00:00
o ( sVar ) ;
return true ;
}
2021-09-07 07:54:21 +00:00
m0 m0Var = ( m0 ) sVar ;
Feature a = a ( m0Var . f ( this ) ) ;
2021-08-09 22:50:52 +00:00
if ( a = = null ) {
o ( sVar ) ;
return true ;
}
2021-11-05 21:05:33 +00:00
String name = this . f1081c . getClass ( ) . getName ( ) ;
2021-08-09 22:50:52 +00:00
String str = a . i ;
2021-11-05 21:05:33 +00:00
long w0 = a . w0 ( ) ;
StringBuilder Q = c . d . b . a . a . Q ( c . d . b . a . a . b ( str , name . length ( ) + 77 ) , name , " could not execute call because it requires feature ( " , str , " , " ) ;
Q . append ( w0 ) ;
Q . append ( " ). " ) ;
Log . w ( " GoogleApiManager " , Q . toString ( ) ) ;
if ( ! g . this . f1080x | | ! m0Var . g ( this ) ) {
2021-09-07 07:54:21 +00:00
m0Var . e ( new UnsupportedApiCallException ( a ) ) ;
2021-08-09 22:50:52 +00:00
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 ) ;
2021-11-01 07:19:03 +00:00
g . this . w . removeMessages ( 15 , cVar2 ) ;
Handler handler = g . this . w ;
2021-08-09 22:50:52 +00:00
Message obtain = Message . obtain ( handler , 15 , cVar2 ) ;
Objects . requireNonNull ( g . this ) ;
handler . sendMessageDelayed ( obtain , 5000 ) ;
return false ;
}
this . k . add ( cVar ) ;
2021-11-01 07:19:03 +00:00
Handler handler2 = g . this . w ;
2021-08-09 22:50:52 +00:00
Message obtain2 = Message . obtain ( handler2 , 15 , cVar ) ;
Objects . requireNonNull ( g . this ) ;
handler2 . sendMessageDelayed ( obtain2 , 5000 ) ;
2021-11-01 07:19:03 +00:00
Handler handler3 = g . this . w ;
2021-08-09 22:50:52 +00:00
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 ) {
2021-09-07 07:54:21 +00:00
Iterator < r0 > it = this . f . iterator ( ) ;
2021-08-09 22:50:52 +00:00
if ( it . hasNext ( ) ) {
2021-09-07 07:54:21 +00:00
r0 next = it . next ( ) ;
2021-11-05 21:05:33 +00:00
if ( d . g0 ( connectionResult , ConnectionResult . i ) ) {
2021-08-09 22:50:52 +00:00
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 ) {
2021-11-05 21:05:33 +00:00
throw new IllegalStateException ( String . format ( " Error in GoogleApi implementation for client %s. " , this . f1081c . getClass ( ) . getName ( ) ) , th ) ;
2021-08-09 22:50:52 +00:00
}
}
public final Status p ( ConnectionResult connectionResult ) {
2021-11-05 21:05:33 +00:00
String str = this . d . b . f1073c ;
2021-08-09 22:50:52 +00:00
String valueOf = String . valueOf ( connectionResult ) ;
2021-11-05 21:05:33 +00:00
return new Status ( 17 , c . d . b . a . a . k ( valueOf . length ( ) + c . d . b . a . a . b ( str , 63 ) , " API: " , str , " is not available on this device. Connection failed with: " , valueOf ) ) ;
2021-08-09 22:50:52 +00:00
}
@WorkerThread
public final void q ( ) {
2021-11-01 07:19:03 +00:00
d . s ( g . this . w ) ;
2021-08-09 22:50:52 +00:00
this . l = null ;
}
@WorkerThread
public final void r ( ) {
2021-11-01 07:19:03 +00:00
d . s ( g . this . w ) ;
2021-08-09 22:50:52 +00:00
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 ) ;
2021-11-05 21:05:33 +00:00
String name = this . f1081c . getClass ( ) . getName ( ) ;
2021-08-09 22:50:52 +00:00
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 ) ) ;
2021-11-05 21:05:33 +00:00
a . AbstractC0105a < ? extends f , c . i . a . f . l . a > aVar = g0Var . d ;
2021-08-09 22:50:52 +00:00
Context context = g0Var . b ;
2021-11-05 21:05:33 +00:00
Looper looper = g0Var . f1083c . getLooper ( ) ;
2021-08-09 22:50:52 +00:00
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 ( ) ) {
2021-11-05 21:05:33 +00:00
g0Var . f1083c . post ( new f0 ( g0Var ) ) ;
2021-08-09 22:50:52 +00:00
} 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 ;
2021-11-05 21:05:33 +00:00
a . b bVar = this . f1081c ;
2021-08-09 22:50:52 +00:00
TaskCompletionSource taskCompletionSource = new TaskCompletionSource ( ) ;
v vVar = ( v ) mVar ;
Objects . requireNonNull ( vVar ) ;
2021-11-05 21:05:33 +00:00
vVar . b . a ( ( c . i . a . f . j . b . e . f ) bVar , i . j ( vVar . f1255c , taskCompletionSource ) ) ;
2021-08-09 22:50:52 +00:00
} 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 ) {
2021-11-01 07:19:03 +00:00
g . this . w . removeMessages ( 11 , this . d ) ;
g . this . w . removeMessages ( 9 , this . d ) ;
2021-08-09 22:50:52 +00:00
this . j = false ;
}
}
public final void w ( ) {
2021-11-01 07:19:03 +00:00
g . this . w . removeMessages ( 12 , this . d ) ;
Handler handler = g . this . w ;
2021-08-09 22:50:52 +00:00
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 */
2021-11-05 21:05:33 +00:00
public c . i . a . f . e . k . g f1082c = null ;
2021-08-09 22:50:52 +00:00
@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 ) {
2021-11-01 07:19:03 +00:00
g . this . w . post ( new z ( this , connectionResult ) ) ;
2021-08-09 22:50:52 +00:00
}
@WorkerThread
public final void b ( ConnectionResult connectionResult ) {
2021-11-05 21:05:33 +00:00
a < ? > aVar = g . this . f1079s . get ( this . b ) ;
2021-08-09 22:50:52 +00:00
if ( aVar ! = null ) {
2021-11-01 07:19:03 +00:00
d . s ( g . this . w ) ;
2021-08-09 22:50:52 +00:00
a . f fVar = aVar . b ;
2021-11-05 21:05:33 +00:00
String name = aVar . f1081c . getClass ( ) . getName ( ) ;
2021-08-09 22:50:52 +00:00
String valueOf = String . valueOf ( connectionResult ) ;
2021-11-05 21:05:33 +00:00
fVar . c ( c . d . b . a . a . k ( valueOf . length ( ) + name . length ( ) + 25 , " onSignInFailed for " , name , " with " , valueOf ) ) ;
2021-08-09 22:50:52 +00:00
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 ;
2021-11-05 21:05:33 +00:00
if ( d . g0 ( this . a , cVar . a ) & & d . g0 ( this . b , cVar . b ) ) {
2021-08-09 22:50:52 +00:00
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 ) ;
2021-11-01 07:19:03 +00:00
this . r = new AtomicInteger ( 0 ) ;
2021-11-05 21:05:33 +00:00
this . f1079s = new ConcurrentHashMap ( 5 , 0 . 75f , 1 ) ;
2021-08-09 22:50:52 +00:00
this . t = null ;
this . u = new ArraySet ( ) ;
this . v = new ArraySet ( ) ;
2021-11-05 21:05:33 +00:00
this . f1080x = true ;
2021-08-09 22:50:52 +00:00
this . n = context ;
c . i . a . f . h . e . c cVar = new c . i . a . f . h . e . c ( looper , this ) ;
2021-11-01 07:19:03 +00:00
this . w = cVar ;
2021-08-09 22:50:52 +00:00
this . o = googleApiAvailability ;
this . p = new s ( googleApiAvailability ) ;
PackageManager packageManager = context . getPackageManager ( ) ;
2021-11-05 21:05:33 +00:00
if ( d . f = = null ) {
d . f = Boolean . valueOf ( ( ! c . i . a . f . e . o . f . q0 ( ) | | ! packageManager . hasSystemFeature ( " android.hardware.type.automotive " ) ) ? false : z2 ) ;
2021-08-09 22:50:52 +00:00
}
2021-11-05 21:05:33 +00:00
if ( d . f . booleanValue ( ) ) {
this . f1080x = false ;
2021-08-09 22:50:52 +00:00
}
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 ( ) ;
2021-11-25 09:11:30 +00:00
Object obj = GoogleApiAvailability . f2386c ;
2021-08-09 22:50:52 +00:00
l = new g ( applicationContext , looper , GoogleApiAvailability . d ) ;
}
gVar = l ;
}
return gVar ;
}
2021-09-07 07:54:21 +00:00
public final void b ( @NonNull a1 a1Var ) {
2021-08-09 22:50:52 +00:00
synchronized ( k ) {
2021-09-07 07:54:21 +00:00
if ( this . t ! = a1Var ) {
this . t = a1Var ;
2021-08-09 22:50:52 +00:00
this . u . clear ( ) ;
}
2021-09-07 07:54:21 +00:00
this . u . addAll ( a1Var . n ) ;
2021-08-09 22:50:52 +00:00
}
}
public final boolean c ( ConnectionResult connectionResult , int i2 ) {
PendingIntent pendingIntent ;
GoogleApiAvailability googleApiAvailability = this . o ;
Context context = this . n ;
Objects . requireNonNull ( googleApiAvailability ) ;
2021-11-05 21:05:33 +00:00
if ( connectionResult . w0 ( ) ) {
2021-08-09 22:50:52 +00:00
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 ;
2021-11-05 21:05:33 +00:00
a < ? > aVar = this . f1079s . get ( bVar2 ) ;
2021-08-09 22:50:52 +00:00
if ( aVar = = null ) {
aVar = new a < > ( bVar ) ;
2021-11-05 21:05:33 +00:00
this . f1079s . put ( bVar2 , aVar ) ;
2021-08-09 22:50:52 +00:00
}
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 ;
2021-11-01 07:19:03 +00:00
this . w . removeMessages ( 12 ) ;
2021-11-05 21:05:33 +00:00
for ( b < ? > bVar : this . f1079s . keySet ( ) ) {
2021-11-01 07:19:03 +00:00
Handler handler = this . w ;
2021-08-09 22:50:52 +00:00
handler . sendMessageDelayed ( handler . obtainMessage ( 12 , bVar ) , this . m ) ;
}
break ;
case 2 :
2021-09-07 07:54:21 +00:00
Objects . requireNonNull ( ( r0 ) message . obj ) ;
2021-08-09 22:50:52 +00:00
throw null ;
case 3 :
2021-11-05 21:05:33 +00:00
for ( a < ? > aVar2 : this . f1079s . values ( ) ) {
2021-08-09 22:50:52 +00:00
aVar2 . q ( ) ;
aVar2 . r ( ) ;
}
break ;
case 4 :
case 8 :
case 13 :
c0 c0Var = ( c0 ) message . obj ;
2021-11-05 21:05:33 +00:00
a < ? > aVar3 = this . f1079s . get ( c0Var . f1077c . d ) ;
2021-08-09 22:50:52 +00:00
if ( aVar3 = = null ) {
2021-11-05 21:05:33 +00:00
aVar3 = d ( c0Var . f1077c ) ;
2021-08-09 22:50:52 +00:00
}
2021-11-01 07:19:03 +00:00
if ( ! aVar3 . s ( ) | | this . r . get ( ) = = c0Var . b ) {
2021-08-09 22:50:52 +00:00
aVar3 . j ( c0Var . a ) ;
break ;
} else {
c0Var . a . b ( i ) ;
aVar3 . b ( ) ;
break ;
}
2021-11-05 21:05:33 +00:00
break ;
2021-08-09 22:50:52 +00:00
case 5 :
int i4 = message . arg1 ;
ConnectionResult connectionResult = ( ConnectionResult ) message . obj ;
2021-11-05 21:05:33 +00:00
Iterator < a < ? > > it = this . f1079s . values ( ) . iterator ( ) ;
2021-08-09 22:50:52 +00:00
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 ;
2021-11-05 21:05:33 +00:00
String y0 = ConnectionResult . y0 ( i5 ) ;
2021-08-09 22:50:52 +00:00
String str = connectionResult . m ;
2021-11-05 21:05:33 +00:00
Status status = new Status ( 17 , c . d . b . a . a . k ( c . d . b . a . a . b ( str , c . d . b . a . a . b ( y0 , 69 ) ) , " Error resolution was canceled by the user, original error message: " , y0 , " : " , str ) ) ;
2021-11-01 07:19:03 +00:00
d . s ( g . this . w ) ;
2021-08-09 22:50:52 +00:00
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 :
2021-11-05 21:05:33 +00:00
if ( this . f1079s . containsKey ( message . obj ) ) {
a < ? > aVar4 = this . f1079s . get ( message . obj ) ;
2021-11-01 07:19:03 +00:00
d . s ( g . this . w ) ;
2021-08-09 22:50:52 +00:00
if ( aVar4 . j ) {
aVar4 . r ( ) ;
break ;
}
}
break ;
case 10 :
for ( b < ? > bVar2 : this . v ) {
2021-11-05 21:05:33 +00:00
a < ? > remove = this . f1079s . remove ( bVar2 ) ;
2021-08-09 22:50:52 +00:00
if ( remove ! = null ) {
remove . b ( ) ;
}
}
this . v . clear ( ) ;
break ;
case 11 :
2021-11-05 21:05:33 +00:00
if ( this . f1079s . containsKey ( message . obj ) ) {
a < ? > aVar5 = this . f1079s . get ( message . obj ) ;
2021-11-01 07:19:03 +00:00
d . s ( g . this . w ) ;
2021-08-09 22:50:52 +00:00
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. " ) ;
2021-11-01 07:19:03 +00:00
d . s ( g . this . w ) ;
2021-08-09 22:50:52 +00:00
aVar5 . i ( status2 , null , false ) ;
aVar5 . b . c ( " Timing out connection while resuming. " ) ;
break ;
}
}
break ;
case 12 :
2021-11-05 21:05:33 +00:00
if ( this . f1079s . containsKey ( message . obj ) ) {
this . f1079s . get ( message . obj ) . k ( true ) ;
2021-08-09 22:50:52 +00:00
break ;
}
break ;
case 14 :
2021-09-07 07:54:21 +00:00
Objects . requireNonNull ( ( b1 ) message . obj ) ;
2021-11-05 21:05:33 +00:00
if ( ! this . f1079s . containsKey ( null ) ) {
2021-08-09 22:50:52 +00:00
throw null ;
}
2021-11-05 21:05:33 +00:00
this . f1079s . get ( null ) . k ( false ) ;
2021-08-09 22:50:52 +00:00
throw null ;
case 15 :
c cVar2 = ( c ) message . obj ;
2021-11-05 21:05:33 +00:00
if ( this . f1079s . containsKey ( cVar2 . a ) ) {
a < ? > aVar6 = this . f1079s . get ( cVar2 . a ) ;
2021-08-09 22:50:52 +00:00
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 ;
2021-11-05 21:05:33 +00:00
if ( this . f1079s . containsKey ( cVar3 . a ) ) {
a < ? > aVar7 = this . f1079s . get ( cVar3 . a ) ;
2021-08-09 22:50:52 +00:00
if ( aVar7 . k . remove ( cVar3 ) ) {
2021-11-01 07:19:03 +00:00
g . this . w . removeMessages ( 15 , cVar3 ) ;
g . this . w . removeMessages ( 16 , cVar3 ) ;
2021-08-09 22:50:52 +00:00
Feature feature = cVar3 . b ;
ArrayList arrayList = new ArrayList ( aVar7 . a . size ( ) ) ;
for ( s sVar : aVar7 . a ) {
2021-09-07 07:54:21 +00:00
if ( ( sVar instanceof m0 ) & & ( f = ( ( m0 ) sVar ) . f ( aVar7 ) ) ! = null ) {
2021-08-09 22:50:52 +00:00
int length = f . length ;
int i6 = 0 ;
while ( true ) {
if ( i6 > = length ) {
i6 = - 1 ;
2021-11-05 21:05:33 +00:00
} else if ( ! d . g0 ( f [ i6 ] , feature ) ) {
2021-08-09 22:50:52 +00:00
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 :
2021-11-05 21:05:33 +00:00
c . d . b . a . a . d0 ( 31 , " Unknown message id: " , i2 , " GoogleApiManager " ) ;
2021-08-09 22:50:52 +00:00
return false ;
}
return true ;
}
}