package d;

import F1.C0180i;
import F1.C0181j;
import F1.C0182k;
import F1.InterfaceC0178g;
import F1.InterfaceC0183l;
import J0.B0;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Trace;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import androidx.core.app.AbstractActivityC0998e;
import androidx.core.app.C1000g;
import androidx.core.app.M;
import androidx.core.app.N;
import androidx.core.app.P;
import androidx.fragment.app.Y;
import androidx.lifecycle.C1105n;
import androidx.lifecycle.C1115y;
import androidx.lifecycle.EnumC1107p;
import androidx.lifecycle.EnumC1108q;
import androidx.lifecycle.InterfaceC1102k;
import androidx.lifecycle.InterfaceC1111u;
import androidx.lifecycle.InterfaceC1113w;
import androidx.lifecycle.Q;
import androidx.lifecycle.T;
import androidx.lifecycle.X;
import androidx.lifecycle.c0;
import androidx.lifecycle.d0;
import androidx.lifecycle.i0;
import androidx.lifecycle.j0;
import com.debridstream.tv.R;
import d.RunnableC1824c;
import d2.AbstractC1866c;
import d2.C1867d;
import d3.C1931v0;
import f.C2011a;
import f.InterfaceC2012b;
import g.AbstractC2050d;
import g.AbstractC2055i;
import g.InterfaceC2048b;
import g.InterfaceC2049c;
import g.InterfaceC2056j;
import h.AbstractC2068b;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import kotlin.jvm.internal.F;
import m3.AbstractC2478m;
import n2.AbstractC2612c;
import n2.C2611b;
import n2.C2616g;
import n2.C2617h;
import n2.InterfaceC2618i;
import p2.C2720a;
import w4.InterfaceC3141c;
import x1.InterfaceC3211c;
import x1.InterfaceC3212d;

