package d;

import android.os.Looper;
import android.os.SystemClock;
import android.view.View;
import android.view.ViewTreeObserver;

/* JADX INFO: renamed from: d.i, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class ViewTreeObserverOnDrawListenerC1830i implements InterfaceExecutorC1829h, ViewTreeObserver.OnDrawListener, Runnable {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final long f14483a = SystemClock.uptimeMillis() + ((long) 10000);

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public Runnable f14484b;

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ AbstractActivityC1833l f14486d;

    public ViewTreeObserverOnDrawListenerC1830i(AbstractActivityC1833l abstractActivityC1833l) {
        this.f14486d = abstractActivityC1833l;
    }

    public final void a(View view) {
        if (this.f14485c) {
            return;
        }
        this.f14485c = true;
        view.getViewTreeObserver().addOnDrawListener(this);
    }

    @Override // java.util.concurrent.Executor
    public final void execute(Runnable runnable) {
        kotlin.jvm.internal.o.h(runnable, "runnable");
        this.f14484b = runnable;
        View decorView = this.f14486d.getWindow().getDecorView();
        kotlin.jvm.internal.o.g(decorView, "window.decorView");
        if (!this.f14485c) {
            decorView.postOnAnimation(new F1.r(this, 16));
        } else if (kotlin.jvm.internal.o.c(Looper.myLooper(), Looper.getMainLooper())) {
            decorView.invalidate();
        } else {
            decorView.postInvalidate();
        }
    }

    @Override // android.view.ViewTreeObserver.OnDrawListener
    public final void onDraw() {
        boolean z6;
        Runnable runnable = this.f14484b;
        if (runnable == null) {
            if (SystemClock.uptimeMillis() > this.f14483a) {
                this.f14485c = false;
                this.f14486d.getWindow().getDecorView().post(this);
                return;
            }
            return;
        }
        runnable.run();
        this.f14484b = null;
        C1841t fullyDrawnReporter = this.f14486d.getFullyDrawnReporter();
        synchronized (fullyDrawnReporter.f14495a) {
            z6 = fullyDrawnReporter.f14496b;
        }
        if (z6) {
            this.f14485c = false;
            this.f14486d.getWindow().getDecorView().post(this);
        }
    }

    @Override // java.lang.Runnable
    public final void run() {
        this.f14486d.getWindow().getDecorView().getViewTreeObserver().removeOnDrawListener(this);
    }
}
