package io.reactivex.android.plugins; import io.reactivex.Scheduler; import io.reactivex.exceptions.Exceptions; import io.reactivex.functions.Function; import java.util.concurrent.Callable; /* loaded from: classes2.dex */ public final class RxAndroidPlugins { private static volatile Function, Scheduler> a; private static volatile Function b; public static Scheduler a(Scheduler scheduler) { if (scheduler == null) { throw new NullPointerException("scheduler == null"); } Function function = b; return function == null ? scheduler : (Scheduler) a((Function) function, scheduler); } public static Scheduler b(Callable callable) { if (callable == null) { throw new NullPointerException("scheduler == null"); } Function, Scheduler> function = a; return function == null ? a(callable) : a(function, callable); } static Scheduler a(Callable callable) { try { Scheduler call = callable.call(); if (call != null) { return call; } throw new NullPointerException("Scheduler Callable returned null"); } catch (Throwable th) { Exceptions.a(th); throw null; } } static Scheduler a(Function, Scheduler> function, Callable callable) { Scheduler scheduler = (Scheduler) a((Function, R>) function, callable); if (scheduler != null) { return scheduler; } throw new NullPointerException("Scheduler Callable returned null"); } static R a(Function function, T t) { try { return function.apply(t); } catch (Throwable th) { Exceptions.a(th); throw null; } } }