package o; import android.os.Handler; import android.os.Looper; import android.view.ViewGroup; import androidx.fragment.app.Fragment; import androidx.fragment.app.strictmode.FragmentReuseViolation; import androidx.fragment.app.strictmode.FragmentTagUsageViolation; import androidx.fragment.app.strictmode.GetRetainInstanceUsageViolation; import androidx.fragment.app.strictmode.GetTargetFragmentRequestCodeUsageViolation; import androidx.fragment.app.strictmode.GetTargetFragmentUsageViolation; import androidx.fragment.app.strictmode.SetRetainInstanceUsageViolation; import androidx.fragment.app.strictmode.SetTargetFragmentUsageViolation; import androidx.fragment.app.strictmode.SetUserVisibleHintViolation; import androidx.fragment.app.strictmode.Violation; import androidx.fragment.app.strictmode.WrongFragmentContainerViolation; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; import o.gFT; /* loaded from: classes.dex */ public final class gFT { private static LWm b; /* loaded from: classes.dex */ public enum HBt { PENALTY_LOG, PENALTY_DEATH, DETECT_FRAGMENT_REUSE, DETECT_FRAGMENT_TAG_USAGE, DETECT_RETAIN_INSTANCE_USAGE, DETECT_SET_USER_VISIBLE_HINT, DETECT_TARGET_FRAGMENT_USAGE, DETECT_WRONG_FRAGMENT_CONTAINER } /* loaded from: classes.dex */ public interface Sts { } private gFT() { } static { new gFT(); b = LWm.b; } private static LWm d(Fragment fragment) { while (fragment != null) { if (fragment.isAdded()) { yRS parentFragmentManager = fragment.getParentFragmentManager(); C14957gcv.c(parentFragmentManager, ""); if (parentFragmentManager.y() != null) { LWm y = parentFragmentManager.y(); C14957gcv.e(y); return y; } } fragment = fragment.getParentFragment(); } return b; } public static final void a(Fragment fragment, String str) { C14957gcv.e(fragment, ""); C14957gcv.e(str, ""); FragmentReuseViolation fragmentReuseViolation = new FragmentReuseViolation(fragment, str); if (yRS.b(3)) { Fragment fragment2 = fragmentReuseViolation.b; } LWm d = d(fragment); if (d.e.contains(HBt.DETECT_FRAGMENT_REUSE) && e(d, (Class) fragment.getClass(), (Class) fragmentReuseViolation.getClass())) { a(d, fragmentReuseViolation); } } public static final void zl_(Fragment fragment, ViewGroup viewGroup) { C14957gcv.e(fragment, ""); FragmentTagUsageViolation fragmentTagUsageViolation = new FragmentTagUsageViolation(fragment, viewGroup); if (yRS.b(3)) { Fragment fragment2 = fragmentTagUsageViolation.b; } LWm d = d(fragment); if (d.e.contains(HBt.DETECT_FRAGMENT_TAG_USAGE) && e(d, (Class) fragment.getClass(), (Class) fragmentTagUsageViolation.getClass())) { a(d, fragmentTagUsageViolation); } } public static final void a(Fragment fragment) { C14957gcv.e(fragment, ""); SetRetainInstanceUsageViolation setRetainInstanceUsageViolation = new SetRetainInstanceUsageViolation(fragment); if (yRS.b(3)) { Fragment fragment2 = setRetainInstanceUsageViolation.b; } LWm d = d(fragment); if (d.e.contains(HBt.DETECT_RETAIN_INSTANCE_USAGE) && e(d, (Class) fragment.getClass(), (Class) setRetainInstanceUsageViolation.getClass())) { a(d, setRetainInstanceUsageViolation); } } public static final void b(Fragment fragment) { C14957gcv.e(fragment, ""); GetRetainInstanceUsageViolation getRetainInstanceUsageViolation = new GetRetainInstanceUsageViolation(fragment); if (yRS.b(3)) { Fragment fragment2 = getRetainInstanceUsageViolation.b; } LWm d = d(fragment); if (d.e.contains(HBt.DETECT_RETAIN_INSTANCE_USAGE) && e(d, (Class) fragment.getClass(), (Class) getRetainInstanceUsageViolation.getClass())) { a(d, getRetainInstanceUsageViolation); } } public static final void d(Fragment fragment, boolean z) { C14957gcv.e(fragment, ""); SetUserVisibleHintViolation setUserVisibleHintViolation = new SetUserVisibleHintViolation(fragment, z); if (yRS.b(3)) { Fragment fragment2 = setUserVisibleHintViolation.b; } LWm d = d(fragment); if (d.e.contains(HBt.DETECT_SET_USER_VISIBLE_HINT) && e(d, (Class) fragment.getClass(), (Class) setUserVisibleHintViolation.getClass())) { a(d, setUserVisibleHintViolation); } } public static final void e(Fragment fragment, Fragment fragment2, int i) { C14957gcv.e(fragment, ""); C14957gcv.e(fragment2, ""); SetTargetFragmentUsageViolation setTargetFragmentUsageViolation = new SetTargetFragmentUsageViolation(fragment, fragment2, i); if (yRS.b(3)) { Fragment fragment3 = setTargetFragmentUsageViolation.b; } LWm d = d(fragment); if (d.e.contains(HBt.DETECT_TARGET_FRAGMENT_USAGE) && e(d, (Class) fragment.getClass(), (Class) setTargetFragmentUsageViolation.getClass())) { a(d, setTargetFragmentUsageViolation); } } public static final void e(Fragment fragment) { C14957gcv.e(fragment, ""); GetTargetFragmentUsageViolation getTargetFragmentUsageViolation = new GetTargetFragmentUsageViolation(fragment); if (yRS.b(3)) { Fragment fragment2 = getTargetFragmentUsageViolation.b; } LWm d = d(fragment); if (d.e.contains(HBt.DETECT_TARGET_FRAGMENT_USAGE) && e(d, (Class) fragment.getClass(), (Class) getTargetFragmentUsageViolation.getClass())) { a(d, getTargetFragmentUsageViolation); } } public static final void c(Fragment fragment) { C14957gcv.e(fragment, ""); GetTargetFragmentRequestCodeUsageViolation getTargetFragmentRequestCodeUsageViolation = new GetTargetFragmentRequestCodeUsageViolation(fragment); if (yRS.b(3)) { Fragment fragment2 = getTargetFragmentRequestCodeUsageViolation.b; } LWm d = d(fragment); if (d.e.contains(HBt.DETECT_TARGET_FRAGMENT_USAGE) && e(d, (Class) fragment.getClass(), (Class) getTargetFragmentRequestCodeUsageViolation.getClass())) { a(d, getTargetFragmentRequestCodeUsageViolation); } } public static final void zm_(Fragment fragment, ViewGroup viewGroup) { C14957gcv.e(fragment, ""); C14957gcv.e(viewGroup, ""); WrongFragmentContainerViolation wrongFragmentContainerViolation = new WrongFragmentContainerViolation(fragment, viewGroup); if (yRS.b(3)) { Fragment fragment2 = wrongFragmentContainerViolation.b; } LWm d = d(fragment); if (d.e.contains(HBt.DETECT_WRONG_FRAGMENT_CONTAINER) && e(d, (Class) fragment.getClass(), (Class) wrongFragmentContainerViolation.getClass())) { a(d, wrongFragmentContainerViolation); } } private static boolean e(LWm lWm, Class cls, Class cls2) { Set> set = lWm.d.get(cls.getName()); if (set == null) { return true; } if (C14957gcv.b(cls2.getSuperclass(), Violation.class) || !C14881gav.b(set, cls2.getSuperclass())) { return !set.contains(cls2); } return false; } private static void d(Fragment fragment, Runnable runnable) { if (fragment.isAdded()) { Handler handler = fragment.getParentFragmentManager().q().a; C14957gcv.c(handler, ""); if (!C14957gcv.b(handler.getLooper(), Looper.myLooper())) { handler.post(runnable); return; } } runnable.run(); } /* loaded from: classes.dex */ public static final class LWm { public static final LWm b; final Sts a; final Map>> d; final Set e; /* JADX WARN: Multi-variable type inference failed */ private LWm(Set set, Map>> map) { C14957gcv.e(set, ""); C14957gcv.e(map, ""); this.e = set; this.a = null; LinkedHashMap linkedHashMap = new LinkedHashMap(); for (Map.Entry>> entry : map.entrySet()) { linkedHashMap.put(entry.getKey(), entry.getValue()); } this.d = linkedHashMap; } /* renamed from: o.gFT$LWm$LWm, reason: collision with other inner class name */ /* loaded from: classes.dex */ public static final class C0116LWm { private C0116LWm() { } public /* synthetic */ C0116LWm(byte b) { this(); } } static { new C0116LWm((byte) 0); gaH gah = gaH.e; C14854gaM c14854gaM = C14854gaM.c; C14957gcv.d(c14854gaM, ""); b = new LWm(gah, c14854gaM); } } public static /* synthetic */ void c(LWm lWm, Violation violation) { C14957gcv.e(lWm, ""); C14957gcv.e(violation, ""); Sts sts = lWm.a; } public static /* synthetic */ void b(Violation violation) { C14957gcv.e(violation, ""); throw violation; } private static void a(final LWm lWm, final Violation violation) { Fragment fragment = violation.b; final String name = fragment.getClass().getName(); if (lWm.e.contains(HBt.PENALTY_LOG)) { } if (lWm.a != null) { d(fragment, new Runnable(lWm, violation) { // from class: o.YaW public final Violation a; public final gFT.LWm e; @Override // java.lang.Runnable public final void run() { gFT.c(this.e, this.a); } { this.e = lWm; this.a = violation; } }); } if (lWm.e.contains(HBt.PENALTY_DEATH)) { d(fragment, new Runnable(name, violation) { // from class: o.YUA public final Violation c; public final String e; @Override // java.lang.Runnable public final void run() { gFT.b(this.c); } { this.e = name; this.c = violation; } }); } } }