package yh;

import java.util.Collections;
import java.util.Iterator;
import java.util.Set;
import java.util.WeakHashMap;

/* loaded from: classes4.dex */
class a implements l {

    /* renamed from: p, reason: collision with root package name */
    private final Set f52737p = Collections.newSetFromMap(new WeakHashMap());

    /* renamed from: q, reason: collision with root package name */
    private boolean f52738q;

    /* renamed from: r, reason: collision with root package name */
    private boolean f52739r;

    @Override // yh.l
    public void a(n nVar) {
        this.f52737p.add(nVar);
        if (this.f52739r) {
            nVar.onDestroy();
        } else if (this.f52738q) {
            nVar.onStart();
        } else {
            nVar.onStop();
        }
    }

    @Override // yh.l
    public void b(n nVar) {
        this.f52737p.remove(nVar);
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public void c() {
        this.f52739r = true;
        Iterator it = ei.l.i(this.f52737p).iterator();
        while (it.hasNext()) {
            ((n) it.next()).onDestroy();
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public void d() {
        this.f52738q = true;
        Iterator it = ei.l.i(this.f52737p).iterator();
        while (it.hasNext()) {
            ((n) it.next()).onStart();
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public void e() {
        this.f52738q = false;
        Iterator it = ei.l.i(this.f52737p).iterator();
        while (it.hasNext()) {
            ((n) it.next()).onStop();
        }
    }
}
