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.Build; import android.os.Bundle; 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.result.AbstractC0072d; import androidx.activity.result.InterfaceC0076e; import androidx.lifecycle.AbstractC0424i; import androidx.lifecycle.C0407d0; import androidx.lifecycle.C0421g0; import androidx.lifecycle.C0428i0; import androidx.lifecycle.C0431j0; import androidx.lifecycle.C0435n; import androidx.lifecycle.C0455z; import androidx.lifecycle.FragmentC0449w; import androidx.lifecycle.InterfaceC0422h; import androidx.lifecycle.InterfaceC0423h0; import androidx.lifecycle.InterfaceC0432k; import androidx.lifecycle.InterfaceC0434m; import java.util.Iterator; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.atomic.AtomicInteger; import p000a.C0000a; import p000a.InterfaceC0001b; import p011d0.C0598a; import p020g0.InterfaceC0731a; import p023h0.C0800d0; import p056s0.AbstractC1611a; import p056s0.C1616d; import p065v0.C1755c; import p065v0.C1759d; import p065v0.C1762f; import p065v0.InterfaceC1761e; import p067w.ActivityC1780j; import p067w.C1781k; import p067w.C1786o; import p069x.C1794a; import p070x0.C1805b; /* loaded from: classes.dex */ public class ComponentActivity extends ActivityC1780j implements InterfaceC0423h0, InterfaceC0422h, InterfaceC1761e, InterfaceC0065m, InterfaceC0076e { /* renamed from: f */ public final C0000a f21f = new C0000a(); /* renamed from: g */ public final C0800d0 f22g = new C0800d0(new Runnable() { // from class: androidx.activity.b @Override // java.lang.Runnable public final void run() { ComponentActivity.this.m5026r(); } }); /* renamed from: h */ public final C0435n f23h = new C0435n(this); /* renamed from: i */ public final C1759d f24i; /* renamed from: j */ public C0421g0 f25j; /* renamed from: k */ public final OnBackPressedDispatcher f26k; /* renamed from: l */ public int f27l; /* renamed from: m */ public final AtomicInteger f28m; /* renamed from: n */ public final AbstractC0072d f29n; /* renamed from: o */ public final CopyOnWriteArrayList> f30o; /* renamed from: p */ public final CopyOnWriteArrayList> f31p; /* renamed from: q */ public final CopyOnWriteArrayList> f32q; /* renamed from: r */ public final CopyOnWriteArrayList> f33r; /* renamed from: s */ public final CopyOnWriteArrayList> f34s; /* renamed from: t */ public boolean f35t; /* renamed from: u */ public boolean f36u; /* renamed from: androidx.activity.ComponentActivity$a */ /* loaded from: classes.dex */ public class RunnableC0046a implements Runnable { public RunnableC0046a() { } @Override // java.lang.Runnable public void run() { try { ComponentActivity.super.onBackPressed(); } catch (IllegalStateException e) { if (!TextUtils.equals(e.getMessage(), "Can not perform this action after onSaveInstanceState")) { throw e; } } } } /* renamed from: androidx.activity.ComponentActivity$b */ /* loaded from: classes.dex */ public class C0047b extends AbstractC0072d { public C0047b() { } } /* renamed from: androidx.activity.ComponentActivity$c */ /* loaded from: classes.dex */ public static class C0048c { /* renamed from: a */ public static void m5022a(View view) { view.cancelPendingInputEvents(); } } /* renamed from: androidx.activity.ComponentActivity$d */ /* loaded from: classes.dex */ public static class C0049d { /* renamed from: a */ public static OnBackInvokedDispatcher m5021a(Activity activity) { return activity.getOnBackInvokedDispatcher(); } } /* renamed from: androidx.activity.ComponentActivity$e */ /* loaded from: classes.dex */ public static final class C0050e { /* renamed from: a */ public Object f42a; /* renamed from: b */ public C0421g0 f43b; } public ComponentActivity() { C1759d m460a = C1759d.m460a(this); this.f24i = m460a; this.f26k = new OnBackPressedDispatcher(new RunnableC0046a()); this.f28m = new AtomicInteger(); this.f29n = new C0047b(); this.f30o = new CopyOnWriteArrayList<>(); this.f31p = new CopyOnWriteArrayList<>(); this.f32q = new CopyOnWriteArrayList<>(); this.f33r = new CopyOnWriteArrayList<>(); this.f34s = new CopyOnWriteArrayList<>(); this.f35t = false; this.f36u = false; if (mo421a() == 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."); } int i = Build.VERSION.SDK_INT; if (i >= 19) { mo421a().mo3693a(new InterfaceC0432k() { // from class: androidx.activity.ComponentActivity.3 @Override // androidx.lifecycle.InterfaceC0432k /* renamed from: d */ public void mo472d(InterfaceC0434m interfaceC0434m, AbstractC0424i.EnumC0426b enumC0426b) { if (enumC0426b == AbstractC0424i.EnumC0426b.ON_STOP) { Window window = ComponentActivity.this.getWindow(); View peekDecorView = window != null ? window.peekDecorView() : null; if (peekDecorView != null) { C0048c.m5022a(peekDecorView); } } } }); } mo421a().mo3693a(new InterfaceC0432k() { // from class: androidx.activity.ComponentActivity.4 @Override // androidx.lifecycle.InterfaceC0432k /* renamed from: d */ public void mo472d(InterfaceC0434m interfaceC0434m, AbstractC0424i.EnumC0426b enumC0426b) { if (enumC0426b == AbstractC0424i.EnumC0426b.ON_DESTROY) { ComponentActivity.this.f21f.m5108b(); if (ComponentActivity.this.isChangingConfigurations()) { return; } ComponentActivity.this.mo3701j().m3706a(); } } }); mo421a().mo3693a(new InterfaceC0432k() { // from class: androidx.activity.ComponentActivity.5 @Override // androidx.lifecycle.InterfaceC0432k /* renamed from: d */ public void mo472d(InterfaceC0434m interfaceC0434m, AbstractC0424i.EnumC0426b enumC0426b) { ComponentActivity.this.m5028p(); ComponentActivity.this.mo421a().mo3691c(this); } }); m460a.m458c(); C0455z.m3642a(this); if (19 <= i && i <= 23) { mo421a().mo3693a(new ImmLeaksCleaner(this)); } mo454d().m464h("android:support:activity-result", new C1755c.InterfaceC1758c() { // from class: androidx.activity.c @Override // p065v0.C1755c.InterfaceC1758c /* renamed from: a */ public final Bundle mo461a() { Bundle m5025s; m5025s = ComponentActivity.this.m5025s(); return m5025s; } }); m5029o(new InterfaceC0001b() { // from class: androidx.activity.d @Override // p000a.InterfaceC0001b /* renamed from: a */ public final void mo3542a(Context context) { ComponentActivity.this.m5024t(context); } }); } /* JADX INFO: Access modifiers changed from: private */ /* renamed from: s */ public /* synthetic */ Bundle m5025s() { Bundle bundle = new Bundle(); this.f29n.m4986f(bundle); return bundle; } /* JADX INFO: Access modifiers changed from: private */ /* renamed from: t */ public /* synthetic */ void m5024t(Context context) { Bundle m470b = mo454d().m470b("android:support:activity-result"); if (m470b != null) { this.f29n.m4987e(m470b); } } @Override // p067w.ActivityC1780j, androidx.lifecycle.InterfaceC0434m /* renamed from: a */ public AbstractC0424i mo421a() { return this.f23h; } @Override // android.app.Activity public void addContentView(View view, ViewGroup.LayoutParams layoutParams) { m5027q(); super.addContentView(view, layoutParams); } @Override // androidx.lifecycle.InterfaceC0422h /* renamed from: b */ public AbstractC1611a mo3702b() { C1616d c1616d = new C1616d(); if (getApplication() != null) { c1616d.m791b(C0407d0.C0408a.f1623d, getApplication()); } c1616d.m791b(C0455z.f1672a, this); c1616d.m791b(C0455z.f1673b, this); if (getIntent() != null && getIntent().getExtras() != null) { c1616d.m791b(C0455z.f1674c, getIntent().getExtras()); } return c1616d; } @Override // androidx.activity.InterfaceC0065m /* renamed from: c */ public final OnBackPressedDispatcher mo4120c() { return this.f26k; } @Override // p065v0.InterfaceC1761e /* renamed from: d */ public final C1755c mo454d() { return this.f24i.m459b(); } @Override // androidx.activity.result.InterfaceC0076e /* renamed from: e */ public final AbstractC0072d mo4119e() { return this.f29n; } @Override // androidx.lifecycle.InterfaceC0423h0 /* renamed from: j */ public C0421g0 mo3701j() { if (getApplication() != null) { m5028p(); return this.f25j; } throw new IllegalStateException("Your activity is not yet attached to the Application instance. You can't request ViewModel before onCreate call."); } /* renamed from: o */ public final void m5029o(InterfaceC0001b interfaceC0001b) { this.f21f.m5109a(interfaceC0001b); } @Override // android.app.Activity @Deprecated public void onActivityResult(int i, int i2, Intent intent) { if (this.f29n.m4990b(i, i2, intent)) { return; } super.onActivityResult(i, i2, intent); } @Override // android.app.Activity public void onBackPressed() { this.f26k.m5014f(); } @Override // android.app.Activity, android.content.ComponentCallbacks public void onConfigurationChanged(Configuration configuration) { super.onConfigurationChanged(configuration); Iterator> it = this.f30o.iterator(); while (it.hasNext()) { it.next().accept(configuration); } } @Override // p067w.ActivityC1780j, android.app.Activity public void onCreate(Bundle bundle) { this.f24i.m457d(bundle); this.f21f.m5107c(this); super.onCreate(bundle); FragmentC0449w.m3653g(this); if (C0598a.m3289c()) { this.f26k.m5013g(C0049d.m5021a(this)); } int i = this.f27l; if (i != 0) { setContentView(i); } } @Override // android.app.Activity, android.view.Window.Callback public boolean onCreatePanelMenu(int i, Menu menu) { if (i == 0) { super.onCreatePanelMenu(i, menu); this.f22g.m2893a(menu, getMenuInflater()); return true; } 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.f22g.m2891c(menuItem); } return false; } @Override // android.app.Activity public void onMultiWindowModeChanged(boolean z) { if (this.f35t) { return; } Iterator> it = this.f33r.iterator(); while (it.hasNext()) { it.next().accept(new C1781k(z)); } } @Override // android.app.Activity public void onMultiWindowModeChanged(boolean z, Configuration configuration) { this.f35t = true; try { super.onMultiWindowModeChanged(z, configuration); this.f35t = false; Iterator> it = this.f33r.iterator(); while (it.hasNext()) { it.next().accept(new C1781k(z, configuration)); } } catch (Throwable th) { this.f35t = false; throw th; } } @Override // android.app.Activity public void onNewIntent(Intent intent) { super.onNewIntent(intent); Iterator> it = this.f32q.iterator(); while (it.hasNext()) { it.next().accept(intent); } } @Override // android.app.Activity, android.view.Window.Callback public void onPanelClosed(int i, Menu menu) { this.f22g.m2892b(menu); super.onPanelClosed(i, menu); } @Override // android.app.Activity public void onPictureInPictureModeChanged(boolean z) { if (this.f36u) { return; } Iterator> it = this.f34s.iterator(); while (it.hasNext()) { it.next().accept(new C1786o(z)); } } @Override // android.app.Activity public void onPictureInPictureModeChanged(boolean z, Configuration configuration) { this.f36u = true; try { super.onPictureInPictureModeChanged(z, configuration); this.f36u = false; Iterator> it = this.f34s.iterator(); while (it.hasNext()) { it.next().accept(new C1786o(z, configuration)); } } catch (Throwable th) { this.f36u = false; throw th; } } @Override // android.app.Activity, android.view.Window.Callback public boolean onPreparePanel(int i, View view, Menu menu) { if (i == 0) { super.onPreparePanel(i, view, menu); this.f22g.m2890d(menu); return true; } return true; } @Override // android.app.Activity @Deprecated public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) { if (this.f29n.m4990b(i, -1, new Intent().putExtra("androidx.activity.result.contract.extra.PERMISSIONS", strArr).putExtra("androidx.activity.result.contract.extra.PERMISSION_GRANT_RESULTS", iArr)) || Build.VERSION.SDK_INT < 23) { return; } super.onRequestPermissionsResult(i, strArr, iArr); } @Override // android.app.Activity public final Object onRetainNonConfigurationInstance() { C0050e c0050e; Object m5023u = m5023u(); C0421g0 c0421g0 = this.f25j; if (c0421g0 == null && (c0050e = (C0050e) getLastNonConfigurationInstance()) != null) { c0421g0 = c0050e.f43b; } if (c0421g0 == null && m5023u == null) { return null; } C0050e c0050e2 = new C0050e(); c0050e2.f42a = m5023u; c0050e2.f43b = c0421g0; return c0050e2; } @Override // p067w.ActivityC1780j, android.app.Activity public void onSaveInstanceState(Bundle bundle) { AbstractC0424i mo421a = mo421a(); if (mo421a instanceof C0435n) { ((C0435n) mo421a).m3679o(AbstractC0424i.EnumC0427c.CREATED); } super.onSaveInstanceState(bundle); this.f24i.m456e(bundle); } @Override // android.app.Activity, android.content.ComponentCallbacks2 public void onTrimMemory(int i) { super.onTrimMemory(i); Iterator> it = this.f31p.iterator(); while (it.hasNext()) { it.next().accept(Integer.valueOf(i)); } } /* renamed from: p */ public void m5028p() { if (this.f25j == null) { C0050e c0050e = (C0050e) getLastNonConfigurationInstance(); if (c0050e != null) { this.f25j = c0050e.f43b; } if (this.f25j == null) { this.f25j = new C0421g0(); } } } /* renamed from: q */ public final void m5027q() { C0428i0.m3696a(getWindow().getDecorView(), this); C0431j0.m3694a(getWindow().getDecorView(), this); C1762f.m453a(getWindow().getDecorView(), this); C0067o.m4997a(getWindow().getDecorView(), this); } /* renamed from: r */ public void m5026r() { invalidateOptionsMenu(); } @Override // android.app.Activity public void reportFullyDrawn() { try { if (C1805b.m367d()) { C1805b.m370a("reportFullyDrawn() for ComponentActivity"); } int i = Build.VERSION.SDK_INT; if (i > 19 || (i == 19 && C1794a.m391a(this, "android.permission.UPDATE_DEVICE_STATS") == 0)) { super.reportFullyDrawn(); } } finally { C1805b.m369b(); } } @Override // android.app.Activity public void setContentView(int i) { m5027q(); super.setContentView(i); } @Override // android.app.Activity public void setContentView(View view) { m5027q(); super.setContentView(view); } @Override // android.app.Activity public void setContentView(View view, ViewGroup.LayoutParams layoutParams) { m5027q(); super.setContentView(view, layoutParams); } @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) { 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) { super.startIntentSenderForResult(intentSender, i, intent, i2, i3, i4, bundle); } @Deprecated /* renamed from: u */ public Object m5023u() { return null; } }