package k.c.a;

import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.SystemClock;

/* JADX INFO: compiled from: HandlerPoster.java */
/* JADX INFO: loaded from: classes.dex */
public final class f extends Handler {
    public final i a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final int f4953b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final c f4954c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public boolean f4955d;

    public f(c cVar, Looper looper, int i2) {
        super(looper);
        this.f4954c = cVar;
        this.f4953b = i2;
        this.a = new i();
    }

    @Override // android.os.Handler
    public void handleMessage(Message message) {
        try {
            long jUptimeMillis = SystemClock.uptimeMillis();
            do {
                h hVarB = this.a.b();
                if (hVarB == null) {
                    synchronized (this) {
                        hVarB = this.a.b();
                        if (hVarB == null) {
                            this.f4955d = false;
                            return;
                        }
                    }
                }
                this.f4954c.d(hVarB);
            } while (SystemClock.uptimeMillis() - jUptimeMillis < this.f4953b);
            if (!sendMessage(obtainMessage())) {
                throw new e("Could not send handler message");
            }
            this.f4955d = true;
        } finally {
            this.f4955d = false;
        }
    }
}
