package c.a;

import java.util.concurrent.TimeUnit;

/* JADX INFO: compiled from: Observable.java */
/* JADX INFO: loaded from: classes.dex */
public abstract class d<T> implements e<T> {
    public static int b() {
        return b.a();
    }

    public static d<Long> c(long j, long j2, TimeUnit timeUnit, g gVar) {
        c.a.q.b.b.c(timeUnit, "unit is null");
        c.a.q.b.b.c(gVar, "scheduler is null");
        return c.a.r.a.k(new c.a.q.e.a.b(Math.max(0L, j), Math.max(0L, j2), timeUnit, gVar));
    }

    public static d<Long> d(long j, TimeUnit timeUnit) {
        return c(j, j, timeUnit, c.a.s.a.a());
    }

    public static <T> d<T> e(T t) {
        c.a.q.b.b.c(t, "The item is null");
        return c.a.r.a.k(new c.a.q.e.a.c(t));
    }

    public static d<Long> k(long j, TimeUnit timeUnit) {
        return l(j, timeUnit, c.a.s.a.a());
    }

    public static d<Long> l(long j, TimeUnit timeUnit, g gVar) {
        c.a.q.b.b.c(timeUnit, "unit is null");
        c.a.q.b.b.c(gVar, "scheduler is null");
        return c.a.r.a.k(new c.a.q.e.a.f(Math.max(j, 0L), timeUnit, gVar));
    }

    @Override // c.a.e
    public final void a(f<? super T> fVar) {
        c.a.q.b.b.c(fVar, "observer is null");
        try {
            f<? super T> fVarR = c.a.r.a.r(this, fVar);
            c.a.q.b.b.c(fVarR, "Plugin returned null Observer");
            j(fVarR);
        } catch (NullPointerException e2) {
            throw e2;
        } catch (Throwable th) {
            c.a.o.b.b(th);
            c.a.r.a.o(th);
            NullPointerException nullPointerException = new NullPointerException("Actually not, but can't throw other exceptions due to RS");
            nullPointerException.initCause(th);
            throw nullPointerException;
        }
    }

    public final d<T> f(g gVar) {
        return g(gVar, false, b());
    }

    public final d<T> g(g gVar, boolean z, int i) {
        c.a.q.b.b.c(gVar, "scheduler is null");
        c.a.q.b.b.d(i, "bufferSize");
        return c.a.r.a.k(new c.a.q.e.a.d(this, gVar, z, i));
    }

    public final c.a.n.b h(c.a.p.e<? super T> eVar) {
        return i(eVar, c.a.q.b.a.f1743f, c.a.q.b.a.f1740c, c.a.q.b.a.a());
    }

    public final c.a.n.b i(c.a.p.e<? super T> eVar, c.a.p.e<? super Throwable> eVar2, c.a.p.a aVar, c.a.p.e<? super c.a.n.b> eVar3) {
        c.a.q.b.b.c(eVar, "onNext is null");
        c.a.q.b.b.c(eVar2, "onError is null");
        c.a.q.b.b.c(aVar, "onComplete is null");
        c.a.q.b.b.c(eVar3, "onSubscribe is null");
        c.a.q.d.d dVar = new c.a.q.d.d(eVar, eVar2, aVar, eVar3);
        a(dVar);
        return dVar;
    }

    protected abstract void j(f<? super T> fVar);
}
