package com.google.android.gms.common.internal; import android.content.ComponentName; import android.content.ServiceConnection; import android.os.Handler; import android.os.IBinder; import android.os.IInterface; /* loaded from: classes.dex */ public final class zze implements ServiceConnection { final BaseGmsClient zza; private final int zzb; @Override // android.content.ServiceConnection public final void onServiceConnected(ComponentName componentName, IBinder iBinder) { IGmsServiceBroker zzacVar; BaseGmsClient baseGmsClient = this.zza; if (iBinder == null) { BaseGmsClient.zzk(baseGmsClient, 16); return; } synchronized (BaseGmsClient.zzd(baseGmsClient)) { BaseGmsClient baseGmsClient2 = this.zza; IInterface queryLocalInterface = iBinder.queryLocalInterface("com.google.android.gms.common.internal.IGmsServiceBroker"); if (queryLocalInterface != null && (queryLocalInterface instanceof IGmsServiceBroker)) { zzacVar = (IGmsServiceBroker) queryLocalInterface; } else { zzacVar = new zzac(iBinder); } BaseGmsClient.zzh(baseGmsClient2, zzacVar); } this.zza.zzl(0, null, this.zzb); } @Override // android.content.ServiceConnection public final void onServiceDisconnected(ComponentName componentName) { synchronized (BaseGmsClient.zzd(this.zza)) { BaseGmsClient.zzh(this.zza, null); } Handler handler = this.zza.zzb; handler.sendMessage(handler.obtainMessage(6, this.zzb, 1)); } public zze(BaseGmsClient baseGmsClient, int i) { this.zza = baseGmsClient; this.zzb = i; } }