package rj;

import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

/* loaded from: classes3.dex */
public abstract class g0 {

    /* renamed from: a, reason: collision with root package name */
    protected final h0 f34803a;

    /* renamed from: b, reason: collision with root package name */
    private final IntentFilter f34804b;

    /* renamed from: c, reason: collision with root package name */
    private final Context f34805c;

    /* renamed from: d, reason: collision with root package name */
    protected final Set f34806d = new HashSet();

    /* renamed from: e, reason: collision with root package name */
    private f0 f34807e = null;

    /* renamed from: f, reason: collision with root package name */
    private volatile boolean f34808f = false;

    /* JADX INFO: Access modifiers changed from: protected */
    public g0(h0 h0Var, IntentFilter intentFilter, Context context) {
        this.f34803a = h0Var;
        this.f34804b = intentFilter;
        this.f34805c = f.a(context);
    }

    private final void a() {
        f0 f0Var;
        if ((this.f34808f || !this.f34806d.isEmpty()) && this.f34807e == null) {
            f0 f0Var2 = new f0(this, null);
            this.f34807e = f0Var2;
            if (Build.VERSION.SDK_INT >= 33) {
                this.f34805c.registerReceiver(f0Var2, this.f34804b, 2);
            } else {
                this.f34805c.registerReceiver(f0Var2, this.f34804b);
            }
        }
        if (this.f34808f || !this.f34806d.isEmpty() || (f0Var = this.f34807e) == null) {
            return;
        }
        this.f34805c.unregisterReceiver(f0Var);
        this.f34807e = null;
    }

    /* JADX INFO: Access modifiers changed from: protected */
    public abstract void b(Context context, Intent intent);

    public final synchronized void c(boolean z10) {
        this.f34808f = z10;
        a();
    }

    public final synchronized void d(Object obj) {
        Iterator it = new HashSet(this.f34806d).iterator();
        if (it.hasNext()) {
            android.support.v4.media.session.b.a(it.next());
            throw null;
        }
    }

    public final synchronized boolean e() {
        return this.f34807e != null;
    }
}
