package androidx.activity; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.IntentSender; import android.content.res.Configuration; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.text.TextUtils; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.window.OnBackInvokedDispatcher; import androidx.activity.ComponentActivity; import androidx.core.app.ActivityCompat; import androidx.lifecycle.ReportFragment; import java.util.Iterator; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.atomic.AtomicInteger; import o.AHZ; import o.AbstractC6423cSf; import o.AcL; import o.C0801Ovz; import o.C1281ZnX; import o.C16768rAP; import o.C17072tgb; import o.C17256vKb; import o.C17488xFm; import o.C6212cMN; import o.C7432coF; import o.C7587crD; import o.CVP; import o.CWH; import o.CeN; import o.DyT; import o.FNE; import o.GvH; import o.HLt; import o.InterfaceC0834Plv; import o.InterfaceC0940Ryk; import o.InterfaceC16139lbS; import o.InterfaceC16541pFg; import o.InterfaceC17278vUG; import o.InterfaceC17396wQp; import o.InterfaceC3451axm; import o.InterfaceC9254dgJ; import o.LPk; import o.NHB; import o.QUU; import o.RIz; import o.VLM; import o.VYa; import o.WDF; import o.Wax; import o.huo; import o.jNh; import o.mxa; import o.sUv; import o.vPa; import o.wdQ; /* loaded from: classes.dex */ public class ComponentActivity extends androidx.core.app.ComponentActivity implements InterfaceC16541pFg, InterfaceC0940Ryk, GvH, InterfaceC9254dgJ, NHB, mxa, VYa, InterfaceC16139lbS, InterfaceC17396wQp, WDF, RIz { private static final String ACTIVITY_RESULT_TAG = "android:support:activity-result"; private final CeN mActivityResultRegistry; private int mContentLayoutId; final C1281ZnX mContextAwareHelper; private VLM.LWm mDefaultFactory; private boolean mDispatchingOnMultiWindowModeChanged; private boolean mDispatchingOnPictureInPictureModeChanged; private final LPk mLifecycleRegistry; private final C7587crD mMenuHostHelper; private final AtomicInteger mNextLocalRequestCode; private final OnBackPressedDispatcher mOnBackPressedDispatcher; private final CopyOnWriteArrayList> mOnConfigurationChangedListeners; private final CopyOnWriteArrayList> mOnMultiWindowModeChangedListeners; private final CopyOnWriteArrayList> mOnNewIntentListeners; private final CopyOnWriteArrayList> mOnPictureInPictureModeChangedListeners; private final CopyOnWriteArrayList> mOnTrimMemoryListeners; final C7432coF mSavedStateRegistryController; private sUv mViewModelStore; @Override // o.mxa public final CeN getActivityResultRegistry() { return this.mActivityResultRegistry; } @Override // androidx.core.app.ComponentActivity, o.InterfaceC16541pFg public wdQ getLifecycle() { return this.mLifecycleRegistry; } @Override // o.NHB public final OnBackPressedDispatcher getOnBackPressedDispatcher() { return this.mOnBackPressedDispatcher; } @Deprecated public Object onRetainCustomNonConfigurationInstance() { return null; } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static final class LWm { Object a; sUv b; LWm() { } } public ComponentActivity() { this.mContextAwareHelper = new C1281ZnX(); this.mMenuHostHelper = new C7587crD(new Runnable(this) { // from class: o.IeS public final ComponentActivity a; @Override // java.lang.Runnable public final void run() { this.a.invalidateMenu(); } { this.a = this; } }); this.mLifecycleRegistry = new LPk(this); C7432coF a = C7432coF.a(this); this.mSavedStateRegistryController = a; this.mOnBackPressedDispatcher = new OnBackPressedDispatcher(new Runnable(this) { // from class: androidx.activity.ComponentActivity.2 final ComponentActivity a; { this.a = this; } @Override // java.lang.Runnable public final void run() { try { ComponentActivity.super.onBackPressed(); } catch (IllegalStateException e) { if (!TextUtils.equals(e.getMessage(), "Can not perform this action after onSaveInstanceState")) { throw e; } } } }); this.mNextLocalRequestCode = new AtomicInteger(); this.mActivityResultRegistry = new CeN(this) { // from class: androidx.activity.ComponentActivity.1 final ComponentActivity e; { this.e = this; } @Override // o.CeN public final void e(int i, AbstractC6423cSf abstractC6423cSf, I i2, Wax wax) { Bundle mf_; ComponentActivity componentActivity = this.e; AbstractC6423cSf.RVV e = abstractC6423cSf.e(componentActivity, i2); if (e != null) { new Handler(Looper.getMainLooper()).post(new Runnable(this, i, e) { // from class: androidx.activity.ComponentActivity.1.5 final AbstractC6423cSf.RVV a; final int c; final AnonymousClass1 e; { this.e = this; this.c = i; this.a = e; } @Override // java.lang.Runnable public final void run() { AnonymousClass1 anonymousClass1 = this.e; int i3 = this.c; Object obj = this.a.e; String str = anonymousClass1.f.get(Integer.valueOf(i3)); if (str != null) { CeN.Sts sts = anonymousClass1.b.get(str); if (sts == null || sts.c == null) { anonymousClass1.j.remove(str); anonymousClass1.a.put(str, obj); } else { InterfaceC0834Plv interfaceC0834Plv = sts.c; if (anonymousClass1.d.remove(str)) { interfaceC0834Plv.d(obj); } } } } }); return; } Intent YF_ = abstractC6423cSf.YF_(componentActivity, i2); if (YF_.getExtras() != null && YF_.getExtras().getClassLoader() == null) { YF_.setExtrasClassLoader(componentActivity.getClassLoader()); } if (YF_.hasExtra("androidx.activity.result.contract.extra.ACTIVITY_OPTIONS_BUNDLE")) { Bundle bundleExtra = YF_.getBundleExtra("androidx.activity.result.contract.extra.ACTIVITY_OPTIONS_BUNDLE"); YF_.removeExtra("androidx.activity.result.contract.extra.ACTIVITY_OPTIONS_BUNDLE"); mf_ = bundleExtra; } else { mf_ = wax != null ? wax.mf_() : null; } if ("androidx.activity.result.contract.action.REQUEST_PERMISSIONS".equals(YF_.getAction())) { String[] stringArrayExtra = YF_.getStringArrayExtra("androidx.activity.result.contract.extra.PERMISSIONS"); if (stringArrayExtra == null) { stringArrayExtra = new String[0]; } ActivityCompat.lM_(componentActivity, stringArrayExtra, i); return; } if ("androidx.activity.result.contract.action.INTENT_SENDER_REQUEST".equals(YF_.getAction())) { AcL acL = (AcL) YF_.getParcelableExtra("androidx.activity.result.contract.extra.INTENT_SENDER_REQUEST"); try { ActivityCompat.lR_(componentActivity, acL.a, i, acL.b, acL.e, acL.c, 0, mf_); return; } catch (IntentSender.SendIntentException e2) { new Handler(Looper.getMainLooper()).post(new Runnable(this, i, e2) { // from class: androidx.activity.ComponentActivity.1.1 final IntentSender.SendIntentException a; final int c; final AnonymousClass1 d; { this.d = this; this.c = i; this.a = e2; } @Override // java.lang.Runnable public final void run() { bC_(this.c, 0, new Intent().setAction("androidx.activity.result.contract.action.INTENT_SENDER_REQUEST").putExtra("androidx.activity.result.contract.extra.SEND_INTENT_EXCEPTION", this.a)); } }); return; } } ActivityCompat.lQ_(componentActivity, YF_, i, mf_); } }; this.mOnConfigurationChangedListeners = new CopyOnWriteArrayList<>(); this.mOnTrimMemoryListeners = new CopyOnWriteArrayList<>(); this.mOnNewIntentListeners = new CopyOnWriteArrayList<>(); this.mOnMultiWindowModeChangedListeners = new CopyOnWriteArrayList<>(); this.mOnPictureInPictureModeChangedListeners = new CopyOnWriteArrayList<>(); this.mDispatchingOnMultiWindowModeChanged = false; this.mDispatchingOnPictureInPictureModeChanged = false; 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().e(new InterfaceC3451axm(this) { // from class: androidx.activity.ComponentActivity.3 final ComponentActivity c; { this.c = this; } @Override // o.InterfaceC3451axm public final void c(InterfaceC16541pFg interfaceC16541pFg, wdQ.HBt hBt) { if (hBt == wdQ.HBt.ON_STOP) { Window window = this.c.getWindow(); View peekDecorView = window != null ? window.peekDecorView() : null; if (peekDecorView != null) { IeS.b(peekDecorView); } } } }); getLifecycle().e(new InterfaceC3451axm(this) { // from class: androidx.activity.ComponentActivity.4 final ComponentActivity d; { this.d = this; } @Override // o.InterfaceC3451axm public final void c(InterfaceC16541pFg interfaceC16541pFg, wdQ.HBt hBt) { if (hBt == wdQ.HBt.ON_DESTROY) { this.d.mContextAwareHelper.a = null; if (this.d.isChangingConfigurations()) { return; } this.d.getViewModelStore().d(); } } }); getLifecycle().e(new InterfaceC3451axm(this) { // from class: androidx.activity.ComponentActivity.5 final ComponentActivity e; { this.e = this; } @Override // o.InterfaceC3451axm public final void c(InterfaceC16541pFg interfaceC16541pFg, wdQ.HBt hBt) { this.e.ensureViewModelStore(); this.e.getLifecycle().a(this); } }); a.b(); HLt.d(this); getSavedStateRegistry().a(ACTIVITY_RESULT_TAG, new FNE.Sts(this) { // from class: o.LWm public final ComponentActivity e; @Override // o.FNE.Sts public final Bundle AK_() { return this.e.m0lambda$new$0$androidxactivityComponentActivity(); } { this.e = this; } }); addOnContextAvailableListener(new InterfaceC17278vUG(this) { // from class: o.Sts public final ComponentActivity e; @Override // o.InterfaceC17278vUG public final void a(Context context) { this.e.m1lambda$new$1$androidxactivityComponentActivity(context); } { this.e = this; } }); } /* renamed from: lambda$new$0$androidx-activity-ComponentActivity, reason: not valid java name */ public /* synthetic */ Bundle m0lambda$new$0$androidxactivityComponentActivity() { Bundle bundle = new Bundle(); this.mActivityResultRegistry.bE_(bundle); return bundle; } /* renamed from: lambda$new$1$androidx-activity-ComponentActivity, reason: not valid java name */ public /* synthetic */ void m1lambda$new$1$androidxactivityComponentActivity(Context context) { Bundle AH_ = getSavedStateRegistry().AH_(ACTIVITY_RESULT_TAG); if (AH_ != null) { this.mActivityResultRegistry.bD_(AH_); } } public ComponentActivity(int i) { this(); this.mContentLayoutId = i; } @Override // androidx.core.app.ComponentActivity, android.app.Activity public void onCreate(Bundle bundle) { this.mSavedStateRegistryController.AL_(bundle); this.mContextAwareHelper.c(this); super.onCreate(bundle); ReportFragment.zv_(this); if (C17488xFm.c()) { this.mOnBackPressedDispatcher.bz_(Sts.by_(this)); } int i = this.mContentLayoutId; if (i != 0) { setContentView(i); } } @Override // androidx.core.app.ComponentActivity, android.app.Activity public void onSaveInstanceState(Bundle bundle) { wdQ lifecycle = getLifecycle(); if (lifecycle instanceof LPk) { ((LPk) lifecycle).b(wdQ.IeS.CREATED); } super.onSaveInstanceState(bundle); this.mSavedStateRegistryController.AM_(bundle); } @Override // android.app.Activity public final Object onRetainNonConfigurationInstance() { LWm lWm; Object onRetainCustomNonConfigurationInstance = onRetainCustomNonConfigurationInstance(); sUv suv = this.mViewModelStore; if (suv == null && (lWm = (LWm) getLastNonConfigurationInstance()) != null) { suv = lWm.b; } if (suv == null && onRetainCustomNonConfigurationInstance == null) { return null; } LWm lWm2 = new LWm(); lWm2.a = onRetainCustomNonConfigurationInstance; lWm2.b = suv; return lWm2; } @Deprecated public Object getLastCustomNonConfigurationInstance() { LWm lWm = (LWm) getLastNonConfigurationInstance(); if (lWm != null) { return lWm.a; } return null; } @Override // android.app.Activity public void setContentView(int i) { initViewTreeOwners(); super.setContentView(i); } @Override // android.app.Activity public void setContentView(View view) { initViewTreeOwners(); super.setContentView(view); } @Override // android.app.Activity public void setContentView(View view, ViewGroup.LayoutParams layoutParams) { initViewTreeOwners(); super.setContentView(view, layoutParams); } @Override // android.app.Activity public void addContentView(View view, ViewGroup.LayoutParams layoutParams) { initViewTreeOwners(); super.addContentView(view, layoutParams); } private void initViewTreeOwners() { C17072tgb.a(getWindow().getDecorView(), this); C17256vKb.d(getWindow().getDecorView(), this); DyT.b(getWindow().getDecorView(), this); jNh.c(getWindow().getDecorView(), this); } public Context peekAvailableContext() { return this.mContextAwareHelper.b(); } public final void addOnContextAvailableListener(InterfaceC17278vUG interfaceC17278vUG) { this.mContextAwareHelper.b(interfaceC17278vUG); } public final void removeOnContextAvailableListener(InterfaceC17278vUG interfaceC17278vUG) { this.mContextAwareHelper.e(interfaceC17278vUG); } @Override // android.app.Activity, android.view.Window.Callback public boolean onPreparePanel(int i, View view, Menu menu) { if (i != 0) { return true; } super.onPreparePanel(i, view, menu); this.mMenuHostHelper.rI_(menu); return true; } @Override // android.app.Activity, android.view.Window.Callback public boolean onCreatePanelMenu(int i, Menu menu) { if (i != 0) { return true; } super.onCreatePanelMenu(i, menu); this.mMenuHostHelper.rF_(menu, getMenuInflater()); return true; } @Override // android.app.Activity, android.view.Window.Callback public boolean onMenuItemSelected(int i, MenuItem menuItem) { if (super.onMenuItemSelected(i, menuItem)) { return true; } if (i == 0) { return this.mMenuHostHelper.rH_(menuItem); } return false; } @Override // android.app.Activity, android.view.Window.Callback public void onPanelClosed(int i, Menu menu) { this.mMenuHostHelper.rG_(menu); super.onPanelClosed(i, menu); } @Override // o.RIz public void addMenuProvider(AHZ ahz) { this.mMenuHostHelper.b(ahz); } public void addMenuProvider(AHZ ahz, InterfaceC16541pFg interfaceC16541pFg) { this.mMenuHostHelper.a(ahz, interfaceC16541pFg); } public void addMenuProvider(AHZ ahz, InterfaceC16541pFg interfaceC16541pFg, wdQ.IeS ieS) { this.mMenuHostHelper.c(ahz, interfaceC16541pFg, ieS); } @Override // o.RIz public void removeMenuProvider(AHZ ahz) { this.mMenuHostHelper.c(ahz); } public void invalidateMenu() { invalidateOptionsMenu(); } @Override // o.InterfaceC0940Ryk public sUv 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."); } ensureViewModelStore(); return this.mViewModelStore; } void ensureViewModelStore() { if (this.mViewModelStore == null) { LWm lWm = (LWm) getLastNonConfigurationInstance(); if (lWm != null) { this.mViewModelStore = lWm.b; } if (this.mViewModelStore == null) { this.mViewModelStore = new sUv(); } } } @Override // o.GvH public VLM.LWm getDefaultViewModelProviderFactory() { if (this.mDefaultFactory == null) { this.mDefaultFactory = new C16768rAP(getApplication(), this, getIntent() != null ? getIntent().getExtras() : null); } return this.mDefaultFactory; } @Override // o.GvH public CWH getDefaultViewModelCreationExtras() { CVP cvp = new CVP(); if (getApplication() != null) { cvp.c(VLM.Sts.a, getApplication()); } cvp.c(HLt.a, this); cvp.c(HLt.b, this); if (getIntent() != null && getIntent().getExtras() != null) { cvp.c(HLt.e, getIntent().getExtras()); } return cvp; } @Override // android.app.Activity public void onBackPressed() { this.mOnBackPressedDispatcher.a(); } @Override // o.InterfaceC9254dgJ public final FNE getSavedStateRegistry() { return this.mSavedStateRegistryController.d(); } @Override // android.app.Activity @Deprecated public void startActivityForResult(Intent intent, int i) { super.startActivityForResult(intent, i); } @Override // android.app.Activity @Deprecated public void startActivityForResult(Intent intent, int i, Bundle bundle) { super.startActivityForResult(intent, i, bundle); } @Override // android.app.Activity @Deprecated public void startIntentSenderForResult(IntentSender intentSender, int i, Intent intent, int i2, int i3, int i4) throws IntentSender.SendIntentException { super.startIntentSenderForResult(intentSender, i, intent, i2, i3, i4); } @Override // android.app.Activity @Deprecated public void startIntentSenderForResult(IntentSender intentSender, int i, Intent intent, int i2, int i3, int i4, Bundle bundle) throws IntentSender.SendIntentException { super.startIntentSenderForResult(intentSender, i, intent, i2, i3, i4, bundle); } @Override // android.app.Activity @Deprecated public void onActivityResult(int i, int i2, Intent intent) { if (this.mActivityResultRegistry.bC_(i, i2, intent)) { return; } super.onActivityResult(i, i2, intent); } @Override // android.app.Activity @Deprecated public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) { if (this.mActivityResultRegistry.bC_(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 final huo registerForActivityResult(AbstractC6423cSf abstractC6423cSf, CeN ceN, InterfaceC0834Plv interfaceC0834Plv) { return ceN.a("activity_rq#" + this.mNextLocalRequestCode.getAndIncrement(), this, abstractC6423cSf, interfaceC0834Plv); } public final huo registerForActivityResult(AbstractC6423cSf abstractC6423cSf, InterfaceC0834Plv interfaceC0834Plv) { return registerForActivityResult(abstractC6423cSf, this.mActivityResultRegistry, interfaceC0834Plv); } @Override // android.app.Activity, android.content.ComponentCallbacks public void onConfigurationChanged(Configuration configuration) { super.onConfigurationChanged(configuration); Iterator> it = this.mOnConfigurationChangedListeners.iterator(); while (it.hasNext()) { it.next().accept(configuration); } } @Override // o.VYa public final void addOnConfigurationChangedListener(QUU quu) { this.mOnConfigurationChangedListeners.add(quu); } @Override // o.VYa public final void removeOnConfigurationChangedListener(QUU quu) { this.mOnConfigurationChangedListeners.remove(quu); } @Override // android.app.Activity, android.content.ComponentCallbacks2 public void onTrimMemory(int i) { super.onTrimMemory(i); Iterator> it = this.mOnTrimMemoryListeners.iterator(); while (it.hasNext()) { it.next().accept(Integer.valueOf(i)); } } @Override // o.InterfaceC16139lbS public final void addOnTrimMemoryListener(QUU quu) { this.mOnTrimMemoryListeners.add(quu); } @Override // o.InterfaceC16139lbS public final void removeOnTrimMemoryListener(QUU quu) { this.mOnTrimMemoryListeners.remove(quu); } @Override // android.app.Activity public void onNewIntent(Intent intent) { super.onNewIntent(intent); Iterator> it = this.mOnNewIntentListeners.iterator(); while (it.hasNext()) { it.next().accept(intent); } } public final void addOnNewIntentListener(QUU quu) { this.mOnNewIntentListeners.add(quu); } public final void removeOnNewIntentListener(QUU quu) { this.mOnNewIntentListeners.remove(quu); } @Override // android.app.Activity public void onMultiWindowModeChanged(boolean z) { if (this.mDispatchingOnMultiWindowModeChanged) { return; } Iterator> it = this.mOnMultiWindowModeChangedListeners.iterator(); while (it.hasNext()) { it.next().accept(new vPa(z)); } } @Override // android.app.Activity public void onMultiWindowModeChanged(boolean z, Configuration configuration) { this.mDispatchingOnMultiWindowModeChanged = true; try { super.onMultiWindowModeChanged(z, configuration); this.mDispatchingOnMultiWindowModeChanged = false; Iterator> it = this.mOnMultiWindowModeChangedListeners.iterator(); while (it.hasNext()) { it.next().accept(new vPa(z, configuration)); } } catch (Throwable th) { this.mDispatchingOnMultiWindowModeChanged = false; throw th; } } @Override // o.InterfaceC17396wQp public final void addOnMultiWindowModeChangedListener(QUU quu) { this.mOnMultiWindowModeChangedListeners.add(quu); } @Override // o.InterfaceC17396wQp public final void removeOnMultiWindowModeChangedListener(QUU quu) { this.mOnMultiWindowModeChangedListeners.remove(quu); } @Override // android.app.Activity public void onPictureInPictureModeChanged(boolean z) { if (this.mDispatchingOnPictureInPictureModeChanged) { return; } Iterator> it = this.mOnPictureInPictureModeChangedListeners.iterator(); while (it.hasNext()) { it.next().accept(new C0801Ovz(z)); } } @Override // android.app.Activity public void onPictureInPictureModeChanged(boolean z, Configuration configuration) { this.mDispatchingOnPictureInPictureModeChanged = true; try { super.onPictureInPictureModeChanged(z, configuration); this.mDispatchingOnPictureInPictureModeChanged = false; Iterator> it = this.mOnPictureInPictureModeChangedListeners.iterator(); while (it.hasNext()) { it.next().accept(new C0801Ovz(z, configuration)); } } catch (Throwable th) { this.mDispatchingOnPictureInPictureModeChanged = false; throw th; } } @Override // o.WDF public final void addOnPictureInPictureModeChangedListener(QUU quu) { this.mOnPictureInPictureModeChangedListeners.add(quu); } @Override // o.WDF public final void removeOnPictureInPictureModeChangedListener(QUU quu) { this.mOnPictureInPictureModeChangedListeners.remove(quu); } @Override // android.app.Activity public void reportFullyDrawn() { try { if (C6212cMN.c()) { C6212cMN.d("reportFullyDrawn() for ComponentActivity"); } super.reportFullyDrawn(); } finally { C6212cMN.a(); } } /* loaded from: classes.dex */ static class IeS { static void b(View view) { view.cancelPendingInputEvents(); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static class Sts { static OnBackInvokedDispatcher by_(Activity activity) { return activity.getOnBackInvokedDispatcher(); } } @Override // androidx.core.app.ComponentActivity, android.app.Activity, android.view.ContextThemeWrapper, android.content.ContextWrapper public void attachBaseContext(Context context) { super.attachBaseContext(context); } @Override // androidx.core.app.ComponentActivity, android.app.Activity public void onPause() { super.onPause(); } @Override // androidx.core.app.ComponentActivity, android.app.Activity public void onResume() { super.onResume(); } @Override // androidx.core.app.ComponentActivity, android.app.Activity public void onStart() { super.onStart(); } }