package d;

import D.AbstractActivityC0034e;
import D.C0036g;
import D.W;
import D.X;
import P.C0168l;
import P.C0169m;
import P.C0170n;
import P.InterfaceC0166j;
import P.InterfaceC0171o;
import android.annotation.SuppressLint;
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 androidx.fragment.app.N;
import androidx.fragment.app.Z;
import androidx.lifecycle.AbstractC0309p;
import androidx.lifecycle.C0315w;
import androidx.lifecycle.EnumC0307n;
import androidx.lifecycle.EnumC0308o;
import androidx.lifecycle.InterfaceC0303j;
import androidx.lifecycle.InterfaceC0311s;
import androidx.lifecycle.InterfaceC0313u;
import androidx.lifecycle.K;
import androidx.lifecycle.M;
import androidx.lifecycle.S;
import androidx.lifecycle.Y;
import androidx.lifecycle.a0;
import androidx.lifecycle.c0;
import androidx.lifecycle.d0;
import com.riyaz.zvytour.R;
import d4.C0548g;
import d4.InterfaceC0543b;
import e.C0552a;
import e.InterfaceC0553b;
import f.AbstractC0580c;
import f.AbstractC0585h;
import f.InterfaceC0579b;
import f.InterfaceC0586i;
import g.AbstractC0604a;
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 q4.InterfaceC0958a;
import r4.AbstractC0983h;
import r4.AbstractC0995t;

