package o;

import android.os.Looper;
import android.os.SystemClock;
import android.view.View;
import android.view.ViewTreeObserver;
import androidx.activity.ComponentActivity;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.Ej, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class ViewTreeObserverOnDrawListenerC0113Ej implements InterfaceExecutorC0087Dj, ViewTreeObserver.OnDrawListener, Runnable {
    public final long l = SystemClock.uptimeMillis() + 10000;
    public Runnable m;
    public boolean n;

    /* renamed from: o, reason: collision with root package name */
    public final /* synthetic */ ComponentActivity f108o;

    public ViewTreeObserverOnDrawListenerC0113Ej(ComponentActivity componentActivity) {
        this.f108o = componentActivity;
    }

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

    @Override // java.util.concurrent.Executor
    public final void execute(Runnable runnable) {
        this.m = runnable;
        View decorView = this.f108o.getWindow().getDecorView();
        if (!this.n) {
            decorView.postOnAnimation(new RunnableC2108p1(6, this));
        } else if (F3.c(Looper.myLooper(), Looper.getMainLooper())) {
            decorView.invalidate();
        } else {
            decorView.postInvalidate();
        }
    }

    @Override // android.view.ViewTreeObserver.OnDrawListener
    public final void onDraw() {
        boolean z;
        Runnable runnable = this.m;
        if (runnable == null) {
            if (SystemClock.uptimeMillis() > this.l) {
                this.n = false;
                this.f108o.getWindow().getDecorView().post(this);
                return;
            }
            return;
        }
        runnable.run();
        this.m = null;
        MC fullyDrawnReporter = this.f108o.getFullyDrawnReporter();
        synchronized (fullyDrawnReporter.a) {
            z = fullyDrawnReporter.b;
        }
        if (z) {
            this.n = false;
            this.f108o.getWindow().getDecorView().post(this);
        }
    }

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