package androidx.fragment.app; import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.content.IntentSender; import android.content.res.Configuration; import android.os.Bundle; import android.os.Parcelable; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.Window; import androidx.activity.ComponentActivity; import androidx.activity.OnBackPressedDispatcher; import androidx.activity.result.ActivityResultRegistry; import androidx.core.app.c; import androidx.core.app.n0; import androidx.lifecycle.e; import androidx.savedstate.SavedStateRegistry; import java.io.FileDescriptor; import java.io.PrintWriter; /* loaded from: classes.dex */ public abstract class e extends ComponentActivity implements c.InterfaceC0016c, c.d { static final String FRAGMENTS_TAG = "android:support:fragments"; boolean mCreated; boolean mResumed; final i mFragments = i.b(new c()); final androidx.lifecycle.i mFragmentLifecycleRegistry = new androidx.lifecycle.i(this); boolean mStopped = true; class a implements SavedStateRegistry.b { a() { } @Override // androidx.savedstate.SavedStateRegistry.b public Bundle a() { Bundle bundle = new Bundle(); e.this.markFragmentsCreated(); e.this.mFragmentLifecycleRegistry.h(e.b.ON_STOP); Parcelable x10 = e.this.mFragments.x(); if (x10 != null) { bundle.putParcelable(e.FRAGMENTS_TAG, x10); } return bundle; } } class b implements b.b { b() { } @Override // b.b public void a(Context context) { e.this.mFragments.a(null); Bundle a10 = e.this.getSavedStateRegistry().a(e.FRAGMENTS_TAG); if (a10 != null) { e.this.mFragments.w(a10.getParcelable(e.FRAGMENTS_TAG)); } } } class c extends k implements androidx.lifecycle.x, androidx.activity.c, androidx.activity.result.d, r { public c() { super(e.this); } @Override // androidx.fragment.app.r public void a(n nVar, Fragment fragment) { e.this.onAttachFragment(fragment); } @Override // androidx.fragment.app.g public View c(int i10) { return e.this.findViewById(i10); } @Override // androidx.fragment.app.g public boolean d() { Window window = e.this.getWindow(); return (window == null || window.peekDecorView() == null) ? false : true; } @Override // androidx.activity.result.d public ActivityResultRegistry getActivityResultRegistry() { return e.this.getActivityResultRegistry(); } @Override // androidx.lifecycle.LifecycleOwner public androidx.lifecycle.e getLifecycle() { return e.this.mFragmentLifecycleRegistry; } @Override // androidx.activity.c public OnBackPressedDispatcher getOnBackPressedDispatcher() { return e.this.getOnBackPressedDispatcher(); } @Override // androidx.lifecycle.x public androidx.lifecycle.w getViewModelStore() { return e.this.getViewModelStore(); } @Override // androidx.fragment.app.k public LayoutInflater i() { return e.this.getLayoutInflater().cloneInContext(e.this); } @Override // androidx.fragment.app.k public boolean k(Fragment fragment) { return !e.this.isFinishing(); } @Override // androidx.fragment.app.k public boolean l(String str) { return androidx.core.app.c.g(e.this, str); } @Override // androidx.fragment.app.k public void o() { e.this.supportInvalidateOptionsMenu(); } @Override // androidx.fragment.app.k /* renamed from: p, reason: merged with bridge method [inline-methods] */ public e h() { return e.this; } } public e() { e(); } private void e() { getSavedStateRegistry().d(FRAGMENTS_TAG, new a()); addOnContextAvailableListener(new b()); } private static boolean f(n nVar, e.c cVar) { boolean z10 = false; for (Fragment fragment : nVar.r0()) { if (fragment != null) { if (fragment.getHost() != null) { z10 |= f(fragment.getChildFragmentManager(), cVar); } z zVar = fragment.mViewLifecycleOwner; if (zVar != null && zVar.getLifecycle().b().a(e.c.STARTED)) { fragment.mViewLifecycleOwner.f(cVar); z10 = true; } if (fragment.mLifecycleRegistry.b().a(e.c.STARTED)) { fragment.mLifecycleRegistry.o(cVar); z10 = true; } } } return z10; } final View dispatchFragmentsOnCreateView(View view, String str, Context context, AttributeSet attributeSet) { return this.mFragments.v(view, str, context, attributeSet); } @Override // android.app.Activity public void dump(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) { super.dump(str, fileDescriptor, printWriter, strArr); printWriter.print(str); printWriter.print("Local FragmentActivity "); printWriter.print(Integer.toHexString(System.identityHashCode(this))); printWriter.println(" State:"); String str2 = str + " "; printWriter.print(str2); printWriter.print("mCreated="); printWriter.print(this.mCreated); printWriter.print(" mResumed="); printWriter.print(this.mResumed); printWriter.print(" mStopped="); printWriter.print(this.mStopped); if (getApplication() != null) { androidx.loader.app.a.b(this).a(str2, fileDescriptor, printWriter, strArr); } this.mFragments.t().W(str, fileDescriptor, printWriter, strArr); } public n getSupportFragmentManager() { return this.mFragments.t(); } @Deprecated public androidx.loader.app.a getSupportLoaderManager() { return androidx.loader.app.a.b(this); } void markFragmentsCreated() { while (f(getSupportFragmentManager(), e.c.CREATED)) { } } @Override // androidx.activity.ComponentActivity, android.app.Activity protected void onActivityResult(int i10, int i11, Intent intent) { this.mFragments.u(); super.onActivityResult(i10, i11, intent); } @Deprecated public void onAttachFragment(Fragment fragment) { } @Override // android.app.Activity, android.content.ComponentCallbacks public void onConfigurationChanged(Configuration configuration) { this.mFragments.u(); super.onConfigurationChanged(configuration); this.mFragments.d(configuration); } @Override // androidx.activity.ComponentActivity, androidx.core.app.j, android.app.Activity protected void onCreate(Bundle bundle) { super.onCreate(bundle); this.mFragmentLifecycleRegistry.h(e.b.ON_CREATE); this.mFragments.f(); } @Override // android.app.Activity, android.view.Window.Callback public boolean onCreatePanelMenu(int i10, Menu menu) { return i10 == 0 ? super.onCreatePanelMenu(i10, menu) | this.mFragments.g(menu, getMenuInflater()) : super.onCreatePanelMenu(i10, menu); } @Override // android.app.Activity, android.view.LayoutInflater.Factory2 public View onCreateView(View view, String str, Context context, AttributeSet attributeSet) { View dispatchFragmentsOnCreateView = dispatchFragmentsOnCreateView(view, str, context, attributeSet); return dispatchFragmentsOnCreateView == null ? super.onCreateView(view, str, context, attributeSet) : dispatchFragmentsOnCreateView; } @Override // android.app.Activity protected void onDestroy() { super.onDestroy(); this.mFragments.h(); this.mFragmentLifecycleRegistry.h(e.b.ON_DESTROY); } @Override // android.app.Activity, android.content.ComponentCallbacks public void onLowMemory() { super.onLowMemory(); this.mFragments.i(); } @Override // android.app.Activity, android.view.Window.Callback public boolean onMenuItemSelected(int i10, MenuItem menuItem) { if (super.onMenuItemSelected(i10, menuItem)) { return true; } if (i10 == 0) { return this.mFragments.k(menuItem); } if (i10 != 6) { return false; } return this.mFragments.e(menuItem); } @Override // android.app.Activity public void onMultiWindowModeChanged(boolean z10) { this.mFragments.j(z10); } @Override // android.app.Activity protected void onNewIntent(@SuppressLint({"UnknownNullness"}) Intent intent) { this.mFragments.u(); super.onNewIntent(intent); } @Override // android.app.Activity, android.view.Window.Callback public void onPanelClosed(int i10, Menu menu) { if (i10 == 0) { this.mFragments.l(menu); } super.onPanelClosed(i10, menu); } @Override // android.app.Activity protected void onPause() { super.onPause(); this.mResumed = false; this.mFragments.m(); this.mFragmentLifecycleRegistry.h(e.b.ON_PAUSE); } @Override // android.app.Activity public void onPictureInPictureModeChanged(boolean z10) { this.mFragments.n(z10); } @Override // android.app.Activity protected void onPostResume() { super.onPostResume(); onResumeFragments(); } @Deprecated protected boolean onPrepareOptionsPanel(View view, Menu menu) { return super.onPreparePanel(0, view, menu); } @Override // android.app.Activity, android.view.Window.Callback public boolean onPreparePanel(int i10, View view, Menu menu) { return i10 == 0 ? onPrepareOptionsPanel(view, menu) | this.mFragments.o(menu) : super.onPreparePanel(i10, view, menu); } @Override // androidx.activity.ComponentActivity, android.app.Activity public void onRequestPermissionsResult(int i10, String[] strArr, int[] iArr) { this.mFragments.u(); super.onRequestPermissionsResult(i10, strArr, iArr); } @Override // android.app.Activity protected void onResume() { this.mFragments.u(); super.onResume(); this.mResumed = true; this.mFragments.s(); } protected void onResumeFragments() { this.mFragmentLifecycleRegistry.h(e.b.ON_RESUME); this.mFragments.p(); } @Override // android.app.Activity protected void onStart() { this.mFragments.u(); super.onStart(); this.mStopped = false; if (!this.mCreated) { this.mCreated = true; this.mFragments.c(); } this.mFragments.s(); this.mFragmentLifecycleRegistry.h(e.b.ON_START); this.mFragments.q(); } @Override // android.app.Activity public void onStateNotSaved() { this.mFragments.u(); } @Override // android.app.Activity protected void onStop() { super.onStop(); this.mStopped = true; markFragmentsCreated(); this.mFragments.r(); this.mFragmentLifecycleRegistry.h(e.b.ON_STOP); } public void setEnterSharedElementCallback(n0 n0Var) { androidx.core.app.c.e(this, n0Var); } public void setExitSharedElementCallback(n0 n0Var) { androidx.core.app.c.f(this, n0Var); } public void startActivityFromFragment(Fragment fragment, @SuppressLint({"UnknownNullness"}) Intent intent, int i10) { startActivityFromFragment(fragment, intent, i10, (Bundle) null); } @Deprecated public void startIntentSenderFromFragment(Fragment fragment, @SuppressLint({"UnknownNullness"}) IntentSender intentSender, int i10, Intent intent, int i11, int i12, int i13, Bundle bundle) { if (i10 == -1) { androidx.core.app.c.i(this, intentSender, i10, intent, i11, i12, i13, bundle); } else { fragment.startIntentSenderForResult(intentSender, i10, intent, i11, i12, i13, bundle); } } public void supportFinishAfterTransition() { androidx.core.app.c.a(this); } @Deprecated public void supportInvalidateOptionsMenu() { invalidateOptionsMenu(); } public void supportPostponeEnterTransition() { androidx.core.app.c.b(this); } public void supportStartPostponedEnterTransition() { androidx.core.app.c.j(this); } @Override // androidx.core.app.c.d @Deprecated public final void validateRequestPermissionsRequestCode(int i10) { } public void startActivityFromFragment(Fragment fragment, @SuppressLint({"UnknownNullness"}) Intent intent, int i10, Bundle bundle) { if (i10 == -1) { androidx.core.app.c.h(this, intent, -1, bundle); } else { fragment.startActivityForResult(intent, i10, bundle); } } @Override // android.app.Activity, android.view.LayoutInflater.Factory public View onCreateView(String str, Context context, AttributeSet attributeSet) { View dispatchFragmentsOnCreateView = dispatchFragmentsOnCreateView(null, str, context, attributeSet); return dispatchFragmentsOnCreateView == null ? super.onCreateView(str, context, attributeSet) : dispatchFragmentsOnCreateView; } }