/* JADX INFO: renamed from: d.l, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public abstract class AbstractActivityC0518l extends AbstractActivityC0034e implements d0, InterfaceC0303j, v0.g, InterfaceC0528v, InterfaceC0586i, E.g, E.h, W, X, InterfaceC0166j {
    private static final String ACTIVITY_RESULT_TAG = "android:support:activity-result";
    private static final C0512f Companion = new C0512f();
    private c0 _viewModelStore;
    private final AbstractC0585h activityResultRegistry;
    private int contentLayoutId;
    private final C0552a contextAwareHelper = new C0552a();
    private final InterfaceC0543b defaultViewModelProviderFactory$delegate;
    private boolean dispatchingOnMultiWindowModeChanged;
    private boolean dispatchingOnPictureInPictureModeChanged;
    private final InterfaceC0543b fullyDrawnReporter$delegate;
    private final C0170n menuHostHelper;
    private final AtomicInteger nextLocalRequestCode;
    private final InterfaceC0543b onBackPressedDispatcher$delegate;
    private final InterfaceC0543b onBackPressedInput$delegate;
    private final CopyOnWriteArrayList<O.a> onConfigurationChangedListeners;
    private final CopyOnWriteArrayList<O.a> onMultiWindowModeChangedListeners;
    private final CopyOnWriteArrayList<O.a> onNewIntentListeners;
    private final CopyOnWriteArrayList<O.a> onPictureInPictureModeChangedListeners;
    private final CopyOnWriteArrayList<O.a> onTrimMemoryListeners;
    private final CopyOnWriteArrayList<Runnable> onUserLeaveHintListeners;
    private final InterfaceExecutorC0514h reportFullyDrawnExecutor;
    private final v0.f savedStateRegistryController;

    public AbstractActivityC0518l() {
        final N n5 = (N) this;
        this.menuHostHelper = new C0170n(new RunnableC0508b(n5, 1));
        v0.f fVar = new v0.f(this);
        this.savedStateRegistryController = fVar;
        this.reportFullyDrawnExecutor = new ViewTreeObserverOnDrawListenerC0515i(n5);
        this.fullyDrawnReporter$delegate = new C0548g(new C0509c(n5, 1));
        this.nextLocalRequestCode = new AtomicInteger();
        this.activityResultRegistry = new C0517k(n5);
        this.onConfigurationChangedListeners = new CopyOnWriteArrayList<>();
        this.onTrimMemoryListeners = new CopyOnWriteArrayList<>();
        this.onNewIntentListeners = new CopyOnWriteArrayList<>();
        this.onMultiWindowModeChangedListeners = new CopyOnWriteArrayList<>();
        this.onPictureInPictureModeChangedListeners = new CopyOnWriteArrayList<>();
        this.onUserLeaveHintListeners = new CopyOnWriteArrayList<>();
        this.onBackPressedInput$delegate = new C0548g(new C0509c(n5, 2));
        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.");
        }
        getLifecycle().a(new C0510d(0, n5));
        int i = 1;
        getLifecycle().a(new C0510d(i, n5));
        getLifecycle().a(new v0.b(n5, i));
        fVar.a();
        S.d(this);
        getSavedStateRegistry().c(ACTIVITY_RESULT_TAG, new androidx.lifecycle.N(1, n5));
        addOnContextAvailableListener(new InterfaceC0553b() { // from class: d.e
            @Override // e.InterfaceC0553b
            public final void a(AbstractActivityC0518l abstractActivityC0518l) {
                AbstractActivityC0518l.e(n5, abstractActivityC0518l);
            }
        });
        this.defaultViewModelProviderFactory$delegate = new C0548g(new C0509c(n5, 3));
        this.onBackPressedDispatcher$delegate = new C0548g(new C0509c(n5, 4));
    }

    public static Bundle a(N n5) {
        Bundle bundle = new Bundle();
        AbstractC0585h abstractC0585h = ((AbstractActivityC0518l) n5).activityResultRegistry;
        abstractC0585h.getClass();
        LinkedHashMap linkedHashMap = abstractC0585h.f6323b;
        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<>(abstractC0585h.f6325d));
        bundle.putBundle("KEY_COMPONENT_ACTIVITY_PENDING_RESULT", new Bundle(abstractC0585h.f6328g));
        return bundle;
    }

    public static final void access$ensureViewModelStore(AbstractActivityC0518l abstractActivityC0518l) {
        if (abstractActivityC0518l._viewModelStore == null) {
            C0513g c0513g = (C0513g) abstractActivityC0518l.getLastNonConfigurationInstance();
            if (c0513g != null) {
                abstractActivityC0518l._viewModelStore = c0513g.f5975b;
            }
            if (abstractActivityC0518l._viewModelStore == null) {
                abstractActivityC0518l._viewModelStore = new c0();
            }
        }
    }

    public static C0521o b(N n5) {
        return new C0521o(((AbstractActivityC0518l) n5).reportFullyDrawnExecutor, new C0509c(n5, 0));
    }

    public static void c(N n5, InterfaceC0313u interfaceC0313u, EnumC0307n enumC0307n) {
        if (enumC0307n == EnumC0307n.ON_DESTROY) {
            ((AbstractActivityC0518l) n5).contextAwareHelper.f6167b = null;
            if (!n5.isChangingConfigurations()) {
                n5.getViewModelStore().a();
            }
            ViewTreeObserverOnDrawListenerC0515i viewTreeObserverOnDrawListenerC0515i = (ViewTreeObserverOnDrawListenerC0515i) ((AbstractActivityC0518l) n5).reportFullyDrawnExecutor;
            N n6 = viewTreeObserverOnDrawListenerC0515i.f5979n;
            n6.getWindow().getDecorView().removeCallbacks(viewTreeObserverOnDrawListenerC0515i);
            n6.getWindow().getDecorView().getViewTreeObserver().removeOnDrawListener(viewTreeObserverOnDrawListenerC0515i);
        }
    }

    public static void d(N n5) {
        try {
            super.onBackPressed();
        } catch (IllegalStateException e2) {
            if (!AbstractC0983h.a(e2.getMessage(), "Can not perform this action after onSaveInstanceState")) {
                throw e2;
            }
        } catch (NullPointerException e6) {
            if (!AbstractC0983h.a(e6.getMessage(), "Attempt to invoke virtual method 'android.os.Handler android.app.FragmentHostCallback.getHandler()' on a null object reference")) {
                throw e6;
            }
        }
    }

    public static void e(N n5, AbstractActivityC0518l abstractActivityC0518l) {
        AbstractC0983h.e("it", abstractActivityC0518l);
        Bundle bundleA = n5.getSavedStateRegistry().a(ACTIVITY_RESULT_TAG);
        if (bundleA != null) {
            AbstractC0585h abstractC0585h = ((AbstractActivityC0518l) n5).activityResultRegistry;
            abstractC0585h.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) {
                abstractC0585h.f6325d.addAll(stringArrayList2);
            }
            Bundle bundle = bundleA.getBundle("KEY_COMPONENT_ACTIVITY_PENDING_RESULT");
            Bundle bundle2 = abstractC0585h.f6328g;
            if (bundle != null) {
                bundle2.putAll(bundle);
            }
            int size = stringArrayList.size();
            for (int i = 0; i < size; i++) {
                String str = stringArrayList.get(i);
                LinkedHashMap linkedHashMap = abstractC0585h.f6323b;
                boolean zContainsKey = linkedHashMap.containsKey(str);
                LinkedHashMap linkedHashMap2 = abstractC0585h.f6322a;
                if (zContainsKey) {
                    Integer num = (Integer) linkedHashMap.remove(str);
                    if (!bundle2.containsKey(str)) {
                        AbstractC0995t.a(linkedHashMap2).remove(num);
                    }
                }
                Integer num2 = integerArrayList.get(i);
                AbstractC0983h.d("get(...)", num2);
                int iIntValue = num2.intValue();
                String str2 = stringArrayList.get(i);
                AbstractC0983h.d("get(...)", str2);
                String str3 = str2;
                linkedHashMap2.put(Integer.valueOf(iIntValue), str3);
                linkedHashMap.put(str3, Integer.valueOf(iIntValue));
            }
        }
    }

    @Override // android.app.Activity
    public void addContentView(View view, ViewGroup.LayoutParams layoutParams) {
        initializeViewTreeOwners();
        InterfaceExecutorC0514h interfaceExecutorC0514h = this.reportFullyDrawnExecutor;
        View decorView = getWindow().getDecorView();
        AbstractC0983h.d("getDecorView(...)", decorView);
        ((ViewTreeObserverOnDrawListenerC0515i) interfaceExecutorC0514h).a(decorView);
        super.addContentView(view, layoutParams);
    }

    @Override // P.InterfaceC0166j
    public void addMenuProvider(InterfaceC0171o interfaceC0171o) {
        AbstractC0983h.e("provider", interfaceC0171o);
        C0170n c0170n = this.menuHostHelper;
        c0170n.f2473b.add(interfaceC0171o);
        c0170n.f2472a.run();
    }

    @Override // E.g
    public final void addOnConfigurationChangedListener(O.a aVar) {
        AbstractC0983h.e("listener", aVar);
        this.onConfigurationChangedListeners.add(aVar);
    }

    public final void addOnContextAvailableListener(InterfaceC0553b interfaceC0553b) {
        AbstractC0983h.e("listener", interfaceC0553b);
        C0552a c0552a = this.contextAwareHelper;
        c0552a.getClass();
        AbstractActivityC0518l abstractActivityC0518l = c0552a.f6167b;
        if (abstractActivityC0518l != null) {
            interfaceC0553b.a(abstractActivityC0518l);
        }
        c0552a.f6166a.add(interfaceC0553b);
    }

    @Override // D.W
    public final void addOnMultiWindowModeChangedListener(O.a aVar) {
        AbstractC0983h.e("listener", aVar);
        this.onMultiWindowModeChangedListeners.add(aVar);
    }

    public final void addOnNewIntentListener(O.a aVar) {
        AbstractC0983h.e("listener", aVar);
        this.onNewIntentListeners.add(aVar);
    }

    @Override // D.X
    public final void addOnPictureInPictureModeChangedListener(O.a aVar) {
        AbstractC0983h.e("listener", aVar);
        this.onPictureInPictureModeChangedListeners.add(aVar);
    }

    @Override // E.h
    public final void addOnTrimMemoryListener(O.a aVar) {
        AbstractC0983h.e("listener", aVar);
        this.onTrimMemoryListeners.add(aVar);
    }

    public final void addOnUserLeaveHintListener(Runnable runnable) {
        AbstractC0983h.e("listener", runnable);
        this.onUserLeaveHintListeners.add(runnable);
    }

    @Override // f.InterfaceC0586i
    public final AbstractC0585h getActivityResultRegistry() {
        return this.activityResultRegistry;
    }

    @Override // androidx.lifecycle.InterfaceC0303j
    public j0.b getDefaultViewModelCreationExtras() {
        j0.c cVar = new j0.c(0);
        Application application = getApplication();
        LinkedHashMap linkedHashMap = cVar.f8555a;
        if (application != null) {
            linkedHashMap.put(Y.f4457a, getApplication());
        }
        linkedHashMap.put(S.f4439a, this);
        linkedHashMap.put(S.f4440b, this);
        Intent intent = getIntent();
        Bundle extras = intent != null ? intent.getExtras() : null;
        if (extras != null) {
            linkedHashMap.put(S.f4441c, extras);
        }
        return cVar;
    }

    public a0 getDefaultViewModelProviderFactory() {
        return (a0) this.defaultViewModelProviderFactory$delegate.getValue();
    }

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

    public Object getLastCustomNonConfigurationInstance() {
        C0513g c0513g = (C0513g) getLastNonConfigurationInstance();
        if (c0513g != null) {
            return c0513g.f5974a;
        }
        return null;
    }

    @Override // D.AbstractActivityC0034e, androidx.lifecycle.InterfaceC0313u
    public AbstractC0309p getLifecycle() {
        return super.getLifecycle();
    }

    public m0.c getNavigationEventDispatcher() {
        return getOnBackPressedDispatcher().f6008b;
    }

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

    @Override // v0.g
    public final v0.e getSavedStateRegistry() {
        return this.savedStateRegistryController.f10403b;
    }

    @Override // androidx.lifecycle.d0
    public c0 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) {
            C0513g c0513g = (C0513g) getLastNonConfigurationInstance();
            if (c0513g != null) {
                this._viewModelStore = c0513g.f5975b;
            }
            if (this._viewModelStore == null) {
                this._viewModelStore = new c0();
            }
        }
        c0 c0Var = this._viewModelStore;
        AbstractC0983h.b(c0Var);
        return c0Var;
    }

    public void initializeViewTreeOwners() {
        View decorView = getWindow().getDecorView();
        AbstractC0983h.d("getDecorView(...)", decorView);
        decorView.setTag(R.id.view_tree_lifecycle_owner, this);
        View decorView2 = getWindow().getDecorView();
        AbstractC0983h.d("getDecorView(...)", decorView2);
        decorView2.setTag(R.id.view_tree_view_model_store_owner, this);
        View decorView3 = getWindow().getDecorView();
        AbstractC0983h.d("getDecorView(...)", decorView3);
        decorView3.setTag(R.id.view_tree_saved_state_registry_owner, this);
        View decorView4 = getWindow().getDecorView();
        AbstractC0983h.d("getDecorView(...)", decorView4);
        decorView4.setTag(R.id.view_tree_on_back_pressed_dispatcher_owner, this);
        View decorView5 = getWindow().getDecorView();
        AbstractC0983h.d("getDecorView(...)", decorView5);
        decorView5.setTag(R.id.report_drawn, this);
        View decorView6 = getWindow().getDecorView();
        AbstractC0983h.d("getDecorView(...)", decorView6);
        decorView6.setTag(R.id.view_tree_navigation_event_dispatcher_owner, this);
    }

    public void invalidateMenu() {
        invalidateOptionsMenu();
    }

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

    @Override // android.app.Activity, android.content.ComponentCallbacks
    public void onConfigurationChanged(Configuration configuration) {
        AbstractC0983h.e("newConfig", configuration);
        super.onConfigurationChanged(configuration);
        Iterator<O.a> it = this.onConfigurationChangedListeners.iterator();
        AbstractC0983h.d("iterator(...)", it);
        while (it.hasNext()) {
            it.next().accept(configuration);
        }
    }

    @Override // D.AbstractActivityC0034e, android.app.Activity
    public void onCreate(Bundle bundle) {
        this.savedStateRegistryController.b(bundle);
        C0552a c0552a = this.contextAwareHelper;
        c0552a.getClass();
        c0552a.f6167b = this;
        Iterator it = c0552a.f6166a.iterator();
        while (it.hasNext()) {
            ((InterfaceC0553b) it.next()).a(this);
        }
        super.onCreate(bundle);
        int i = M.f4419l;
        K.b(this);
        int i5 = this.contentLayoutId;
        if (i5 != 0) {
            setContentView(i5);
        }
    }

    @Override // android.app.Activity, android.view.Window.Callback
    public boolean onCreatePanelMenu(int i, Menu menu) {
        AbstractC0983h.e("menu", menu);
        if (i != 0) {
            return true;
        }
        super.onCreatePanelMenu(i, menu);
        C0170n c0170n = this.menuHostHelper;
        MenuInflater menuInflater = getMenuInflater();
        Iterator it = c0170n.f2473b.iterator();
        while (it.hasNext()) {
            ((Z) ((InterfaceC0171o) it.next())).f4207a.k(menu, menuInflater);
        }
        return true;
    }

    @Override // android.app.Activity, android.view.Window.Callback
    public boolean onMenuItemSelected(int i, MenuItem menuItem) {
        AbstractC0983h.e("item", menuItem);
        if (super.onMenuItemSelected(i, menuItem)) {
            return true;
        }
        if (i == 0) {
            return this.menuHostHelper.a(menuItem);
        }
        return false;
    }

    @Override // android.app.Activity
    public void onMultiWindowModeChanged(boolean z5) {
        if (this.dispatchingOnMultiWindowModeChanged) {
            return;
        }
        Iterator<O.a> it = this.onMultiWindowModeChangedListeners.iterator();
        AbstractC0983h.d("iterator(...)", it);
        while (it.hasNext()) {
            it.next().accept(new C0036g(z5));
        }
    }

    @Override // android.app.Activity
    public void onNewIntent(Intent intent) {
        AbstractC0983h.e("intent", intent);
        super.onNewIntent(intent);
        Iterator<O.a> it = this.onNewIntentListeners.iterator();
        AbstractC0983h.d("iterator(...)", it);
        while (it.hasNext()) {
            it.next().accept(intent);
        }
    }

    @Override // android.app.Activity, android.view.Window.Callback
    public void onPanelClosed(int i, Menu menu) {
        AbstractC0983h.e("menu", menu);
        Iterator it = this.menuHostHelper.f2473b.iterator();
        while (it.hasNext()) {
            ((Z) ((InterfaceC0171o) it.next())).f4207a.q(menu);
        }
        super.onPanelClosed(i, menu);
    }

    @Override // android.app.Activity
    public void onPictureInPictureModeChanged(boolean z5) {
        if (this.dispatchingOnPictureInPictureModeChanged) {
            return;
        }
        Iterator<O.a> it = this.onPictureInPictureModeChangedListeners.iterator();
        AbstractC0983h.d("iterator(...)", it);
        while (it.hasNext()) {
            it.next().accept(new D.Z(z5));
        }
    }

    @Override // android.app.Activity, android.view.Window.Callback
    public boolean onPreparePanel(int i, View view, Menu menu) {
        AbstractC0983h.e("menu", menu);
        if (i != 0) {
            return true;
        }
        super.onPreparePanel(i, view, menu);
        Iterator it = this.menuHostHelper.f2473b.iterator();
        while (it.hasNext()) {
            ((Z) ((InterfaceC0171o) it.next())).f4207a.t(menu);
        }
        return true;
    }

    @Override // android.app.Activity
    public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
        AbstractC0983h.e("permissions", strArr);
        AbstractC0983h.e("grantResults", iArr);
        if (this.activityResultRegistry.a(i, -1, new Intent().putExtra("androidx.activity.result.contract.extra.PERMISSIONS", strArr).putExtra("androidx.activity.result.contract.extra.PERMISSION_GRANT_RESULTS", iArr))) {
            return;
        }
        super.onRequestPermissionsResult(i, strArr, iArr);
    }

    public Object onRetainCustomNonConfigurationInstance() {
        return null;
    }

    @Override // android.app.Activity
    public final Object onRetainNonConfigurationInstance() {
        C0513g c0513g;
        Object objOnRetainCustomNonConfigurationInstance = onRetainCustomNonConfigurationInstance();
        c0 c0Var = this._viewModelStore;
        if (c0Var == null && (c0513g = (C0513g) getLastNonConfigurationInstance()) != null) {
            c0Var = c0513g.f5975b;
        }
        if (c0Var == null && objOnRetainCustomNonConfigurationInstance == null) {
            return null;
        }
        C0513g c0513g2 = new C0513g();
        c0513g2.f5974a = objOnRetainCustomNonConfigurationInstance;
        c0513g2.f5975b = c0Var;
        return c0513g2;
    }

    @Override // D.AbstractActivityC0034e, android.app.Activity
    public void onSaveInstanceState(Bundle bundle) {
        AbstractC0983h.e("outState", bundle);
        if (getLifecycle() instanceof C0315w) {
            AbstractC0309p lifecycle = getLifecycle();
            AbstractC0983h.c("null cannot be cast to non-null type androidx.lifecycle.LifecycleRegistry", lifecycle);
            ((C0315w) lifecycle).g();
        }
        super.onSaveInstanceState(bundle);
        this.savedStateRegistryController.c(bundle);
    }

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

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

    public final <I, O> AbstractC0580c registerForActivityResult(AbstractC0604a abstractC0604a, AbstractC0585h abstractC0585h, InterfaceC0579b interfaceC0579b) {
        AbstractC0983h.e("contract", abstractC0604a);
        AbstractC0983h.e("registry", abstractC0585h);
        AbstractC0983h.e("callback", interfaceC0579b);
        return abstractC0585h.c("activity_rq#" + this.nextLocalRequestCode.getAndIncrement(), this, abstractC0604a, interfaceC0579b);
    }

    @Override // P.InterfaceC0166j
    public void removeMenuProvider(InterfaceC0171o interfaceC0171o) {
        AbstractC0983h.e("provider", interfaceC0171o);
        this.menuHostHelper.b(interfaceC0171o);
    }

    @Override // E.g
    public final void removeOnConfigurationChangedListener(O.a aVar) {
        AbstractC0983h.e("listener", aVar);
        this.onConfigurationChangedListeners.remove(aVar);
    }

    public final void removeOnContextAvailableListener(InterfaceC0553b interfaceC0553b) {
        AbstractC0983h.e("listener", interfaceC0553b);
        C0552a c0552a = this.contextAwareHelper;
        c0552a.getClass();
        c0552a.f6166a.remove(interfaceC0553b);
    }

    @Override // D.W
    public final void removeOnMultiWindowModeChangedListener(O.a aVar) {
        AbstractC0983h.e("listener", aVar);
        this.onMultiWindowModeChangedListeners.remove(aVar);
    }

    public final void removeOnNewIntentListener(O.a aVar) {
        AbstractC0983h.e("listener", aVar);
        this.onNewIntentListeners.remove(aVar);
    }

    @Override // D.X
    public final void removeOnPictureInPictureModeChangedListener(O.a aVar) {
        AbstractC0983h.e("listener", aVar);
        this.onPictureInPictureModeChangedListeners.remove(aVar);
    }

    @Override // E.h
    public final void removeOnTrimMemoryListener(O.a aVar) {
        AbstractC0983h.e("listener", aVar);
        this.onTrimMemoryListeners.remove(aVar);
    }

    public final void removeOnUserLeaveHintListener(Runnable runnable) {
        AbstractC0983h.e("listener", runnable);
        this.onUserLeaveHintListeners.remove(runnable);
    }

    @Override // android.app.Activity
    public void reportFullyDrawn() {
        try {
            if (android.support.v4.media.session.b.k()) {
                Trace.beginSection(android.support.v4.media.session.b.t("reportFullyDrawn() for ComponentActivity"));
            }
            super.reportFullyDrawn();
            C0521o fullyDrawnReporter = getFullyDrawnReporter();
            synchronized (fullyDrawnReporter.f5992b) {
                try {
                    fullyDrawnReporter.f5993c = true;
                    Iterator it = fullyDrawnReporter.f5994d.iterator();
                    while (it.hasNext()) {
                        ((InterfaceC0958a) it.next()).invoke();
                    }
                    fullyDrawnReporter.f5994d.clear();
                } finally {
                }
            }
            Trace.endSection();
        } catch (Throwable th) {
            Trace.endSection();
            throw th;
        }
    }

    @Override // android.app.Activity
    public void setContentView(int i) {
        initializeViewTreeOwners();
        InterfaceExecutorC0514h interfaceExecutorC0514h = this.reportFullyDrawnExecutor;
        View decorView = getWindow().getDecorView();
        AbstractC0983h.d("getDecorView(...)", decorView);
        ((ViewTreeObserverOnDrawListenerC0515i) interfaceExecutorC0514h).a(decorView);
        super.setContentView(i);
    }

    @Override // android.app.Activity
    public void startActivityForResult(Intent intent, int i) {
        AbstractC0983h.e("intent", intent);
        super.startActivityForResult(intent, i);
    }

    @Override // android.app.Activity
    public void startIntentSenderForResult(IntentSender intentSender, int i, Intent intent, int i5, int i6, int i7) throws IntentSender.SendIntentException {
        AbstractC0983h.e("intent", intentSender);
        super.startIntentSenderForResult(intentSender, i, intent, i5, i6, i7);
    }

    @Override // android.app.Activity
    public void startActivityForResult(Intent intent, int i, Bundle bundle) {
        AbstractC0983h.e("intent", intent);
        super.startActivityForResult(intent, i, bundle);
    }

    @Override // android.app.Activity
    public void startIntentSenderForResult(IntentSender intentSender, int i, Intent intent, int i5, int i6, int i7, Bundle bundle) {
        AbstractC0983h.e("intent", intentSender);
        super.startIntentSenderForResult(intentSender, i, intent, i5, i6, i7, bundle);
    }

    public final <I, O> AbstractC0580c registerForActivityResult(AbstractC0604a abstractC0604a, InterfaceC0579b interfaceC0579b) {
        AbstractC0983h.e("contract", abstractC0604a);
        AbstractC0983h.e("callback", interfaceC0579b);
        return registerForActivityResult(abstractC0604a, this.activityResultRegistry, interfaceC0579b);
    }

    @Override // android.app.Activity
    public void onMultiWindowModeChanged(boolean z5, Configuration configuration) {
        AbstractC0983h.e("newConfig", configuration);
        this.dispatchingOnMultiWindowModeChanged = true;
        try {
            super.onMultiWindowModeChanged(z5, configuration);
            this.dispatchingOnMultiWindowModeChanged = false;
            Iterator<O.a> it = this.onMultiWindowModeChangedListeners.iterator();
            AbstractC0983h.d("iterator(...)", it);
            while (it.hasNext()) {
                it.next().accept(new C0036g(z5));
            }
        } catch (Throwable th) {
            this.dispatchingOnMultiWindowModeChanged = false;
            throw th;
        }
    }

    @Override // android.app.Activity
    public void onPictureInPictureModeChanged(boolean z5, Configuration configuration) {
        AbstractC0983h.e("newConfig", configuration);
        this.dispatchingOnPictureInPictureModeChanged = true;
        try {
            super.onPictureInPictureModeChanged(z5, configuration);
            this.dispatchingOnPictureInPictureModeChanged = false;
            Iterator<O.a> it = this.onPictureInPictureModeChangedListeners.iterator();
            AbstractC0983h.d("iterator(...)", it);
            while (it.hasNext()) {
                it.next().accept(new D.Z(z5));
            }
        } catch (Throwable th) {
            this.dispatchingOnPictureInPictureModeChanged = false;
            throw th;
        }
    }

    @Override // android.app.Activity
    public void setContentView(View view) {
        initializeViewTreeOwners();
        InterfaceExecutorC0514h interfaceExecutorC0514h = this.reportFullyDrawnExecutor;
        View decorView = getWindow().getDecorView();
        AbstractC0983h.d("getDecorView(...)", decorView);
        ((ViewTreeObserverOnDrawListenerC0515i) interfaceExecutorC0514h).a(decorView);
        super.setContentView(view);
    }

    public void addMenuProvider(InterfaceC0171o interfaceC0171o, InterfaceC0313u interfaceC0313u) {
        AbstractC0983h.e("provider", interfaceC0171o);
        AbstractC0983h.e("owner", interfaceC0313u);
        C0170n c0170n = this.menuHostHelper;
        c0170n.f2473b.add(interfaceC0171o);
        c0170n.f2472a.run();
        AbstractC0309p lifecycle = interfaceC0313u.getLifecycle();
        HashMap map = c0170n.f2474c;
        C0169m c0169m = (C0169m) map.remove(interfaceC0171o);
        if (c0169m != null) {
            c0169m.f2469a.b(c0169m.f2470b);
            c0169m.f2470b = null;
        }
        map.put(interfaceC0171o, new C0169m(lifecycle, new C0168l(0, c0170n, interfaceC0171o)));
    }

    @Override // android.app.Activity
    public void setContentView(View view, ViewGroup.LayoutParams layoutParams) {
        initializeViewTreeOwners();
        InterfaceExecutorC0514h interfaceExecutorC0514h = this.reportFullyDrawnExecutor;
        View decorView = getWindow().getDecorView();
        AbstractC0983h.d("getDecorView(...)", decorView);
        ((ViewTreeObserverOnDrawListenerC0515i) interfaceExecutorC0514h).a(decorView);
        super.setContentView(view, layoutParams);
    }

    @SuppressLint({"LambdaLast"})
    public void addMenuProvider(final InterfaceC0171o interfaceC0171o, InterfaceC0313u interfaceC0313u, final EnumC0308o enumC0308o) {
        AbstractC0983h.e("provider", interfaceC0171o);
        AbstractC0983h.e("owner", interfaceC0313u);
        AbstractC0983h.e("state", enumC0308o);
        final C0170n c0170n = this.menuHostHelper;
        c0170n.getClass();
        AbstractC0309p lifecycle = interfaceC0313u.getLifecycle();
        HashMap map = c0170n.f2474c;
        C0169m c0169m = (C0169m) map.remove(interfaceC0171o);
        if (c0169m != null) {
            c0169m.f2469a.b(c0169m.f2470b);
            c0169m.f2470b = null;
        }
        map.put(interfaceC0171o, new C0169m(lifecycle, new InterfaceC0311s() { // from class: P.k
            @Override // androidx.lifecycle.InterfaceC0311s
            public final void a(InterfaceC0313u interfaceC0313u2, EnumC0307n enumC0307n) {
                C0170n c0170n2 = c0170n;
                c0170n2.getClass();
                EnumC0307n.Companion.getClass();
                EnumC0308o enumC0308o2 = enumC0308o;
                int iOrdinal = enumC0308o2.ordinal();
                EnumC0307n enumC0307n2 = null;
                EnumC0307n enumC0307n3 = iOrdinal != 2 ? iOrdinal != 3 ? iOrdinal != 4 ? null : EnumC0307n.ON_RESUME : EnumC0307n.ON_START : EnumC0307n.ON_CREATE;
                InterfaceC0171o interfaceC0171o2 = interfaceC0171o;
                Runnable runnable = c0170n2.f2472a;
                CopyOnWriteArrayList copyOnWriteArrayList = c0170n2.f2473b;
                if (enumC0307n == enumC0307n3) {
                    copyOnWriteArrayList.add(interfaceC0171o2);
                    runnable.run();
                    return;
                }
                EnumC0307n enumC0307n4 = EnumC0307n.ON_DESTROY;
                if (enumC0307n == enumC0307n4) {
                    c0170n2.b(interfaceC0171o2);
                    return;
                }
                int iOrdinal2 = enumC0308o2.ordinal();
                if (iOrdinal2 == 2) {
                    enumC0307n2 = enumC0307n4;
                } else if (iOrdinal2 == 3) {
                    enumC0307n2 = EnumC0307n.ON_STOP;
                } else if (iOrdinal2 == 4) {
                    enumC0307n2 = EnumC0307n.ON_PAUSE;
                }
                if (enumC0307n == enumC0307n2) {
                    copyOnWriteArrayList.remove(interfaceC0171o2);
                    runnable.run();
                }
            }
        }));
    }
}
