package o;

import android.content.Context;
import android.graphics.Rect;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.TextView;
import com.google.android.gms.common.R;
import java.util.concurrent.atomic.AtomicMarkableReference;
import java.util.concurrent.atomic.AtomicReference;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class Zf0 {
    public final Object a;
    public final Object b;
    public Object c;
    public final Object d;
    public final Object e;
    public final Object f;
    public final Object g;

    public Zf0(Context context) {
        WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
        this.d = layoutParams;
        this.e = new Rect();
        this.f = new int[2];
        this.g = new int[2];
        this.a = context;
        View viewInflate = LayoutInflater.from(context).inflate(R.layout.abc_tooltip, (ViewGroup) null);
        this.b = viewInflate;
        this.c = (TextView) viewInflate.findViewById(R.id.message);
        layoutParams.setTitle(Zf0.class.getSimpleName());
        layoutParams.packageName = context.getPackageName();
        layoutParams.type = 1002;
        layoutParams.width = -2;
        layoutParams.height = -2;
        layoutParams.format = -3;
        layoutParams.windowAnimations = R.style.Animation_AppCompat_Tooltip;
        layoutParams.flags = 24;
    }

    public void a(String str) {
        C0949cs c0949cs = (C0949cs) this.e;
        synchronized (c0949cs) {
            try {
                if (((XJ) ((AtomicMarkableReference) c0949cs.b).getReference()).b(str)) {
                    AtomicMarkableReference atomicMarkableReference = (AtomicMarkableReference) c0949cs.b;
                    atomicMarkableReference.set((XJ) atomicMarkableReference.getReference(), true);
                    RunnableC2108p1 runnableC2108p1 = new RunnableC2108p1(24, c0949cs);
                    AtomicReference atomicReference = (AtomicReference) c0949cs.c;
                    while (!atomicReference.compareAndSet(null, runnableC2108p1)) {
                        if (atomicReference.get() != null) {
                            return;
                        }
                    }
                    ((ExecutorC0014Ao) ((C3126zm0) ((Zf0) c0949cs.d).b).n).a(runnableC2108p1);
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public Zf0(String str, C1533iy c1533iy, C3126zm0 c3126zm0) {
        this.d = new C0949cs(this, false);
        this.e = new C0949cs(this, true);
        this.f = new C1257g30();
        this.g = new AtomicMarkableReference(null, false);
        this.c = str;
        this.a = new C2710vP(c1533iy);
        this.b = c3126zm0;
    }
}
