package o; import android.app.Activity; import android.content.res.Resources; import android.os.Bundle; import android.os.Parcelable; import android.util.SparseArray; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; import androidx.core.view.ViewCompat; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentContainerView; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.huawei.hms.android.SystemUtils; import java.util.Iterator; import o.AbstractC17389wOZ; import o.IUF; import o.wdQ; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public final class zMt { private final C5393bsG b; private final C16788rIZ d; final Fragment e; private boolean c = false; int a = -1; /* JADX INFO: Access modifiers changed from: package-private */ public zMt(C5393bsG c5393bsG, C16788rIZ c16788rIZ, Fragment fragment) { this.b = c5393bsG; this.d = c16788rIZ; this.e = fragment; } /* JADX INFO: Access modifiers changed from: package-private */ public zMt(C5393bsG c5393bsG, C16788rIZ c16788rIZ, ClassLoader classLoader, iAz iaz, mbI mbi) { this.b = c5393bsG; this.d = c16788rIZ; Fragment instantiate = iaz.instantiate(classLoader, mbi.b); Bundle bundle = mbi.c; if (bundle != null) { bundle.setClassLoader(classLoader); } instantiate.setArguments(mbi.c); instantiate.mWho = mbi.n; instantiate.mFromLayout = mbi.f; instantiate.mRestored = true; instantiate.mFragmentId = mbi.e; instantiate.mContainerId = mbi.a; instantiate.mTag = mbi.k; instantiate.mRetainInstance = mbi.g; instantiate.mRemoving = mbi.h; instantiate.mDetached = mbi.d; instantiate.mHidden = mbi.i; instantiate.mMaxState = wdQ.IeS.values()[mbi.j]; Bundle bundle2 = mbi.l; if (bundle2 != null) { instantiate.mSavedFragmentState = bundle2; } else { instantiate.mSavedFragmentState = new Bundle(); } this.e = instantiate; yRS.b(2); } /* JADX INFO: Access modifiers changed from: package-private */ public zMt(C5393bsG c5393bsG, C16788rIZ c16788rIZ, Fragment fragment, mbI mbi) { this.b = c5393bsG; this.d = c16788rIZ; this.e = fragment; fragment.mSavedViewState = null; fragment.mSavedViewRegistryState = null; fragment.mBackStackNesting = 0; fragment.mInLayout = false; fragment.mAdded = false; fragment.mTargetWho = fragment.mTarget != null ? fragment.mTarget.mWho : null; fragment.mTarget = null; if (mbi.l != null) { fragment.mSavedFragmentState = mbi.l; } else { fragment.mSavedFragmentState = new Bundle(); } } /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Type inference failed for: r1v24, types: [o.wOZ$HBt$RVV] */ /* JADX WARN: Type inference failed for: r9v7, types: [o.wOZ$HBt$RVV] */ private int i() { if (this.e.mFragmentManager == null) { return this.e.mState; } int i = this.a; int i2 = AnonymousClass1.b[this.e.mMaxState.ordinal()]; if (i2 != 1) { if (i2 == 2) { i = Math.min(i, 5); } else if (i2 == 3) { i = Math.min(i, 1); } else if (i2 == 4) { i = Math.min(i, 0); } else { i = Math.min(i, -1); } } if (this.e.mFromLayout) { if (this.e.mInLayout) { i = Math.max(this.a, 2); if (this.e.mView != null && this.e.mView.getParent() == null) { i = Math.min(i, 2); } } else { i = this.a < 4 ? Math.min(i, this.e.mState) : Math.min(i, 1); } } if (!this.e.mAdded) { i = Math.min(i, 1); } AbstractC17389wOZ.HBt hBt = null; if (this.e.mContainer != null) { AbstractC17389wOZ zi_ = AbstractC17389wOZ.zi_(this.e.mContainer, this.e.getParentFragmentManager().v()); AbstractC17389wOZ.HBt b = zi_.b(this.e); AbstractC17389wOZ.HBt hBt2 = b != null ? b.i : null; Fragment fragment = this.e; Iterator it = zi_.a.iterator(); while (true) { if (!it.hasNext()) { break; } AbstractC17389wOZ.HBt next = it.next(); if (next.b.equals(fragment) && !next.d) { hBt = next; break; } } hBt = (hBt == null || !(hBt2 == null || hBt2 == AbstractC17389wOZ.HBt.RVV.NONE)) ? hBt2 : hBt.i; } if (hBt == AbstractC17389wOZ.HBt.RVV.ADDING) { i = Math.min(i, 6); } else if (hBt == AbstractC17389wOZ.HBt.RVV.REMOVING) { i = Math.max(i, 3); } else if (this.e.mRemoving) { if (this.e.isInBackStack()) { i = Math.min(i, 1); } else { i = Math.min(i, -1); } } if (this.e.mDeferStart && this.e.mState < 5) { i = Math.min(i, 4); } yRS.b(2); return i; } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.zMt$1, reason: invalid class name */ /* loaded from: classes.dex */ public static /* synthetic */ class AnonymousClass1 { static final int[] b; static { int[] iArr = new int[wdQ.IeS.values().length]; b = iArr; try { iArr[wdQ.IeS.RESUMED.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { b[wdQ.IeS.STARTED.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { b[wdQ.IeS.CREATED.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } try { b[wdQ.IeS.INITIALIZED.ordinal()] = 4; } catch (NoSuchFieldError unused4) { } } } /* JADX INFO: Access modifiers changed from: package-private */ public final void a() { if (this.c) { yRS.b(2); return; } try { this.c = true; boolean z = false; while (true) { int i = i(); if (i != this.e.mState) { if (i > this.e.mState) { switch (this.e.mState + 1) { case 0: g(); break; case 1: h(); break; case 2: b(); f(); break; case 3: j(); break; case 4: if (this.e.mView != null && this.e.mContainer != null) { AbstractC17389wOZ zi_ = AbstractC17389wOZ.zi_(this.e.mContainer, this.e.getParentFragmentManager().v()); AbstractC17389wOZ.HBt.EnumC0126HBt c = AbstractC17389wOZ.HBt.EnumC0126HBt.c(this.e.mView.getVisibility()); yRS.b(2); zi_.c(c, AbstractC17389wOZ.HBt.RVV.ADDING, this); } this.e.mState = 4; break; case 5: p(); break; case 6: this.e.mState = 6; break; case 7: k(); break; } } else { switch (this.e.mState - 1) { case -1: l(); break; case 0: if (this.e.mBeingSaved && this.d.g(this.e.mWho) == null) { c(); } n(); break; case 1: m(); this.e.mState = 1; break; case 2: this.e.mInLayout = false; this.e.mState = 2; break; case 3: yRS.b(3); if (this.e.mBeingSaved) { c(); } else if (this.e.mView != null && this.e.mSavedViewState == null) { t(); } if (this.e.mView != null && this.e.mContainer != null) { AbstractC17389wOZ zi_2 = AbstractC17389wOZ.zi_(this.e.mContainer, this.e.getParentFragmentManager().v()); yRS.b(2); zi_2.c(AbstractC17389wOZ.HBt.EnumC0126HBt.REMOVED, AbstractC17389wOZ.HBt.RVV.REMOVING, this); } this.e.mState = 3; break; case 4: q(); break; case 5: this.e.mState = 5; break; case 6: o(); break; } } z = true; } else { if (!z && this.e.mState == -1 && this.e.mRemoving && !this.e.isInBackStack() && !this.e.mBeingSaved) { yRS.b(3); Qps j = this.d.j(); Fragment fragment = this.e; yRS.b(3); j.c(fragment.mWho); C16788rIZ c16788rIZ = this.d; C16788rIZ.b(new Object[]{c16788rIZ, this}, 244446028, -244446027, System.identityHashCode(c16788rIZ)); yRS.b(3); this.e.initState(); } if (this.e.mHiddenChanged) { if (this.e.mView != null && this.e.mContainer != null) { AbstractC17389wOZ zi_3 = AbstractC17389wOZ.zi_(this.e.mContainer, this.e.getParentFragmentManager().v()); if (this.e.mHidden) { yRS.b(2); zi_3.c(AbstractC17389wOZ.HBt.EnumC0126HBt.GONE, AbstractC17389wOZ.HBt.RVV.NONE, this); } else { yRS.b(2); zi_3.c(AbstractC17389wOZ.HBt.EnumC0126HBt.VISIBLE, AbstractC17389wOZ.HBt.RVV.NONE, this); } } if (this.e.mFragmentManager != null) { this.e.mFragmentManager.g(this.e); } this.e.mHiddenChanged = false; Fragment fragment2 = this.e; fragment2.onHiddenChanged(fragment2.mHidden); this.e.mChildFragmentManager.f(); } return; } } } finally { this.c = false; } } /* JADX INFO: Access modifiers changed from: package-private */ public final void b() { if (this.e.mFromLayout && this.e.mInLayout && !this.e.mPerformedCreateView) { yRS.b(3); Fragment fragment = this.e; fragment.performCreateView(fragment.performGetLayoutInflater(fragment.mSavedFragmentState), null, this.e.mSavedFragmentState); if (this.e.mView != null) { this.e.mView.setSaveFromParentEnabled(false); this.e.mView.setTag(IUF.IeS.fragment_container_view_tag, this.e); if (this.e.mHidden) { this.e.mView.setVisibility(8); } this.e.performViewCreated(); C5393bsG c5393bsG = this.b; Fragment fragment2 = this.e; c5393bsG.yv_(fragment2, fragment2.mView, this.e.mSavedFragmentState, false); this.e.mState = 2; } } } /* JADX INFO: Access modifiers changed from: package-private */ public final void b(ClassLoader classLoader) { if (this.e.mSavedFragmentState == null) { return; } this.e.mSavedFragmentState.setClassLoader(classLoader); Fragment fragment = this.e; fragment.mSavedViewState = fragment.mSavedFragmentState.getSparseParcelableArray("android:view_state"); Fragment fragment2 = this.e; fragment2.mSavedViewRegistryState = fragment2.mSavedFragmentState.getBundle("android:view_registry_state"); Fragment fragment3 = this.e; fragment3.mTargetWho = fragment3.mSavedFragmentState.getString("android:target_state"); if (this.e.mTargetWho != null) { Fragment fragment4 = this.e; fragment4.mTargetRequestCode = fragment4.mSavedFragmentState.getInt("android:target_req_state", 0); } if (this.e.mSavedUserVisibleHint != null) { Fragment fragment5 = this.e; fragment5.mUserVisibleHint = fragment5.mSavedUserVisibleHint.booleanValue(); this.e.mSavedUserVisibleHint = null; } else { Fragment fragment6 = this.e; fragment6.mUserVisibleHint = fragment6.mSavedFragmentState.getBoolean("android:user_visible_hint", true); } if (this.e.mUserVisibleHint) { return; } this.e.mDeferStart = true; } private void g() { yRS.b(3); zMt zmt = null; if (this.e.mTarget != null) { zMt a = this.d.a(this.e.mTarget.mWho); if (a == null) { StringBuilder sb = new StringBuilder("Fragment "); sb.append(this.e); sb.append(" declared target fragment "); sb.append(this.e.mTarget); sb.append(" that does not belong to this FragmentManager!"); throw new IllegalStateException(sb.toString()); } Fragment fragment = this.e; fragment.mTargetWho = fragment.mTarget.mWho; this.e.mTarget = null; zmt = a; } else if (this.e.mTargetWho != null && (zmt = this.d.a(this.e.mTargetWho)) == null) { StringBuilder sb2 = new StringBuilder("Fragment "); sb2.append(this.e); sb2.append(" declared target fragment "); sb2.append(this.e.mTargetWho); sb2.append(" that does not belong to this FragmentManager!"); throw new IllegalStateException(sb2.toString()); } if (zmt != null) { zmt.a(); } Fragment fragment2 = this.e; fragment2.mHost = fragment2.mFragmentManager.q(); Fragment fragment3 = this.e; fragment3.mParentFragment = fragment3.mFragmentManager.x(); this.b.d(this.e, false); this.e.performAttach(); this.b.c(this.e, false); } private void h() { yRS.b(3); if (!this.e.mIsCreated) { C5393bsG c5393bsG = this.b; Fragment fragment = this.e; c5393bsG.yt_(fragment, fragment.mSavedFragmentState, false); Fragment fragment2 = this.e; fragment2.performCreate(fragment2.mSavedFragmentState); C5393bsG c5393bsG2 = this.b; Fragment fragment3 = this.e; c5393bsG2.ys_(fragment3, fragment3.mSavedFragmentState, false); return; } Fragment fragment4 = this.e; fragment4.restoreChildFragmentState(fragment4.mSavedFragmentState); this.e.mState = 1; } private void f() { ViewGroup viewGroup; String str; if (this.e.mFromLayout) { return; } yRS.b(3); Fragment fragment = this.e; LayoutInflater performGetLayoutInflater = fragment.performGetLayoutInflater(fragment.mSavedFragmentState); if (this.e.mContainer != null) { viewGroup = this.e.mContainer; } else if (this.e.mContainerId == 0) { viewGroup = null; } else { if (this.e.mContainerId == -1) { StringBuilder sb = new StringBuilder("Cannot create fragment "); sb.append(this.e); sb.append(" for a container view with no id"); throw new IllegalArgumentException(sb.toString()); } viewGroup = (ViewGroup) this.e.mFragmentManager.s().b(this.e.mContainerId); if (viewGroup == null) { if (!this.e.mRestored) { try { str = this.e.getResources().getResourceName(this.e.mContainerId); } catch (Resources.NotFoundException unused) { str = SystemUtils.UNKNOWN; } StringBuilder sb2 = new StringBuilder("No view found for id 0x"); sb2.append(Integer.toHexString(this.e.mContainerId)); sb2.append(" ("); sb2.append(str); sb2.append(") for fragment "); sb2.append(this.e); throw new IllegalArgumentException(sb2.toString()); } } else if (!(viewGroup instanceof FragmentContainerView)) { gFT.zm_(this.e, viewGroup); } } this.e.mContainer = viewGroup; Fragment fragment2 = this.e; fragment2.performCreateView(performGetLayoutInflater, viewGroup, fragment2.mSavedFragmentState); if (this.e.mView != null) { this.e.mView.setSaveFromParentEnabled(false); this.e.mView.setTag(IUF.IeS.fragment_container_view_tag, this.e); if (viewGroup != null) { d(); } if (this.e.mHidden) { this.e.mView.setVisibility(8); } if (ViewCompat.H(this.e.mView)) { ViewCompat.J(this.e.mView); } else { View view = this.e.mView; view.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener(this, view) { // from class: o.zMt.3 final zMt d; final View e; @Override // android.view.View.OnAttachStateChangeListener public final void onViewDetachedFromWindow(View view2) { } { this.d = this; this.e = view; } @Override // android.view.View.OnAttachStateChangeListener public final void onViewAttachedToWindow(View view2) { this.e.removeOnAttachStateChangeListener(this); ViewCompat.J(this.e); } }); } this.e.performViewCreated(); C5393bsG c5393bsG = this.b; Fragment fragment3 = this.e; c5393bsG.yv_(fragment3, fragment3.mView, this.e.mSavedFragmentState, false); int visibility = this.e.mView.getVisibility(); this.e.setPostOnViewCreatedAlpha(this.e.mView.getAlpha()); if (this.e.mContainer != null && visibility == 0) { View findFocus = this.e.mView.findFocus(); if (findFocus != null) { this.e.setFocusedView(findFocus); yRS.b(2); } this.e.mView.setAlpha(BitmapDescriptorFactory.HUE_RED); } } this.e.mState = 2; } private void j() { yRS.b(3); Fragment fragment = this.e; fragment.performActivityCreated(fragment.mSavedFragmentState); C5393bsG c5393bsG = this.b; Fragment fragment2 = this.e; c5393bsG.yr_(fragment2, fragment2.mSavedFragmentState, false); } private void p() { yRS.b(3); this.e.performStart(); this.b.j(this.e, false); } private void k() { yRS.b(3); View focusedView = this.e.getFocusedView(); if (focusedView != null && b(focusedView)) { focusedView.requestFocus(); if (yRS.b(2)) { this.e.mView.findFocus(); } } this.e.setFocusedView(null); this.e.performResume(); this.b.i(this.e, false); this.e.mSavedFragmentState = null; this.e.mSavedViewState = null; this.e.mSavedViewRegistryState = null; } private boolean b(View view) { if (view == this.e.mView) { return true; } for (ViewParent parent = view.getParent(); parent != null; parent = parent.getParent()) { if (parent == this.e.mView) { return true; } } return false; } private void o() { yRS.b(3); this.e.performPause(); this.b.e(this.e, false); } private void q() { yRS.b(3); this.e.performStop(); this.b.g(this.e, false); } /* JADX INFO: Access modifiers changed from: package-private */ public final void c() { mbI mbi = new mbI(this.e); if (this.e.mState >= 0 && mbi.l == null) { mbi.l = yX_(); if (this.e.mTargetWho != null) { if (mbi.l == null) { mbi.l = new Bundle(); } mbi.l.putString("android:target_state", this.e.mTargetWho); if (this.e.mTargetRequestCode != 0) { mbi.l.putInt("android:target_req_state", this.e.mTargetRequestCode); } } } else { mbi.l = this.e.mSavedFragmentState; } this.d.d(this.e.mWho, mbi); } /* JADX INFO: Access modifiers changed from: package-private */ public final Bundle yX_() { Bundle bundle = new Bundle(); this.e.performSaveInstanceState(bundle); this.b.yu_(this.e, bundle, false); if (bundle.isEmpty()) { bundle = null; } if (this.e.mView != null) { t(); } if (this.e.mSavedViewState != null) { if (bundle == null) { bundle = new Bundle(); } bundle.putSparseParcelableArray("android:view_state", this.e.mSavedViewState); } if (this.e.mSavedViewRegistryState != null) { if (bundle == null) { bundle = new Bundle(); } bundle.putBundle("android:view_registry_state", this.e.mSavedViewRegistryState); } if (!this.e.mUserVisibleHint) { if (bundle == null) { bundle = new Bundle(); } bundle.putBoolean("android:user_visible_hint", this.e.mUserVisibleHint); } return bundle; } private void t() { if (this.e.mView == null) { return; } if (yRS.b(2)) { View view = this.e.mView; } SparseArray sparseArray = new SparseArray<>(); this.e.mView.saveHierarchyState(sparseArray); if (sparseArray.size() > 0) { this.e.mSavedViewState = sparseArray; } Bundle bundle = new Bundle(); C7432coF c7432coF = this.e.mViewLifecycleOwner.a; C14957gcv.e(bundle, ""); c7432coF.d.AJ_(bundle); if (bundle.isEmpty()) { return; } this.e.mSavedViewRegistryState = bundle; } private void m() { yRS.b(3); if (this.e.mContainer != null && this.e.mView != null) { this.e.mContainer.removeView(this.e.mView); } this.e.performDestroyView(); this.b.h(this.e, false); this.e.mContainer = null; this.e.mView = null; this.e.mViewLifecycleOwner = null; this.e.mViewLifecycleOwnerLiveData.a((HeN) null); this.e.mInLayout = false; } private void n() { Fragment c; yRS.b(3); boolean z = true; boolean z2 = this.e.mRemoving && !this.e.isInBackStack(); if (z2 && !this.e.mBeingSaved) { this.d.d(this.e.mWho, null); } if (z2 || this.d.j().c(this.e)) { vjh vjhVar = this.e.mHost; if (!(vjhVar instanceof InterfaceC0940Ryk)) { if (vjhVar.c instanceof Activity) { z = true ^ ((Activity) vjhVar.c).isChangingConfigurations(); } } else { z = this.d.j().b; } if ((z2 && !this.e.mBeingSaved) || z) { Qps j = this.d.j(); Fragment fragment = this.e; yRS.b(3); j.c(fragment.mWho); } this.e.performDestroy(); this.b.b(this.e, false); for (zMt zmt : this.d.e()) { if (zmt != null) { Fragment fragment2 = zmt.e; if (this.e.mWho.equals(fragment2.mTargetWho)) { fragment2.mTarget = this.e; fragment2.mTargetWho = null; } } } if (this.e.mTargetWho != null) { Fragment fragment3 = this.e; fragment3.mTarget = this.d.c(fragment3.mTargetWho); } C16788rIZ c16788rIZ = this.d; C16788rIZ.b(new Object[]{c16788rIZ, this}, 244446028, -244446027, System.identityHashCode(c16788rIZ)); return; } if (this.e.mTargetWho != null && (c = this.d.c(this.e.mTargetWho)) != null && c.mRetainInstance) { this.e.mTarget = c; } this.e.mState = 0; } private void l() { yRS.b(3); this.e.performDetach(); this.b.a(this.e, false); this.e.mState = -1; this.e.mHost = null; this.e.mParentFragment = null; this.e.mFragmentManager = null; if ((!this.e.mRemoving || this.e.isInBackStack()) && !this.d.j().c(this.e)) { return; } yRS.b(3); this.e.initState(); } /* JADX INFO: Access modifiers changed from: package-private */ public final void d() { this.e.mContainer.addView(this.e.mView, this.d.d(this.e)); } }