package mm;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/* loaded from: classes3.dex */
class d {

    /* renamed from: a, reason: collision with root package name */
    private final Object f29227a;

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

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

    /* renamed from: d, reason: collision with root package name */
    private boolean f29230d = true;

    /* JADX INFO: Access modifiers changed from: package-private */
    public d(Object obj, Method method) {
        if (obj == null) {
            throw new NullPointerException("EventHandler target cannot be null.");
        }
        if (method == null) {
            throw new NullPointerException("EventHandler method cannot be null.");
        }
        this.f29227a = obj;
        this.f29228b = method;
        method.setAccessible(true);
        this.f29229c = ((method.hashCode() + 31) * 31) + obj.hashCode();
    }

    public void a(Object obj) {
        if (!this.f29230d) {
            throw new IllegalStateException(toString() + " has been invalidated and can no longer handle events.");
        }
        try {
            this.f29228b.invoke(this.f29227a, obj);
        } catch (IllegalAccessException e10) {
            throw new AssertionError(e10);
        } catch (InvocationTargetException e11) {
            if (!(e11.getCause() instanceof Error)) {
                throw e11;
            }
            throw ((Error) e11.getCause());
        }
    }

    public void b() {
        this.f29230d = false;
    }

    public boolean c() {
        return this.f29230d;
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        d dVar = (d) obj;
        return this.f29228b.equals(dVar.f29228b) && this.f29227a == dVar.f29227a;
    }

    public int hashCode() {
        return this.f29229c;
    }

    public String toString() {
        return "[EventHandler " + this.f29228b + "]";
    }
}