/* JADX INFO: renamed from: d.l, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public abstract class AbstractActivityC1833l extends AbstractActivityC0998e implements j0, InterfaceC1102k, InterfaceC2618i, InterfaceC1819C, InterfaceC2056j, InterfaceC2049c, InterfaceC3211c, InterfaceC3212d, M, N, InterfaceC0178g {
    private static final String ACTIVITY_RESULT_TAG = "android:support:activity-result";
    private static final C1827f Companion = new C1827f();
    private i0 _viewModelStore;
    private final AbstractC2055i activityResultRegistry;
    private int contentLayoutId;
    private final w4.h defaultViewModelProviderFactory$delegate;
    private boolean dispatchingOnMultiWindowModeChanged;
    private boolean dispatchingOnPictureInPictureModeChanged;
    private final w4.h fullyDrawnReporter$delegate;
    private final AtomicInteger nextLocalRequestCode;
    private final w4.h onBackPressedDispatcher$delegate;
    private final CopyOnWriteArrayList<E1.a> onConfigurationChangedListeners;
    private final CopyOnWriteArrayList<E1.a> onMultiWindowModeChangedListeners;
    private final CopyOnWriteArrayList<E1.a> onNewIntentListeners;
    private final CopyOnWriteArrayList<E1.a> onPictureInPictureModeChangedListeners;
    private final CopyOnWriteArrayList<E1.a> onTrimMemoryListeners;
    private final CopyOnWriteArrayList<Runnable> onUserLeaveHintListeners;
    private final InterfaceExecutorC1829h reportFullyDrawnExecutor;
    private final C2617h savedStateRegistryController;
    private final C2011a contextAwareHelper = new C2011a();
    private final C0182k menuHostHelper = new C0182k(new RunnableC1824c(this, 0));

    public AbstractActivityC1833l() {
        C2617h c2617h = new C2617h(new C2720a(this, new C1931v0(this, 9)));
        this.savedStateRegistryController = c2617h;
        this.reportFullyDrawnExecutor = new ViewTreeObserverOnDrawListenerC1830i(this);
        this.fullyDrawnReporter$delegate = m1.g.k(new C1832k(this, 2));
        this.nextLocalRequestCode = new AtomicInteger();
        this.activityResultRegistry = new C1831j(this);
        this.onConfigurationChangedListeners = new CopyOnWriteArrayList<>();
        this.onTrimMemoryListeners = new CopyOnWriteArrayList<>();
        this.onNewIntentListeners = new CopyOnWriteArrayList<>();
        this.onMultiWindowModeChangedListeners = new CopyOnWriteArrayList<>();
        this.onPictureInPictureModeChangedListeners = new CopyOnWriteArrayList<>();
        this.onUserLeaveHintListeners = new CopyOnWriteArrayList<>();
        if (getLifecycle() == null) {
            throw new IllegalStateException("getLifecycle() returned null in ComponentActivity's constructor. Please make sure you are lazily constructing your Lifecycle in the first call to getLifecycle() rather than relying on field initialization.");
        }
        final int i6 = 0;
        getLifecycle().addObserver(new InterfaceC1111u(this) { // from class: d.d

            /* JADX INFO: renamed from: b, reason: collision with root package name */
            public final /* synthetic */ AbstractActivityC1833l f14479b;

            {
                this.f14479b = this;
            }

            @Override // androidx.lifecycle.InterfaceC1111u
            public final void a(InterfaceC1113w interfaceC1113w, EnumC1107p enumC1107p) {
                Window window;
                View viewPeekDecorView;
                switch (i6) {
                    case 0:
                        if (enumC1107p == EnumC1107p.ON_STOP && (window = this.f14479b.getWindow()) != null && (viewPeekDecorView = window.peekDecorView()) != null) {
                            viewPeekDecorView.cancelPendingInputEvents();
                            break;
                        }
                        break;
                    default:
                        AbstractActivityC1833l.b(this.f14479b, interfaceC1113w, enumC1107p);
                        break;
                }
            }
        });
        final int i7 = 1;
        getLifecycle().addObserver(new InterfaceC1111u(this) { // from class: d.d

            /* JADX INFO: renamed from: b, reason: collision with root package name */
            public final /* synthetic */ AbstractActivityC1833l f14479b;

            {
                this.f14479b = this;
            }

            @Override // androidx.lifecycle.InterfaceC1111u
            public final void a(InterfaceC1113w interfaceC1113w, EnumC1107p enumC1107p) {
                Window window;
                View viewPeekDecorView;
                switch (i7) {
                    case 0:
                        if (enumC1107p == EnumC1107p.ON_STOP && (window = this.f14479b.getWindow()) != null && (viewPeekDecorView = window.peekDecorView()) != null) {
                            viewPeekDecorView.cancelPendingInputEvents();
                            break;
                        }
                        break;
                    default:
                        AbstractActivityC1833l.b(this.f14479b, interfaceC1113w, enumC1107p);
                        break;
                }
            }
        });
        getLifecycle().addObserver(new C2611b(this, i7));
        c2617h.a();
        X.d(this);
        getSavedStateRegistry().c(ACTIVITY_RESULT_TAG, new B0(this, 2));
        addOnContextAvailableListener(new InterfaceC2012b() { // from class: d.e
            @Override // f.InterfaceC2012b
            public final void a(AbstractActivityC1833l abstractActivityC1833l) {
                AbstractActivityC1833l.a(this.f14480a, abstractActivityC1833l);
            }
        });
        this.defaultViewModelProviderFactory$delegate = m1.g.k(new C1832k(this, 0));
        this.onBackPressedDispatcher$delegate = m1.g.k(new C1832k(this, 3));
    }

    public static void a(AbstractActivityC1833l abstractActivityC1833l, AbstractActivityC1833l it) {
        kotlin.jvm.internal.o.h(it, "it");
        Bundle bundleA = abstractActivityC1833l.getSavedStateRegistry().a(ACTIVITY_RESULT_TAG);
        if (bundleA != null) {
            AbstractC2055i abstractC2055i = abstractActivityC1833l.activityResultRegistry;
            abstractC2055i.getClass();
            ArrayList<Integer> integerArrayList = bundleA.getIntegerArrayList("KEY_COMPONENT_ACTIVITY_REGISTERED_RCS");
            ArrayList<String> stringArrayList = bundleA.getStringArrayList("KEY_COMPONENT_ACTIVITY_REGISTERED_KEYS");
            if (stringArrayList == null || integerArrayList == null) {
                return;
            }
            ArrayList<String> stringArrayList2 = bundleA.getStringArrayList("KEY_COMPONENT_ACTIVITY_LAUNCHED_KEYS");
            if (stringArrayList2 != null) {
                abstractC2055i.f16449d.addAll(stringArrayList2);
            }
            Bundle bundle = bundleA.getBundle("KEY_COMPONENT_ACTIVITY_PENDING_RESULT");
            Bundle bundle2 = abstractC2055i.f16452g;
            if (bundle != null) {
                bundle2.putAll(bundle);
            }
            int size = stringArrayList.size();
            for (int i6 = 0; i6 < size; i6++) {
                String str = stringArrayList.get(i6);
                LinkedHashMap linkedHashMap = abstractC2055i.f16447b;
                boolean zContainsKey = linkedHashMap.containsKey(str);
                LinkedHashMap linkedHashMap2 = abstractC2055i.f16446a;
                if (zContainsKey) {
                    Integer num = (Integer) linkedHashMap.remove(str);
                    if (!bundle2.containsKey(str)) {
                        F.b(linkedHashMap2).remove(num);
                    }
                }
                Integer num2 = integerArrayList.get(i6);
                kotlin.jvm.internal.o.g(num2, "rcs[i]");
                int iIntValue = num2.intValue();
                String str2 = stringArrayList.get(i6);
                kotlin.jvm.internal.o.g(str2, "keys[i]");
                String str3 = str2;
                linkedHashMap2.put(Integer.valueOf(iIntValue), str3);
                linkedHashMap.put(str3, Integer.valueOf(iIntValue));
            }
        }
    }

    public static final void access$ensureViewModelStore(AbstractActivityC1833l abstractActivityC1833l) {
        if (abstractActivityC1833l._viewModelStore == null) {
            C1828g c1828g = (C1828g) abstractActivityC1833l.getLastNonConfigurationInstance();
            if (c1828g != null) {
                abstractActivityC1833l._viewModelStore = c1828g.f14482b;
            }
            if (abstractActivityC1833l._viewModelStore == null) {
                abstractActivityC1833l._viewModelStore = new i0();
            }
        }
    }

    public static void b(AbstractActivityC1833l abstractActivityC1833l, InterfaceC1113w interfaceC1113w, EnumC1107p enumC1107p) {
        if (enumC1107p == EnumC1107p.ON_DESTROY) {
            abstractActivityC1833l.contextAwareHelper.f16364b = null;
            if (!abstractActivityC1833l.isChangingConfigurations()) {
                abstractActivityC1833l.getViewModelStore().a();
            }
            ViewTreeObserverOnDrawListenerC1830i viewTreeObserverOnDrawListenerC1830i = (ViewTreeObserverOnDrawListenerC1830i) abstractActivityC1833l.reportFullyDrawnExecutor;
            AbstractActivityC1833l abstractActivityC1833l2 = viewTreeObserverOnDrawListenerC1830i.f14486d;
            abstractActivityC1833l2.getWindow().getDecorView().removeCallbacks(viewTreeObserverOnDrawListenerC1830i);
            abstractActivityC1833l2.getWindow().getDecorView().getViewTreeObserver().removeOnDrawListener(viewTreeObserverOnDrawListenerC1830i);
        }
    }

    public static Bundle c(AbstractActivityC1833l abstractActivityC1833l) {
        Bundle bundle = new Bundle();
        AbstractC2055i abstractC2055i = abstractActivityC1833l.activityResultRegistry;
        abstractC2055i.getClass();
        LinkedHashMap linkedHashMap = abstractC2055i.f16447b;
        bundle.putIntegerArrayList("KEY_COMPONENT_ACTIVITY_REGISTERED_RCS", new ArrayList<>(linkedHashMap.values()));
        bundle.putStringArrayList("KEY_COMPONENT_ACTIVITY_REGISTERED_KEYS", new ArrayList<>(linkedHashMap.keySet()));
        bundle.putStringArrayList("KEY_COMPONENT_ACTIVITY_LAUNCHED_KEYS", new ArrayList<>(abstractC2055i.f16449d));
        bundle.putBundle("KEY_COMPONENT_ACTIVITY_PENDING_RESULT", new Bundle(abstractC2055i.f16452g));
        return bundle;
    }

    @Override // android.app.Activity
    public void addContentView(View view, ViewGroup.LayoutParams layoutParams) {
        initializeViewTreeOwners();
        InterfaceExecutorC1829h interfaceExecutorC1829h = this.reportFullyDrawnExecutor;
        View decorView = getWindow().getDecorView();
        kotlin.jvm.internal.o.g(decorView, "window.decorView");
        ((ViewTreeObserverOnDrawListenerC1830i) interfaceExecutorC1829h).a(decorView);
        super.addContentView(view, layoutParams);
    }

    @Override // F1.InterfaceC0178g
    public void addMenuProvider(InterfaceC0183l provider) {
        kotlin.jvm.internal.o.h(provider, "provider");
        C0182k c0182k = this.menuHostHelper;
        c0182k.f1450b.add(provider);
        c0182k.f1449a.run();
    }

    @Override // x1.InterfaceC3211c
    public final void addOnConfigurationChangedListener(E1.a listener) {
        kotlin.jvm.internal.o.h(listener, "listener");
        this.onConfigurationChangedListeners.add(listener);
    }

    public final void addOnContextAvailableListener(InterfaceC2012b listener) {
        kotlin.jvm.internal.o.h(listener, "listener");
        C2011a c2011a = this.contextAwareHelper;
        c2011a.getClass();
        AbstractActivityC1833l abstractActivityC1833l = c2011a.f16364b;
        if (abstractActivityC1833l != null) {
            listener.a(abstractActivityC1833l);
        }
        c2011a.f16363a.add(listener);
    }

    @Override // androidx.core.app.M
    public final void addOnMultiWindowModeChangedListener(E1.a listener) {
        kotlin.jvm.internal.o.h(listener, "listener");
        this.onMultiWindowModeChangedListeners.add(listener);
    }

    public final void addOnNewIntentListener(E1.a listener) {
        kotlin.jvm.internal.o.h(listener, "listener");
        this.onNewIntentListeners.add(listener);
    }

    @Override // androidx.core.app.N
    public final void addOnPictureInPictureModeChangedListener(E1.a listener) {
        kotlin.jvm.internal.o.h(listener, "listener");
        this.onPictureInPictureModeChangedListeners.add(listener);
    }

    @Override // x1.InterfaceC3212d
    public final void addOnTrimMemoryListener(E1.a listener) {
        kotlin.jvm.internal.o.h(listener, "listener");
        this.onTrimMemoryListeners.add(listener);
    }

    public final void addOnUserLeaveHintListener(Runnable listener) {
        kotlin.jvm.internal.o.h(listener, "listener");
        this.onUserLeaveHintListeners.add(listener);
    }

    @Override // g.InterfaceC2056j
    public final AbstractC2055i getActivityResultRegistry() {
        return this.activityResultRegistry;
    }

    @Override // androidx.lifecycle.InterfaceC1102k
    public AbstractC1866c getDefaultViewModelCreationExtras() {
        C1867d c1867d = new C1867d(0);
        Application application = getApplication();
        LinkedHashMap linkedHashMap = c1867d.f15010a;
        if (application != null) {
            u4.c cVar = c0.f12161c;
            Application application2 = getApplication();
            kotlin.jvm.internal.o.g(application2, "application");
            linkedHashMap.put(cVar, application2);
        }
        linkedHashMap.put(X.f12140a, this);
        linkedHashMap.put(X.f12141b, this);
        Intent intent = getIntent();
        Bundle extras = intent != null ? intent.getExtras() : null;
        if (extras != null) {
            linkedHashMap.put(X.f12142c, extras);
        }
        return c1867d;
    }

    @Override // androidx.lifecycle.InterfaceC1102k
    public d0 getDefaultViewModelProviderFactory() {
        return (d0) this.defaultViewModelProviderFactory$delegate.getValue();
    }

    public C1841t getFullyDrawnReporter() {
        return (C1841t) this.fullyDrawnReporter$delegate.getValue();
    }

    @InterfaceC3141c
    public Object getLastCustomNonConfigurationInstance() {
        C1828g c1828g = (C1828g) getLastNonConfigurationInstance();
        if (c1828g != null) {
            return c1828g.f14481a;
        }
        return null;
    }

    @Override // androidx.core.app.AbstractActivityC0998e, androidx.lifecycle.InterfaceC1113w
    public androidx.lifecycle.r getLifecycle() {
        return super.getLifecycle();
    }

    @Override // d.InterfaceC1819C
    public final C1818B getOnBackPressedDispatcher() {
        return (C1818B) this.onBackPressedDispatcher$delegate.getValue();
    }

    @Override // n2.InterfaceC2618i
    public final C2616g getSavedStateRegistry() {
        return this.savedStateRegistryController.f21615b;
    }

    @Override // androidx.lifecycle.j0
    public i0 getViewModelStore() {
        if (getApplication() == null) {
            throw new IllegalStateException("Your activity is not yet attached to the Application instance. You can't request ViewModel before onCreate call.");
        }
        if (this._viewModelStore == null) {
            C1828g c1828g = (C1828g) getLastNonConfigurationInstance();
            if (c1828g != null) {
                this._viewModelStore = c1828g.f14482b;
            }
            if (this._viewModelStore == null) {
                this._viewModelStore = new i0();
            }
        }
        i0 i0Var = this._viewModelStore;
        kotlin.jvm.internal.o.e(i0Var);
        return i0Var;
    }

    public void initializeViewTreeOwners() {
        View decorView = getWindow().getDecorView();
        kotlin.jvm.internal.o.g(decorView, "window.decorView");
        X.i(decorView, this);
        View decorView2 = getWindow().getDecorView();
        kotlin.jvm.internal.o.g(decorView2, "window.decorView");
        X.j(decorView2, this);
        View decorView3 = getWindow().getDecorView();
        kotlin.jvm.internal.o.g(decorView3, "window.decorView");
        AbstractC2478m.p(decorView3, this);
        View decorView4 = getWindow().getDecorView();
        kotlin.jvm.internal.o.g(decorView4, "window.decorView");
        decorView4.setTag(R.id.view_tree_on_back_pressed_dispatcher_owner, this);
        View decorView5 = getWindow().getDecorView();
        kotlin.jvm.internal.o.g(decorView5, "window.decorView");
        decorView5.setTag(R.id.report_drawn, this);
    }

    public void invalidateMenu() {
        invalidateOptionsMenu();
    }

    @Override // android.app.Activity
    @InterfaceC3141c
    public void onActivityResult(int i6, int i7, Intent intent) {
        if (this.activityResultRegistry.a(i6, i7, intent)) {
            return;
        }
        super.onActivityResult(i6, i7, intent);
    }

    @Override // android.app.Activity
    @InterfaceC3141c
    public void onBackPressed() {
        getOnBackPressedDispatcher().c();
    }

    @Override // android.app.Activity, android.content.ComponentCallbacks
    public void onConfigurationChanged(Configuration newConfig) {
        kotlin.jvm.internal.o.h(newConfig, "newConfig");
        super.onConfigurationChanged(newConfig);
        Iterator<E1.a> it = this.onConfigurationChangedListeners.iterator();
        while (it.hasNext()) {
            it.next().accept(newConfig);
        }
    }

    @Override // androidx.core.app.AbstractActivityC0998e, android.app.Activity
    public void onCreate(Bundle bundle) {
        this.savedStateRegistryController.b(bundle);
        C2011a c2011a = this.contextAwareHelper;
        c2011a.getClass();
        c2011a.f16364b = this;
        Iterator it = c2011a.f16363a.iterator();
        while (it.hasNext()) {
            ((InterfaceC2012b) it.next()).a(this);
        }
        super.onCreate(bundle);
        int i6 = T.f12133b;
        Q.b(this);
        int i7 = this.contentLayoutId;
        if (i7 != 0) {
            setContentView(i7);
        }
    }

    @Override // android.app.Activity, android.view.Window.Callback
    public boolean onCreatePanelMenu(int i6, Menu menu) {
        kotlin.jvm.internal.o.h(menu, "menu");
        if (i6 != 0) {
            return true;
        }
        super.onCreatePanelMenu(i6, menu);
        C0182k c0182k = this.menuHostHelper;
        MenuInflater menuInflater = getMenuInflater();
        Iterator it = c0182k.f1450b.iterator();
        while (it.hasNext()) {
            ((Y) ((InterfaceC0183l) it.next())).f11552a.j(menu, menuInflater);
        }
        return true;
    }

    @Override // android.app.Activity, android.view.Window.Callback
    public boolean onMenuItemSelected(int i6, MenuItem item) {
        kotlin.jvm.internal.o.h(item, "item");
        if (super.onMenuItemSelected(i6, item)) {
            return true;
        }
        if (i6 == 0) {
            Iterator it = this.menuHostHelper.f1450b.iterator();
            while (it.hasNext()) {
                if (((Y) ((InterfaceC0183l) it.next())).f11552a.o(item)) {
                    return true;
                }
            }
        }
        return false;
    }

    @Override // android.app.Activity
    @InterfaceC3141c
    public void onMultiWindowModeChanged(boolean z6) {
        if (this.dispatchingOnMultiWindowModeChanged) {
            return;
        }
        Iterator<E1.a> it = this.onMultiWindowModeChangedListeners.iterator();
        while (it.hasNext()) {
            it.next().accept(new C1000g(z6));
        }
    }

    @Override // android.app.Activity
    public void onNewIntent(Intent intent) {
        kotlin.jvm.internal.o.h(intent, "intent");
        super.onNewIntent(intent);
        Iterator<E1.a> it = this.onNewIntentListeners.iterator();
        while (it.hasNext()) {
            it.next().accept(intent);
        }
    }

    @Override // android.app.Activity, android.view.Window.Callback
    public void onPanelClosed(int i6, Menu menu) {
        kotlin.jvm.internal.o.h(menu, "menu");
        Iterator it = this.menuHostHelper.f1450b.iterator();
        while (it.hasNext()) {
            ((Y) ((InterfaceC0183l) it.next())).f11552a.p(menu);
        }
        super.onPanelClosed(i6, menu);
    }

    @Override // android.app.Activity
    @InterfaceC3141c
    public void onPictureInPictureModeChanged(boolean z6) {
        if (this.dispatchingOnPictureInPictureModeChanged) {
            return;
        }
        Iterator<E1.a> it = this.onPictureInPictureModeChangedListeners.iterator();
        while (it.hasNext()) {
            it.next().accept(new P(z6));
        }
    }

    @Override // android.app.Activity, android.view.Window.Callback
    public boolean onPreparePanel(int i6, View view, Menu menu) {
        kotlin.jvm.internal.o.h(menu, "menu");
        if (i6 != 0) {
            return true;
        }
        super.onPreparePanel(i6, view, menu);
        Iterator it = this.menuHostHelper.f1450b.iterator();
        while (it.hasNext()) {
            ((Y) ((InterfaceC0183l) it.next())).f11552a.s(menu);
        }
        return true;
    }

    @Override // android.app.Activity
    @InterfaceC3141c
    public void onRequestPermissionsResult(int i6, String[] permissions, int[] grantResults) {
        kotlin.jvm.internal.o.h(permissions, "permissions");
        kotlin.jvm.internal.o.h(grantResults, "grantResults");
        if (this.activityResultRegistry.a(i6, -1, new Intent().putExtra("androidx.activity.result.contract.extra.PERMISSIONS", permissions).putExtra("androidx.activity.result.contract.extra.PERMISSION_GRANT_RESULTS", grantResults))) {
            return;
        }
        super.onRequestPermissionsResult(i6, permissions, grantResults);
    }

    @InterfaceC3141c
    public Object onRetainCustomNonConfigurationInstance() {
        return null;
    }

    @Override // android.app.Activity
    public final Object onRetainNonConfigurationInstance() {
        C1828g c1828g;
        Object objOnRetainCustomNonConfigurationInstance = onRetainCustomNonConfigurationInstance();
        i0 i0Var = this._viewModelStore;
        if (i0Var == null && (c1828g = (C1828g) getLastNonConfigurationInstance()) != null) {
            i0Var = c1828g.f14482b;
        }
        if (i0Var == null && objOnRetainCustomNonConfigurationInstance == null) {
            return null;
        }
        C1828g c1828g2 = new C1828g();
        c1828g2.f14481a = objOnRetainCustomNonConfigurationInstance;
        c1828g2.f14482b = i0Var;
        return c1828g2;
    }

    @Override // androidx.core.app.AbstractActivityC0998e, android.app.Activity
    public void onSaveInstanceState(Bundle outState) {
        kotlin.jvm.internal.o.h(outState, "outState");
        if (getLifecycle() instanceof C1115y) {
            androidx.lifecycle.r lifecycle = getLifecycle();
            kotlin.jvm.internal.o.f(lifecycle, "null cannot be cast to non-null type androidx.lifecycle.LifecycleRegistry");
            ((C1115y) lifecycle).e(EnumC1108q.f12182c);
        }
        super.onSaveInstanceState(outState);
        this.savedStateRegistryController.c(outState);
    }

    @Override // android.app.Activity, android.content.ComponentCallbacks2
    public void onTrimMemory(int i6) {
        super.onTrimMemory(i6);
        Iterator<E1.a> it = this.onTrimMemoryListeners.iterator();
        while (it.hasNext()) {
            it.next().accept(Integer.valueOf(i6));
        }
    }

    @Override // android.app.Activity
    public void onUserLeaveHint() {
        super.onUserLeaveHint();
        Iterator<Runnable> it = this.onUserLeaveHintListeners.iterator();
        while (it.hasNext()) {
            it.next().run();
        }
    }

    public Context peekAvailableContext() {
        return this.contextAwareHelper.f16364b;
    }

    public final <I, O> AbstractC2050d registerForActivityResult(AbstractC2068b contract, AbstractC2055i registry, InterfaceC2048b callback) {
        kotlin.jvm.internal.o.h(contract, "contract");
        kotlin.jvm.internal.o.h(registry, "registry");
        kotlin.jvm.internal.o.h(callback, "callback");
        return registry.c("activity_rq#" + this.nextLocalRequestCode.getAndIncrement(), this, contract, callback);
    }

    @Override // F1.InterfaceC0178g
    public void removeMenuProvider(InterfaceC0183l provider) {
        kotlin.jvm.internal.o.h(provider, "provider");
        this.menuHostHelper.a(provider);
    }

    @Override // x1.InterfaceC3211c
    public final void removeOnConfigurationChangedListener(E1.a listener) {
        kotlin.jvm.internal.o.h(listener, "listener");
        this.onConfigurationChangedListeners.remove(listener);
    }

    public final void removeOnContextAvailableListener(InterfaceC2012b listener) {
        kotlin.jvm.internal.o.h(listener, "listener");
        C2011a c2011a = this.contextAwareHelper;
        c2011a.getClass();
        c2011a.f16363a.remove(listener);
    }

    @Override // androidx.core.app.M
    public final void removeOnMultiWindowModeChangedListener(E1.a listener) {
        kotlin.jvm.internal.o.h(listener, "listener");
        this.onMultiWindowModeChangedListeners.remove(listener);
    }

    public final void removeOnNewIntentListener(E1.a listener) {
        kotlin.jvm.internal.o.h(listener, "listener");
        this.onNewIntentListeners.remove(listener);
    }

    @Override // androidx.core.app.N
    public final void removeOnPictureInPictureModeChangedListener(E1.a listener) {
        kotlin.jvm.internal.o.h(listener, "listener");
        this.onPictureInPictureModeChangedListeners.remove(listener);
    }

    @Override // x1.InterfaceC3212d
    public final void removeOnTrimMemoryListener(E1.a listener) {
        kotlin.jvm.internal.o.h(listener, "listener");
        this.onTrimMemoryListeners.remove(listener);
    }

    public final void removeOnUserLeaveHintListener(Runnable listener) {
        kotlin.jvm.internal.o.h(listener, "listener");
        this.onUserLeaveHintListeners.remove(listener);
    }

    @Override // android.app.Activity
    public void reportFullyDrawn() {
        try {
            if (AbstractC2612c.p()) {
                AbstractC2612c.d("reportFullyDrawn() for ComponentActivity");
            }
            super.reportFullyDrawn();
            C1841t fullyDrawnReporter = getFullyDrawnReporter();
            synchronized (fullyDrawnReporter.f14495a) {
                try {
                    fullyDrawnReporter.f14496b = true;
                    Iterator it = fullyDrawnReporter.f14497c.iterator();
                    while (it.hasNext()) {
                        ((J4.a) it.next()).invoke();
                    }
                    fullyDrawnReporter.f14497c.clear();
                } finally {
                }
            }
            Trace.endSection();
        } catch (Throwable th) {
            Trace.endSection();
            throw th;
        }
    }

    @Override // android.app.Activity
    public void setContentView(int i6) {
        initializeViewTreeOwners();
        InterfaceExecutorC1829h interfaceExecutorC1829h = this.reportFullyDrawnExecutor;
        View decorView = getWindow().getDecorView();
        kotlin.jvm.internal.o.g(decorView, "window.decorView");
        ((ViewTreeObserverOnDrawListenerC1830i) interfaceExecutorC1829h).a(decorView);
        super.setContentView(i6);
    }

    @Override // android.app.Activity
    @InterfaceC3141c
    public void startActivityForResult(Intent intent, int i6) {
        kotlin.jvm.internal.o.h(intent, "intent");
        super.startActivityForResult(intent, i6);
    }

    @Override // android.app.Activity
    @InterfaceC3141c
    public void startIntentSenderForResult(IntentSender intent, int i6, Intent intent2, int i7, int i8, int i9) throws IntentSender.SendIntentException {
        kotlin.jvm.internal.o.h(intent, "intent");
        super.startIntentSenderForResult(intent, i6, intent2, i7, i8, i9);
    }

    @Override // android.app.Activity
    @InterfaceC3141c
    public void startActivityForResult(Intent intent, int i6, Bundle bundle) {
        kotlin.jvm.internal.o.h(intent, "intent");
        super.startActivityForResult(intent, i6, bundle);
    }

    @Override // android.app.Activity
    @InterfaceC3141c
    public void startIntentSenderForResult(IntentSender intent, int i6, Intent intent2, int i7, int i8, int i9, Bundle bundle) {
        kotlin.jvm.internal.o.h(intent, "intent");
        super.startIntentSenderForResult(intent, i6, intent2, i7, i8, i9, bundle);
    }

    @Override // g.InterfaceC2049c
    public final <I, O> AbstractC2050d registerForActivityResult(AbstractC2068b contract, InterfaceC2048b callback) {
        kotlin.jvm.internal.o.h(contract, "contract");
        kotlin.jvm.internal.o.h(callback, "callback");
        return registerForActivityResult(contract, this.activityResultRegistry, callback);
    }

    @Override // android.app.Activity
    public void onMultiWindowModeChanged(boolean z6, Configuration newConfig) {
        kotlin.jvm.internal.o.h(newConfig, "newConfig");
        this.dispatchingOnMultiWindowModeChanged = true;
        try {
            super.onMultiWindowModeChanged(z6, newConfig);
            this.dispatchingOnMultiWindowModeChanged = false;
            Iterator<E1.a> it = this.onMultiWindowModeChangedListeners.iterator();
            while (it.hasNext()) {
                it.next().accept(new C1000g(z6));
            }
        } catch (Throwable th) {
            this.dispatchingOnMultiWindowModeChanged = false;
            throw th;
        }
    }

    @Override // android.app.Activity
    public void onPictureInPictureModeChanged(boolean z6, Configuration newConfig) {
        kotlin.jvm.internal.o.h(newConfig, "newConfig");
        this.dispatchingOnPictureInPictureModeChanged = true;
        try {
            super.onPictureInPictureModeChanged(z6, newConfig);
            this.dispatchingOnPictureInPictureModeChanged = false;
            Iterator<E1.a> it = this.onPictureInPictureModeChangedListeners.iterator();
            while (it.hasNext()) {
                it.next().accept(new P(z6));
            }
        } catch (Throwable th) {
            this.dispatchingOnPictureInPictureModeChanged = false;
            throw th;
        }
    }

    @Override // android.app.Activity
    public void setContentView(View view) {
        initializeViewTreeOwners();
        InterfaceExecutorC1829h interfaceExecutorC1829h = this.reportFullyDrawnExecutor;
        View decorView = getWindow().getDecorView();
        kotlin.jvm.internal.o.g(decorView, "window.decorView");
        ((ViewTreeObserverOnDrawListenerC1830i) interfaceExecutorC1829h).a(decorView);
        super.setContentView(view);
    }

    public void addMenuProvider(InterfaceC0183l provider, InterfaceC1113w owner) {
        kotlin.jvm.internal.o.h(provider, "provider");
        kotlin.jvm.internal.o.h(owner, "owner");
        C0182k c0182k = this.menuHostHelper;
        c0182k.f1450b.add(provider);
        c0182k.f1449a.run();
        androidx.lifecycle.r lifecycle = owner.getLifecycle();
        HashMap map = c0182k.f1451c;
        C0181j c0181j = (C0181j) map.remove(provider);
        if (c0181j != null) {
            c0181j.f1447a.removeObserver(c0181j.f1448b);
            c0181j.f1448b = null;
        }
        map.put(provider, new C0181j(lifecycle, new C0180i(0, c0182k, provider)));
    }

    @Override // android.app.Activity
    public void setContentView(View view, ViewGroup.LayoutParams layoutParams) {
        initializeViewTreeOwners();
        InterfaceExecutorC1829h interfaceExecutorC1829h = this.reportFullyDrawnExecutor;
        View decorView = getWindow().getDecorView();
        kotlin.jvm.internal.o.g(decorView, "window.decorView");
        ((ViewTreeObserverOnDrawListenerC1830i) interfaceExecutorC1829h).a(decorView);
        super.setContentView(view, layoutParams);
    }

    public void addMenuProvider(final InterfaceC0183l provider, InterfaceC1113w owner, final EnumC1108q state) {
        kotlin.jvm.internal.o.h(provider, "provider");
        kotlin.jvm.internal.o.h(owner, "owner");
        kotlin.jvm.internal.o.h(state, "state");
        final C0182k c0182k = this.menuHostHelper;
        c0182k.getClass();
        androidx.lifecycle.r lifecycle = owner.getLifecycle();
        HashMap map = c0182k.f1451c;
        C0181j c0181j = (C0181j) map.remove(provider);
        if (c0181j != null) {
            c0181j.f1447a.removeObserver(c0181j.f1448b);
            c0181j.f1448b = null;
        }
        map.put(provider, new C0181j(lifecycle, new InterfaceC1111u() { // from class: F1.h
            @Override // androidx.lifecycle.InterfaceC1111u
            public final void a(InterfaceC1113w interfaceC1113w, EnumC1107p enumC1107p) {
                C0182k c0182k2 = c0182k;
                c0182k2.getClass();
                C1105n c1105n = EnumC1107p.Companion;
                EnumC1108q enumC1108q = state;
                c1105n.getClass();
                int iOrdinal = enumC1108q.ordinal();
                EnumC1107p enumC1107p2 = iOrdinal != 2 ? iOrdinal != 3 ? iOrdinal != 4 ? null : EnumC1107p.ON_RESUME : EnumC1107p.ON_START : EnumC1107p.ON_CREATE;
                InterfaceC0183l interfaceC0183l = provider;
                RunnableC1824c runnableC1824c = c0182k2.f1449a;
                CopyOnWriteArrayList copyOnWriteArrayList = c0182k2.f1450b;
                if (enumC1107p == enumC1107p2) {
                    copyOnWriteArrayList.add(interfaceC0183l);
                    runnableC1824c.run();
                } else if (enumC1107p == EnumC1107p.ON_DESTROY) {
                    c0182k2.a(interfaceC0183l);
                } else if (enumC1107p == C1105n.a(enumC1108q)) {
                    copyOnWriteArrayList.remove(interfaceC0183l);
                    runnableC1824c.run();
                }
            }
        }));
    }

    public static /* synthetic */ void getOnBackPressedDispatcher$annotations() {
    }
}
