package com.google.android.gms.tasks; import android.app.Activity; import com.google.android.gms.common.api.internal.LifecycleCallback; import com.google.android.gms.common.api.internal.LifecycleFragment; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /* loaded from: classes2.dex */ final class zzv extends LifecycleCallback { private final List zza; private zzv(LifecycleFragment lifecycleFragment) { super(lifecycleFragment); this.zza = new ArrayList(); this.mLifecycleFragment.addCallback("TaskOnStopCallback", this); } public static zzv zza(Activity activity) { LifecycleFragment fragment = getFragment(activity); zzv zzvVar = (zzv) fragment.getCallbackOrNull("TaskOnStopCallback", zzv.class); return zzvVar == null ? new zzv(fragment) : zzvVar; } @Override // com.google.android.gms.common.api.internal.LifecycleCallback public final void onStop() { synchronized (this.zza) { Iterator it = this.zza.iterator(); while (it.hasNext()) { zzq zzqVar = (zzq) ((WeakReference) it.next()).get(); if (zzqVar != null) { zzqVar.zzc(); } } this.zza.clear(); } } public final void zzb(zzq zzqVar) { synchronized (this.zza) { this.zza.add(new WeakReference(zzqVar)); } } }