package com.google.android.gms.maps; import android.content.Context; import android.os.RemoteException; import android.view.ViewGroup; import com.google.android.gms.common.GooglePlayServicesNotAvailableException; import com.google.android.gms.dynamic.DeferredLifecycleHelper; import com.google.android.gms.dynamic.ObjectWrapper; import com.google.android.gms.dynamic.OnDelegateCreatedListener; import com.google.android.gms.maps.internal.IMapViewDelegate; import com.google.android.gms.maps.internal.zzcc; import com.google.android.gms.maps.model.RuntimeRemoteException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /* JADX INFO: compiled from: com.google.android.gms:play-services-maps@@19.0.0 */ /* JADX INFO: loaded from: classes2.dex */ final class zzai extends DeferredLifecycleHelper { protected OnDelegateCreatedListener zza; private final ViewGroup zzb; private final Context zzc; private final GoogleMapOptions zzd; private final List zze = new ArrayList(); zzai(ViewGroup viewGroup, Context context, GoogleMapOptions googleMapOptions) { this.zzb = viewGroup; this.zzc = context; this.zzd = googleMapOptions; } @Override // com.google.android.gms.dynamic.DeferredLifecycleHelper protected final void createDelegate(OnDelegateCreatedListener onDelegateCreatedListener) { this.zza = onDelegateCreatedListener; zzb(); } public final void zza(OnMapReadyCallback onMapReadyCallback) { if (getDelegate() != null) { ((zzah) getDelegate()).getMapAsync(onMapReadyCallback); } else { this.zze.add(onMapReadyCallback); } } public final void zzb() { if (this.zza == null || getDelegate() != null) { return; } try { MapsInitializer.initialize(this.zzc); IMapViewDelegate iMapViewDelegateZzg = zzcc.zza(this.zzc, null).zzg(ObjectWrapper.wrap(this.zzc), this.zzd); if (iMapViewDelegateZzg == null) { return; } this.zza.onDelegateCreated(new zzah(this.zzb, iMapViewDelegateZzg)); Iterator it = this.zze.iterator(); while (it.hasNext()) { ((zzah) getDelegate()).getMapAsync((OnMapReadyCallback) it.next()); } this.zze.clear(); } catch (RemoteException e) { throw new RuntimeRemoteException(e); } catch (GooglePlayServicesNotAvailableException unused) { } } }