package o;

import android.view.ViewGroup;
import com.google.android.gms.common.R;
import java.lang.ref.WeakReference;
import java.util.ArrayList;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public abstract class Ig0 {
    public static final C0493Ta a;
    public static final ThreadLocal b;
    public static final ArrayList c;

    static {
        C0493Ta c0493Ta = new C0493Ta();
        c0493Ta.N = false;
        c0493Ta.K(new C0023Ax(2));
        c0493Ta.K(new C0577Wg());
        c0493Ta.K(new C0023Ax(1));
        a = c0493Ta;
        b = new ThreadLocal();
        c = new ArrayList();
    }

    public static void a(ViewGroup viewGroup, AbstractC3019yg0 abstractC3019yg0) {
        ArrayList arrayList = c;
        if (arrayList.contains(viewGroup) || !viewGroup.isLaidOut()) {
            return;
        }
        arrayList.add(viewGroup);
        if (abstractC3019yg0 == null) {
            abstractC3019yg0 = a;
        }
        AbstractC3019yg0 abstractC3019yg0Clone = abstractC3019yg0.clone();
        ArrayList arrayList2 = (ArrayList) b().get(viewGroup);
        if (arrayList2 != null && arrayList2.size() > 0) {
            int size = arrayList2.size();
            int i = 0;
            while (i < size) {
                Object obj = arrayList2.get(i);
                i++;
                ((AbstractC3019yg0) obj).x(viewGroup);
            }
        }
        abstractC3019yg0Clone.i(viewGroup, true);
        if (viewGroup.getTag(R.id.transition_current_scene) != null) {
            throw new ClassCastException();
        }
        viewGroup.setTag(R.id.transition_current_scene, null);
        Hg0 hg0 = new Hg0();
        hg0.l = abstractC3019yg0Clone;
        hg0.m = viewGroup;
        viewGroup.addOnAttachStateChangeListener(hg0);
        viewGroup.getViewTreeObserver().addOnPreDrawListener(hg0);
    }

    public static C1839m9 b() {
        C1839m9 c1839m9;
        ThreadLocal threadLocal = b;
        WeakReference weakReference = (WeakReference) threadLocal.get();
        if (weakReference != null && (c1839m9 = (C1839m9) weakReference.get()) != null) {
            return c1839m9;
        }
        C1839m9 c1839m92 = new C1839m9(0);
        threadLocal.set(new WeakReference(c1839m92));
        return c1839m92;
    }
}
