package androidx.fragment.app; import android.animation.Animator; import android.app.Activity; import android.content.ComponentCallbacks; import android.content.Context; import android.content.Intent; import android.content.IntentSender; import android.content.res.Configuration; import android.content.res.Resources; import android.os.Bundle; import android.os.Looper; import android.os.Parcel; import android.os.Parcelable; import android.util.AttributeSet; import android.util.SparseArray; import android.view.ContextMenu; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; import androidx.collection.SimpleArrayMap; import androidx.core.app.SharedElementCallback; import androidx.core.util.DebugUtils; import androidx.core.view.LayoutInflaterCompat; import androidx.lifecycle.Lifecycle; import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.LifecycleRegistry; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.ViewModelStore; import androidx.lifecycle.ViewModelStoreOwner; import androidx.loader.app.LoaderManager; import com.ubtrobot.jimu.robotapi.PeripheralType; import java.io.FileDescriptor; import java.io.PrintWriter; import java.lang.reflect.InvocationTargetException; /* loaded from: classes.dex */ public class Fragment implements ComponentCallbacks, View.OnCreateContextMenuListener, LifecycleOwner, ViewModelStoreOwner { static final int ACTIVITY_CREATED = 2; static final int CREATED = 1; static final int INITIALIZING = 0; static final int RESUMED = 4; static final int STARTED = 3; boolean mAdded; AnimationInfo mAnimationInfo; Bundle mArguments; int mBackStackNesting; boolean mCalled; FragmentManagerImpl mChildFragmentManager; FragmentManagerNonConfig mChildNonConfig; ViewGroup mContainer; int mContainerId; boolean mDeferStart; boolean mDetached; int mFragmentId; FragmentManagerImpl mFragmentManager; boolean mFromLayout; boolean mHasMenu; boolean mHidden; boolean mHiddenChanged; FragmentHostCallback mHost; boolean mInLayout; View mInnerView; boolean mIsCreated; boolean mIsNewlyAdded; LayoutInflater mLayoutInflater; Fragment mParentFragment; boolean mPerformedCreateView; float mPostponedAlpha; boolean mRemoving; boolean mRestored; boolean mRetainInstance; boolean mRetaining; Bundle mSavedFragmentState; Boolean mSavedUserVisibleHint; SparseArray mSavedViewState; String mTag; Fragment mTarget; int mTargetRequestCode; View mView; LifecycleOwner mViewLifecycleOwner; LifecycleRegistry mViewLifecycleRegistry; ViewModelStore mViewModelStore; String mWho; private static final SimpleArrayMap> sClassMap = new SimpleArrayMap<>(); static final Object USE_DEFAULT_TRANSITION = new Object(); int mState = 0; int mIndex = -1; int mTargetIndex = -1; boolean mMenuVisible = true; boolean mUserVisibleHint = true; LifecycleRegistry mLifecycleRegistry = new LifecycleRegistry(this); MutableLiveData mViewLifecycleOwnerLiveData = new MutableLiveData<>(); static class AnimationInfo { View a; Animator b; int c; int d; int e; int f; Object g = null; Object h; Object i; Object j; Object k; Object l; Boolean m; Boolean n; SharedElementCallback o; SharedElementCallback p; boolean q; OnStartEnterTransitionListener r; boolean s; AnimationInfo() { Object obj = Fragment.USE_DEFAULT_TRANSITION; this.h = obj; this.i = null; this.j = obj; this.k = null; this.l = obj; this.o = null; this.p = null; } } public static class InstantiationException extends RuntimeException { public InstantiationException(String str, Exception exc) { super(str, exc); } } interface OnStartEnterTransitionListener { void a(); void b(); } private AnimationInfo ensureAnimationInfo() { if (this.mAnimationInfo == null) { this.mAnimationInfo = new AnimationInfo(); } return this.mAnimationInfo; } public static Fragment instantiate(Context context, String str) { return instantiate(context, str, null); } static boolean isSupportFragmentClass(Context context, String str) { try { Class cls = sClassMap.get(str); if (cls == null) { cls = context.getClassLoader().loadClass(str); sClassMap.put(str, cls); } return Fragment.class.isAssignableFrom(cls); } catch (ClassNotFoundException unused) { return false; } } void callStartTransitionListener() { AnimationInfo animationInfo = this.mAnimationInfo; OnStartEnterTransitionListener onStartEnterTransitionListener = null; if (animationInfo != null) { animationInfo.q = false; OnStartEnterTransitionListener onStartEnterTransitionListener2 = animationInfo.r; animationInfo.r = null; onStartEnterTransitionListener = onStartEnterTransitionListener2; } if (onStartEnterTransitionListener != null) { onStartEnterTransitionListener.b(); } } public void dump(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) { printWriter.print(str); printWriter.print("mFragmentId=#"); printWriter.print(Integer.toHexString(this.mFragmentId)); printWriter.print(" mContainerId=#"); printWriter.print(Integer.toHexString(this.mContainerId)); printWriter.print(" mTag="); printWriter.println(this.mTag); printWriter.print(str); printWriter.print("mState="); printWriter.print(this.mState); printWriter.print(" mIndex="); printWriter.print(this.mIndex); printWriter.print(" mWho="); printWriter.print(this.mWho); printWriter.print(" mBackStackNesting="); printWriter.println(this.mBackStackNesting); printWriter.print(str); printWriter.print("mAdded="); printWriter.print(this.mAdded); printWriter.print(" mRemoving="); printWriter.print(this.mRemoving); printWriter.print(" mFromLayout="); printWriter.print(this.mFromLayout); printWriter.print(" mInLayout="); printWriter.println(this.mInLayout); printWriter.print(str); printWriter.print("mHidden="); printWriter.print(this.mHidden); printWriter.print(" mDetached="); printWriter.print(this.mDetached); printWriter.print(" mMenuVisible="); printWriter.print(this.mMenuVisible); printWriter.print(" mHasMenu="); printWriter.println(this.mHasMenu); printWriter.print(str); printWriter.print("mRetainInstance="); printWriter.print(this.mRetainInstance); printWriter.print(" mRetaining="); printWriter.print(this.mRetaining); printWriter.print(" mUserVisibleHint="); printWriter.println(this.mUserVisibleHint); if (this.mFragmentManager != null) { printWriter.print(str); printWriter.print("mFragmentManager="); printWriter.println(this.mFragmentManager); } if (this.mHost != null) { printWriter.print(str); printWriter.print("mHost="); printWriter.println(this.mHost); } if (this.mParentFragment != null) { printWriter.print(str); printWriter.print("mParentFragment="); printWriter.println(this.mParentFragment); } if (this.mArguments != null) { printWriter.print(str); printWriter.print("mArguments="); printWriter.println(this.mArguments); } if (this.mSavedFragmentState != null) { printWriter.print(str); printWriter.print("mSavedFragmentState="); printWriter.println(this.mSavedFragmentState); } if (this.mSavedViewState != null) { printWriter.print(str); printWriter.print("mSavedViewState="); printWriter.println(this.mSavedViewState); } if (this.mTarget != null) { printWriter.print(str); printWriter.print("mTarget="); printWriter.print(this.mTarget); printWriter.print(" mTargetRequestCode="); printWriter.println(this.mTargetRequestCode); } if (getNextAnim() != 0) { printWriter.print(str); printWriter.print("mNextAnim="); printWriter.println(getNextAnim()); } if (this.mContainer != null) { printWriter.print(str); printWriter.print("mContainer="); printWriter.println(this.mContainer); } if (this.mView != null) { printWriter.print(str); printWriter.print("mView="); printWriter.println(this.mView); } if (this.mInnerView != null) { printWriter.print(str); printWriter.print("mInnerView="); printWriter.println(this.mView); } if (getAnimatingAway() != null) { printWriter.print(str); printWriter.print("mAnimatingAway="); printWriter.println(getAnimatingAway()); printWriter.print(str); printWriter.print("mStateAfterAnimating="); printWriter.println(getStateAfterAnimating()); } if (getContext() != null) { LoaderManager.a(this).a(str, fileDescriptor, printWriter, strArr); } if (this.mChildFragmentManager != null) { printWriter.print(str); printWriter.println("Child " + this.mChildFragmentManager + ":"); this.mChildFragmentManager.a(str + " ", fileDescriptor, printWriter, strArr); } } public final boolean equals(Object obj) { return super.equals(obj); } Fragment findFragmentByWho(String str) { if (str.equals(this.mWho)) { return this; } FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; if (fragmentManagerImpl != null) { return fragmentManagerImpl.b(str); } return null; } public final FragmentActivity getActivity() { FragmentHostCallback fragmentHostCallback = this.mHost; if (fragmentHostCallback == null) { return null; } return (FragmentActivity) fragmentHostCallback.b(); } public boolean getAllowEnterTransitionOverlap() { Boolean bool; AnimationInfo animationInfo = this.mAnimationInfo; if (animationInfo == null || (bool = animationInfo.n) == null) { return true; } return bool.booleanValue(); } public boolean getAllowReturnTransitionOverlap() { Boolean bool; AnimationInfo animationInfo = this.mAnimationInfo; if (animationInfo == null || (bool = animationInfo.m) == null) { return true; } return bool.booleanValue(); } View getAnimatingAway() { AnimationInfo animationInfo = this.mAnimationInfo; if (animationInfo == null) { return null; } return animationInfo.a; } Animator getAnimator() { AnimationInfo animationInfo = this.mAnimationInfo; if (animationInfo == null) { return null; } return animationInfo.b; } public final Bundle getArguments() { return this.mArguments; } public final FragmentManager getChildFragmentManager() { if (this.mChildFragmentManager == null) { instantiateChildFragmentManager(); int i = this.mState; if (i >= 4) { this.mChildFragmentManager.l(); } else if (i >= 3) { this.mChildFragmentManager.m(); } else if (i >= 2) { this.mChildFragmentManager.f(); } else if (i >= 1) { this.mChildFragmentManager.g(); } } return this.mChildFragmentManager; } public Context getContext() { FragmentHostCallback fragmentHostCallback = this.mHost; if (fragmentHostCallback == null) { return null; } return fragmentHostCallback.c(); } public Object getEnterTransition() { AnimationInfo animationInfo = this.mAnimationInfo; if (animationInfo == null) { return null; } return animationInfo.g; } SharedElementCallback getEnterTransitionCallback() { AnimationInfo animationInfo = this.mAnimationInfo; if (animationInfo == null) { return null; } return animationInfo.o; } public Object getExitTransition() { AnimationInfo animationInfo = this.mAnimationInfo; if (animationInfo == null) { return null; } return animationInfo.i; } SharedElementCallback getExitTransitionCallback() { AnimationInfo animationInfo = this.mAnimationInfo; if (animationInfo == null) { return null; } return animationInfo.p; } public final FragmentManager getFragmentManager() { return this.mFragmentManager; } public final Object getHost() { FragmentHostCallback fragmentHostCallback = this.mHost; if (fragmentHostCallback == null) { return null; } return fragmentHostCallback.f(); } public final int getId() { return this.mFragmentId; } public final LayoutInflater getLayoutInflater() { LayoutInflater layoutInflater = this.mLayoutInflater; return layoutInflater == null ? performGetLayoutInflater(null) : layoutInflater; } @Override // androidx.lifecycle.LifecycleOwner public Lifecycle getLifecycle() { return this.mLifecycleRegistry; } @Deprecated public LoaderManager getLoaderManager() { return LoaderManager.a(this); } int getNextAnim() { AnimationInfo animationInfo = this.mAnimationInfo; if (animationInfo == null) { return 0; } return animationInfo.d; } int getNextTransition() { AnimationInfo animationInfo = this.mAnimationInfo; if (animationInfo == null) { return 0; } return animationInfo.e; } int getNextTransitionStyle() { AnimationInfo animationInfo = this.mAnimationInfo; if (animationInfo == null) { return 0; } return animationInfo.f; } public final Fragment getParentFragment() { return this.mParentFragment; } public Object getReenterTransition() { AnimationInfo animationInfo = this.mAnimationInfo; if (animationInfo == null) { return null; } Object obj = animationInfo.j; return obj == USE_DEFAULT_TRANSITION ? getExitTransition() : obj; } public final Resources getResources() { return requireContext().getResources(); } public final boolean getRetainInstance() { return this.mRetainInstance; } public Object getReturnTransition() { AnimationInfo animationInfo = this.mAnimationInfo; if (animationInfo == null) { return null; } Object obj = animationInfo.h; return obj == USE_DEFAULT_TRANSITION ? getEnterTransition() : obj; } public Object getSharedElementEnterTransition() { AnimationInfo animationInfo = this.mAnimationInfo; if (animationInfo == null) { return null; } return animationInfo.k; } public Object getSharedElementReturnTransition() { AnimationInfo animationInfo = this.mAnimationInfo; if (animationInfo == null) { return null; } Object obj = animationInfo.l; return obj == USE_DEFAULT_TRANSITION ? getSharedElementEnterTransition() : obj; } int getStateAfterAnimating() { AnimationInfo animationInfo = this.mAnimationInfo; if (animationInfo == null) { return 0; } return animationInfo.c; } public final String getString(int i) { return getResources().getString(i); } public final String getTag() { return this.mTag; } public final Fragment getTargetFragment() { return this.mTarget; } public final int getTargetRequestCode() { return this.mTargetRequestCode; } public final CharSequence getText(int i) { return getResources().getText(i); } public boolean getUserVisibleHint() { return this.mUserVisibleHint; } public View getView() { return this.mView; } public LifecycleOwner getViewLifecycleOwner() { LifecycleOwner lifecycleOwner = this.mViewLifecycleOwner; if (lifecycleOwner != null) { return lifecycleOwner; } throw new IllegalStateException("Can't access the Fragment View's LifecycleOwner when getView() is null i.e., before onCreateView() or after onDestroyView()"); } public LiveData getViewLifecycleOwnerLiveData() { return this.mViewLifecycleOwnerLiveData; } @Override // androidx.lifecycle.ViewModelStoreOwner public ViewModelStore getViewModelStore() { if (getContext() == null) { throw new IllegalStateException("Can't access ViewModels from detached fragment"); } if (this.mViewModelStore == null) { this.mViewModelStore = new ViewModelStore(); } return this.mViewModelStore; } public final boolean hasOptionsMenu() { return this.mHasMenu; } public final int hashCode() { return super.hashCode(); } void initState() { this.mIndex = -1; this.mWho = null; this.mAdded = false; this.mRemoving = false; this.mFromLayout = false; this.mInLayout = false; this.mRestored = false; this.mBackStackNesting = 0; this.mFragmentManager = null; this.mChildFragmentManager = null; this.mHost = null; this.mFragmentId = 0; this.mContainerId = 0; this.mTag = null; this.mHidden = false; this.mDetached = false; this.mRetaining = false; } void instantiateChildFragmentManager() { if (this.mHost == null) { throw new IllegalStateException("Fragment has not been attached yet."); } this.mChildFragmentManager = new FragmentManagerImpl(); this.mChildFragmentManager.a(this.mHost, new FragmentContainer() { // from class: androidx.fragment.app.Fragment.2 @Override // androidx.fragment.app.FragmentContainer public View a(int i) { View view = Fragment.this.mView; if (view != null) { return view.findViewById(i); } throw new IllegalStateException("Fragment does not have a view"); } @Override // androidx.fragment.app.FragmentContainer public boolean a() { return Fragment.this.mView != null; } @Override // androidx.fragment.app.FragmentContainer public Fragment a(Context context, String str, Bundle bundle) { return Fragment.this.mHost.a(context, str, bundle); } }, this); } public final boolean isAdded() { return this.mHost != null && this.mAdded; } public final boolean isDetached() { return this.mDetached; } public final boolean isHidden() { return this.mHidden; } boolean isHideReplaced() { AnimationInfo animationInfo = this.mAnimationInfo; if (animationInfo == null) { return false; } return animationInfo.s; } final boolean isInBackStack() { return this.mBackStackNesting > 0; } public final boolean isInLayout() { return this.mInLayout; } public final boolean isMenuVisible() { return this.mMenuVisible; } boolean isPostponed() { AnimationInfo animationInfo = this.mAnimationInfo; if (animationInfo == null) { return false; } return animationInfo.q; } public final boolean isRemoving() { return this.mRemoving; } public final boolean isResumed() { return this.mState >= 4; } public final boolean isStateSaved() { FragmentManagerImpl fragmentManagerImpl = this.mFragmentManager; if (fragmentManagerImpl == null) { return false; } return fragmentManagerImpl.c(); } public final boolean isVisible() { View view; return (!isAdded() || isHidden() || (view = this.mView) == null || view.getWindowToken() == null || this.mView.getVisibility() != 0) ? false : true; } void noteStateNotSaved() { FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; if (fragmentManagerImpl != null) { fragmentManagerImpl.s(); } } public void onActivityCreated(Bundle bundle) { this.mCalled = true; } public void onActivityResult(int i, int i2, Intent intent) { } public void onAttach(Context context) { this.mCalled = true; FragmentHostCallback fragmentHostCallback = this.mHost; Activity b = fragmentHostCallback == null ? null : fragmentHostCallback.b(); if (b != null) { this.mCalled = false; onAttach(b); } } public void onAttachFragment(Fragment fragment) { } @Override // android.content.ComponentCallbacks public void onConfigurationChanged(Configuration configuration) { this.mCalled = true; } public boolean onContextItemSelected(MenuItem menuItem) { return false; } public void onCreate(Bundle bundle) { this.mCalled = true; restoreChildFragmentState(bundle); FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; if (fragmentManagerImpl == null || fragmentManagerImpl.c(1)) { return; } this.mChildFragmentManager.g(); } public Animation onCreateAnimation(int i, boolean z, int i2) { return null; } public Animator onCreateAnimator(int i, boolean z, int i2) { return null; } @Override // android.view.View.OnCreateContextMenuListener public void onCreateContextMenu(ContextMenu contextMenu, View view, ContextMenu.ContextMenuInfo contextMenuInfo) { getActivity().onCreateContextMenu(contextMenu, view, contextMenuInfo); } public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) { } public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { return null; } public void onDestroy() { this.mCalled = true; FragmentActivity activity = getActivity(); boolean z = activity != null && activity.isChangingConfigurations(); ViewModelStore viewModelStore = this.mViewModelStore; if (viewModelStore == null || z) { return; } viewModelStore.a(); } public void onDestroyOptionsMenu() { } public void onDestroyView() { this.mCalled = true; } public void onDetach() { this.mCalled = true; } public LayoutInflater onGetLayoutInflater(Bundle bundle) { return getLayoutInflater(bundle); } public void onHiddenChanged(boolean z) { } public void onInflate(Context context, AttributeSet attributeSet, Bundle bundle) { this.mCalled = true; FragmentHostCallback fragmentHostCallback = this.mHost; Activity b = fragmentHostCallback == null ? null : fragmentHostCallback.b(); if (b != null) { this.mCalled = false; onInflate(b, attributeSet, bundle); } } @Override // android.content.ComponentCallbacks public void onLowMemory() { this.mCalled = true; } public void onMultiWindowModeChanged(boolean z) { } public boolean onOptionsItemSelected(MenuItem menuItem) { return false; } public void onOptionsMenuClosed(Menu menu) { } public void onPause() { this.mCalled = true; } public void onPictureInPictureModeChanged(boolean z) { } public void onPrepareOptionsMenu(Menu menu) { } public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) { } public void onResume() { this.mCalled = true; } public void onSaveInstanceState(Bundle bundle) { } public void onStart() { this.mCalled = true; } public void onStop() { this.mCalled = true; } public void onViewCreated(View view, Bundle bundle) { } public void onViewStateRestored(Bundle bundle) { this.mCalled = true; } FragmentManager peekChildFragmentManager() { return this.mChildFragmentManager; } void performActivityCreated(Bundle bundle) { FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; if (fragmentManagerImpl != null) { fragmentManagerImpl.s(); } this.mState = 2; this.mCalled = false; onActivityCreated(bundle); if (this.mCalled) { FragmentManagerImpl fragmentManagerImpl2 = this.mChildFragmentManager; if (fragmentManagerImpl2 != null) { fragmentManagerImpl2.f(); return; } return; } throw new SuperNotCalledException("Fragment " + this + " did not call through to super.onActivityCreated()"); } void performConfigurationChanged(Configuration configuration) { onConfigurationChanged(configuration); FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; if (fragmentManagerImpl != null) { fragmentManagerImpl.a(configuration); } } boolean performContextItemSelected(MenuItem menuItem) { if (this.mHidden) { return false; } if (onContextItemSelected(menuItem)) { return true; } FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; return fragmentManagerImpl != null && fragmentManagerImpl.a(menuItem); } void performCreate(Bundle bundle) { FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; if (fragmentManagerImpl != null) { fragmentManagerImpl.s(); } this.mState = 1; this.mCalled = false; onCreate(bundle); this.mIsCreated = true; if (this.mCalled) { this.mLifecycleRegistry.a(Lifecycle.Event.ON_CREATE); return; } throw new SuperNotCalledException("Fragment " + this + " did not call through to super.onCreate()"); } boolean performCreateOptionsMenu(Menu menu, MenuInflater menuInflater) { boolean z = false; if (this.mHidden) { return false; } if (this.mHasMenu && this.mMenuVisible) { onCreateOptionsMenu(menu, menuInflater); z = true; } FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; return fragmentManagerImpl != null ? z | fragmentManagerImpl.a(menu, menuInflater) : z; } void performCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; if (fragmentManagerImpl != null) { fragmentManagerImpl.s(); } this.mPerformedCreateView = true; this.mViewLifecycleOwner = new LifecycleOwner() { // from class: androidx.fragment.app.Fragment.3 @Override // androidx.lifecycle.LifecycleOwner public Lifecycle getLifecycle() { Fragment fragment = Fragment.this; if (fragment.mViewLifecycleRegistry == null) { fragment.mViewLifecycleRegistry = new LifecycleRegistry(fragment.mViewLifecycleOwner); } return Fragment.this.mViewLifecycleRegistry; } }; this.mViewLifecycleRegistry = null; this.mView = onCreateView(layoutInflater, viewGroup, bundle); if (this.mView != null) { this.mViewLifecycleOwner.getLifecycle(); this.mViewLifecycleOwnerLiveData.a((MutableLiveData) this.mViewLifecycleOwner); } else { if (this.mViewLifecycleRegistry != null) { throw new IllegalStateException("Called getViewLifecycleOwner() but onCreateView() returned null"); } this.mViewLifecycleOwner = null; } } void performDestroy() { this.mLifecycleRegistry.a(Lifecycle.Event.ON_DESTROY); FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; if (fragmentManagerImpl != null) { fragmentManagerImpl.h(); } this.mState = 0; this.mCalled = false; this.mIsCreated = false; onDestroy(); if (this.mCalled) { this.mChildFragmentManager = null; return; } throw new SuperNotCalledException("Fragment " + this + " did not call through to super.onDestroy()"); } void performDestroyView() { if (this.mView != null) { this.mViewLifecycleRegistry.a(Lifecycle.Event.ON_DESTROY); } FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; if (fragmentManagerImpl != null) { fragmentManagerImpl.i(); } this.mState = 1; this.mCalled = false; onDestroyView(); if (this.mCalled) { LoaderManager.a(this).a(); this.mPerformedCreateView = false; } else { throw new SuperNotCalledException("Fragment " + this + " did not call through to super.onDestroyView()"); } } void performDetach() { this.mCalled = false; onDetach(); this.mLayoutInflater = null; if (!this.mCalled) { throw new SuperNotCalledException("Fragment " + this + " did not call through to super.onDetach()"); } FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; if (fragmentManagerImpl != null) { if (this.mRetaining) { fragmentManagerImpl.h(); this.mChildFragmentManager = null; return; } throw new IllegalStateException("Child FragmentManager of " + this + " was not destroyed and this fragment is not retaining instance"); } } LayoutInflater performGetLayoutInflater(Bundle bundle) { this.mLayoutInflater = onGetLayoutInflater(bundle); return this.mLayoutInflater; } void performLowMemory() { onLowMemory(); FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; if (fragmentManagerImpl != null) { fragmentManagerImpl.j(); } } void performMultiWindowModeChanged(boolean z) { onMultiWindowModeChanged(z); FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; if (fragmentManagerImpl != null) { fragmentManagerImpl.a(z); } } boolean performOptionsItemSelected(MenuItem menuItem) { if (this.mHidden) { return false; } if (this.mHasMenu && this.mMenuVisible && onOptionsItemSelected(menuItem)) { return true; } FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; return fragmentManagerImpl != null && fragmentManagerImpl.b(menuItem); } void performOptionsMenuClosed(Menu menu) { if (this.mHidden) { return; } if (this.mHasMenu && this.mMenuVisible) { onOptionsMenuClosed(menu); } FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; if (fragmentManagerImpl != null) { fragmentManagerImpl.a(menu); } } void performPause() { if (this.mView != null) { this.mViewLifecycleRegistry.a(Lifecycle.Event.ON_PAUSE); } this.mLifecycleRegistry.a(Lifecycle.Event.ON_PAUSE); FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; if (fragmentManagerImpl != null) { fragmentManagerImpl.k(); } this.mState = 3; this.mCalled = false; onPause(); if (this.mCalled) { return; } throw new SuperNotCalledException("Fragment " + this + " did not call through to super.onPause()"); } void performPictureInPictureModeChanged(boolean z) { onPictureInPictureModeChanged(z); FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; if (fragmentManagerImpl != null) { fragmentManagerImpl.b(z); } } boolean performPrepareOptionsMenu(Menu menu) { boolean z = false; if (this.mHidden) { return false; } if (this.mHasMenu && this.mMenuVisible) { onPrepareOptionsMenu(menu); z = true; } FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; return fragmentManagerImpl != null ? z | fragmentManagerImpl.b(menu) : z; } void performResume() { FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; if (fragmentManagerImpl != null) { fragmentManagerImpl.s(); this.mChildFragmentManager.p(); } this.mState = 4; this.mCalled = false; onResume(); if (!this.mCalled) { throw new SuperNotCalledException("Fragment " + this + " did not call through to super.onResume()"); } FragmentManagerImpl fragmentManagerImpl2 = this.mChildFragmentManager; if (fragmentManagerImpl2 != null) { fragmentManagerImpl2.l(); this.mChildFragmentManager.p(); } this.mLifecycleRegistry.a(Lifecycle.Event.ON_RESUME); if (this.mView != null) { this.mViewLifecycleRegistry.a(Lifecycle.Event.ON_RESUME); } } void performSaveInstanceState(Bundle bundle) { Parcelable v; onSaveInstanceState(bundle); FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; if (fragmentManagerImpl == null || (v = fragmentManagerImpl.v()) == null) { return; } bundle.putParcelable("android:support:fragments", v); } void performStart() { FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; if (fragmentManagerImpl != null) { fragmentManagerImpl.s(); this.mChildFragmentManager.p(); } this.mState = 3; this.mCalled = false; onStart(); if (!this.mCalled) { throw new SuperNotCalledException("Fragment " + this + " did not call through to super.onStart()"); } FragmentManagerImpl fragmentManagerImpl2 = this.mChildFragmentManager; if (fragmentManagerImpl2 != null) { fragmentManagerImpl2.m(); } this.mLifecycleRegistry.a(Lifecycle.Event.ON_START); if (this.mView != null) { this.mViewLifecycleRegistry.a(Lifecycle.Event.ON_START); } } void performStop() { if (this.mView != null) { this.mViewLifecycleRegistry.a(Lifecycle.Event.ON_STOP); } this.mLifecycleRegistry.a(Lifecycle.Event.ON_STOP); FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; if (fragmentManagerImpl != null) { fragmentManagerImpl.n(); } this.mState = 2; this.mCalled = false; onStop(); if (this.mCalled) { return; } throw new SuperNotCalledException("Fragment " + this + " did not call through to super.onStop()"); } public void postponeEnterTransition() { ensureAnimationInfo().q = true; } public void registerForContextMenu(View view) { view.setOnCreateContextMenuListener(this); } public final void requestPermissions(String[] strArr, int i) { FragmentHostCallback fragmentHostCallback = this.mHost; if (fragmentHostCallback != null) { fragmentHostCallback.a(this, strArr, i); return; } throw new IllegalStateException("Fragment " + this + " not attached to Activity"); } public final FragmentActivity requireActivity() { FragmentActivity activity = getActivity(); if (activity != null) { return activity; } throw new IllegalStateException("Fragment " + this + " not attached to an activity."); } public final Context requireContext() { Context context = getContext(); if (context != null) { return context; } throw new IllegalStateException("Fragment " + this + " not attached to a context."); } public final FragmentManager requireFragmentManager() { FragmentManager fragmentManager = getFragmentManager(); if (fragmentManager != null) { return fragmentManager; } throw new IllegalStateException("Fragment " + this + " not associated with a fragment manager."); } public final Object requireHost() { Object host = getHost(); if (host != null) { return host; } throw new IllegalStateException("Fragment " + this + " not attached to a host."); } void restoreChildFragmentState(Bundle bundle) { Parcelable parcelable; if (bundle == null || (parcelable = bundle.getParcelable("android:support:fragments")) == null) { return; } if (this.mChildFragmentManager == null) { instantiateChildFragmentManager(); } this.mChildFragmentManager.a(parcelable, this.mChildNonConfig); this.mChildNonConfig = null; this.mChildFragmentManager.g(); } final void restoreViewState(Bundle bundle) { SparseArray sparseArray = this.mSavedViewState; if (sparseArray != null) { this.mInnerView.restoreHierarchyState(sparseArray); this.mSavedViewState = null; } this.mCalled = false; onViewStateRestored(bundle); if (this.mCalled) { if (this.mView != null) { this.mViewLifecycleRegistry.a(Lifecycle.Event.ON_CREATE); } } else { throw new SuperNotCalledException("Fragment " + this + " did not call through to super.onViewStateRestored()"); } } public void setAllowEnterTransitionOverlap(boolean z) { ensureAnimationInfo().n = Boolean.valueOf(z); } public void setAllowReturnTransitionOverlap(boolean z) { ensureAnimationInfo().m = Boolean.valueOf(z); } void setAnimatingAway(View view) { ensureAnimationInfo().a = view; } void setAnimator(Animator animator) { ensureAnimationInfo().b = animator; } public void setArguments(Bundle bundle) { if (this.mIndex >= 0 && isStateSaved()) { throw new IllegalStateException("Fragment already active and state has been saved"); } this.mArguments = bundle; } public void setEnterSharedElementCallback(SharedElementCallback sharedElementCallback) { ensureAnimationInfo().o = sharedElementCallback; } public void setEnterTransition(Object obj) { ensureAnimationInfo().g = obj; } public void setExitSharedElementCallback(SharedElementCallback sharedElementCallback) { ensureAnimationInfo().p = sharedElementCallback; } public void setExitTransition(Object obj) { ensureAnimationInfo().i = obj; } public void setHasOptionsMenu(boolean z) { if (this.mHasMenu != z) { this.mHasMenu = z; if (!isAdded() || isHidden()) { return; } this.mHost.j(); } } void setHideReplaced(boolean z) { ensureAnimationInfo().s = z; } final void setIndex(int i, Fragment fragment) { this.mIndex = i; if (fragment == null) { this.mWho = "android:fragment:" + this.mIndex; return; } this.mWho = fragment.mWho + ":" + this.mIndex; } public void setInitialSavedState(SavedState savedState) { Bundle bundle; if (this.mIndex >= 0) { throw new IllegalStateException("Fragment already active"); } if (savedState == null || (bundle = savedState.mState) == null) { bundle = null; } this.mSavedFragmentState = bundle; } public void setMenuVisibility(boolean z) { if (this.mMenuVisible != z) { this.mMenuVisible = z; if (this.mHasMenu && isAdded() && !isHidden()) { this.mHost.j(); } } } void setNextAnim(int i) { if (this.mAnimationInfo == null && i == 0) { return; } ensureAnimationInfo().d = i; } void setNextTransition(int i, int i2) { if (this.mAnimationInfo == null && i == 0 && i2 == 0) { return; } ensureAnimationInfo(); AnimationInfo animationInfo = this.mAnimationInfo; animationInfo.e = i; animationInfo.f = i2; } void setOnStartEnterTransitionListener(OnStartEnterTransitionListener onStartEnterTransitionListener) { ensureAnimationInfo(); OnStartEnterTransitionListener onStartEnterTransitionListener2 = this.mAnimationInfo.r; if (onStartEnterTransitionListener == onStartEnterTransitionListener2) { return; } if (onStartEnterTransitionListener != null && onStartEnterTransitionListener2 != null) { throw new IllegalStateException("Trying to set a replacement startPostponedEnterTransition on " + this); } AnimationInfo animationInfo = this.mAnimationInfo; if (animationInfo.q) { animationInfo.r = onStartEnterTransitionListener; } if (onStartEnterTransitionListener != null) { onStartEnterTransitionListener.a(); } } public void setReenterTransition(Object obj) { ensureAnimationInfo().j = obj; } public void setRetainInstance(boolean z) { this.mRetainInstance = z; } public void setReturnTransition(Object obj) { ensureAnimationInfo().h = obj; } public void setSharedElementEnterTransition(Object obj) { ensureAnimationInfo().k = obj; } public void setSharedElementReturnTransition(Object obj) { ensureAnimationInfo().l = obj; } void setStateAfterAnimating(int i) { ensureAnimationInfo().c = i; } public void setTargetFragment(Fragment fragment, int i) { FragmentManager fragmentManager = getFragmentManager(); FragmentManager fragmentManager2 = fragment != null ? fragment.getFragmentManager() : null; if (fragmentManager != null && fragmentManager2 != null && fragmentManager != fragmentManager2) { throw new IllegalArgumentException("Fragment " + fragment + " must share the same FragmentManager to be set as a target fragment"); } for (Fragment fragment2 = fragment; fragment2 != null; fragment2 = fragment2.getTargetFragment()) { if (fragment2 == this) { throw new IllegalArgumentException("Setting " + fragment + " as the target of " + this + " would create a target cycle"); } } this.mTarget = fragment; this.mTargetRequestCode = i; } public void setUserVisibleHint(boolean z) { if (!this.mUserVisibleHint && z && this.mState < 3 && this.mFragmentManager != null && isAdded() && this.mIsCreated) { this.mFragmentManager.k(this); } this.mUserVisibleHint = z; this.mDeferStart = this.mState < 3 && !z; if (this.mSavedFragmentState != null) { this.mSavedUserVisibleHint = Boolean.valueOf(z); } } public boolean shouldShowRequestPermissionRationale(String str) { FragmentHostCallback fragmentHostCallback = this.mHost; if (fragmentHostCallback != null) { return fragmentHostCallback.a(str); } return false; } public void startActivity(Intent intent) { startActivity(intent, null); } public void startActivityForResult(Intent intent, int i) { startActivityForResult(intent, i, null); } public void startIntentSenderForResult(IntentSender intentSender, int i, Intent intent, int i2, int i3, int i4, Bundle bundle) throws IntentSender.SendIntentException { FragmentHostCallback fragmentHostCallback = this.mHost; if (fragmentHostCallback != null) { fragmentHostCallback.a(this, intentSender, i, intent, i2, i3, i4, bundle); return; } throw new IllegalStateException("Fragment " + this + " not attached to Activity"); } public void startPostponedEnterTransition() { FragmentManagerImpl fragmentManagerImpl = this.mFragmentManager; if (fragmentManagerImpl == null || fragmentManagerImpl.m == null) { ensureAnimationInfo().q = false; } else if (Looper.myLooper() != this.mFragmentManager.m.e().getLooper()) { this.mFragmentManager.m.e().postAtFrontOfQueue(new Runnable() { // from class: androidx.fragment.app.Fragment.1 @Override // java.lang.Runnable public void run() { Fragment.this.callStartTransitionListener(); } }); } else { callStartTransitionListener(); } } public String toString() { StringBuilder sb = new StringBuilder(PeripheralType.SERVO); DebugUtils.a(this, sb); if (this.mIndex >= 0) { sb.append(" #"); sb.append(this.mIndex); } if (this.mFragmentId != 0) { sb.append(" id=0x"); sb.append(Integer.toHexString(this.mFragmentId)); } if (this.mTag != null) { sb.append(" "); sb.append(this.mTag); } sb.append('}'); return sb.toString(); } public void unregisterForContextMenu(View view) { view.setOnCreateContextMenuListener(null); } public static class SavedState implements Parcelable { public static final Parcelable.Creator CREATOR = new Parcelable.ClassLoaderCreator() { // from class: androidx.fragment.app.Fragment.SavedState.1 @Override // android.os.Parcelable.Creator public SavedState[] newArray(int i) { return new SavedState[i]; } @Override // android.os.Parcelable.Creator public SavedState createFromParcel(Parcel parcel) { return new SavedState(parcel, null); } /* JADX WARN: Can't rename method to resolve collision */ @Override // android.os.Parcelable.ClassLoaderCreator public SavedState createFromParcel(Parcel parcel, ClassLoader classLoader) { return new SavedState(parcel, classLoader); } }; final Bundle mState; SavedState(Bundle bundle) { this.mState = bundle; } @Override // android.os.Parcelable public int describeContents() { return 0; } @Override // android.os.Parcelable public void writeToParcel(Parcel parcel, int i) { parcel.writeBundle(this.mState); } SavedState(Parcel parcel, ClassLoader classLoader) { Bundle bundle; this.mState = parcel.readBundle(); if (classLoader == null || (bundle = this.mState) == null) { return; } bundle.setClassLoader(classLoader); } } public static Fragment instantiate(Context context, String str, Bundle bundle) { try { Class cls = sClassMap.get(str); if (cls == null) { cls = context.getClassLoader().loadClass(str); sClassMap.put(str, cls); } Fragment fragment = (Fragment) cls.getConstructor(new Class[0]).newInstance(new Object[0]); if (bundle != null) { bundle.setClassLoader(fragment.getClass().getClassLoader()); fragment.setArguments(bundle); } return fragment; } catch (ClassNotFoundException e) { throw new InstantiationException("Unable to instantiate fragment " + str + ": make sure class name exists, is public, and has an empty constructor that is public", e); } catch (IllegalAccessException e2) { throw new InstantiationException("Unable to instantiate fragment " + str + ": make sure class name exists, is public, and has an empty constructor that is public", e2); } catch (java.lang.InstantiationException e3) { throw new InstantiationException("Unable to instantiate fragment " + str + ": make sure class name exists, is public, and has an empty constructor that is public", e3); } catch (NoSuchMethodException e4) { throw new InstantiationException("Unable to instantiate fragment " + str + ": could not find Fragment constructor", e4); } catch (InvocationTargetException e5) { throw new InstantiationException("Unable to instantiate fragment " + str + ": calling Fragment constructor caused an exception", e5); } } public final String getString(int i, Object... objArr) { return getResources().getString(i, objArr); } public void startActivity(Intent intent, Bundle bundle) { FragmentHostCallback fragmentHostCallback = this.mHost; if (fragmentHostCallback != null) { fragmentHostCallback.a(this, intent, -1, bundle); return; } throw new IllegalStateException("Fragment " + this + " not attached to Activity"); } public void startActivityForResult(Intent intent, int i, Bundle bundle) { FragmentHostCallback fragmentHostCallback = this.mHost; if (fragmentHostCallback != null) { fragmentHostCallback.a(this, intent, i, bundle); return; } throw new IllegalStateException("Fragment " + this + " not attached to Activity"); } @Deprecated public LayoutInflater getLayoutInflater(Bundle bundle) { FragmentHostCallback fragmentHostCallback = this.mHost; if (fragmentHostCallback != null) { LayoutInflater g = fragmentHostCallback.g(); getChildFragmentManager(); FragmentManagerImpl fragmentManagerImpl = this.mChildFragmentManager; fragmentManagerImpl.q(); LayoutInflaterCompat.b(g, fragmentManagerImpl); return g; } throw new IllegalStateException("onGetLayoutInflater() cannot be executed until the Fragment is attached to the FragmentManager."); } @Deprecated public void onAttach(Activity activity) { this.mCalled = true; } @Deprecated public void onInflate(Activity activity, AttributeSet attributeSet, Bundle bundle) { this.mCalled = true; } }