package androidx.activity; import android.annotation.SuppressLint; 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.os.SystemClock; import android.text.TextUtils; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.Window; import android.window.OnBackInvokedDispatcher; import androidx.activity.ComponentActivity; import androidx.activity.contextaware.ContextAware; import androidx.activity.contextaware.ContextAwareHelper; import androidx.activity.contextaware.OnContextAvailableListener; import androidx.activity.result.ActivityResultCallback; import androidx.activity.result.ActivityResultCaller; import androidx.activity.result.ActivityResultLauncher; import androidx.activity.result.ActivityResultRegistry; import androidx.activity.result.ActivityResultRegistryOwner; import androidx.activity.result.IntentSenderRequest; import androidx.activity.result.contract.ActivityResultContract; import androidx.activity.result.contract.ActivityResultContracts; import androidx.annotation.CallSuper; import androidx.annotation.ContentView; import androidx.annotation.DoNotInline; import androidx.annotation.LayoutRes; import androidx.annotation.MainThread; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.OptIn; import androidx.annotation.RequiresApi; import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityOptionsCompat; import androidx.core.app.MultiWindowModeChangedInfo; import androidx.core.app.OnMultiWindowModeChangedProvider; import androidx.core.app.OnNewIntentProvider; import androidx.core.app.OnPictureInPictureModeChangedProvider; import androidx.core.app.PictureInPictureModeChangedInfo; import androidx.core.content.OnConfigurationChangedProvider; import androidx.core.content.OnTrimMemoryProvider; import androidx.core.os.BuildCompat; import androidx.core.util.Consumer; import androidx.core.view.MenuHost; import androidx.core.view.MenuHostHelper; import androidx.core.view.MenuProvider; import androidx.lifecycle.HasDefaultViewModelProviderFactory; import androidx.lifecycle.Lifecycle; import androidx.lifecycle.LifecycleEventObserver; import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.LifecycleRegistry; import androidx.lifecycle.ReportFragment; import androidx.lifecycle.SavedStateHandleSupport; import androidx.lifecycle.SavedStateViewModelFactory; import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelStore; import androidx.lifecycle.ViewModelStoreOwner; import androidx.lifecycle.ViewTreeLifecycleOwner; import androidx.lifecycle.ViewTreeViewModelStoreOwner; import androidx.lifecycle.viewmodel.CreationExtras; import androidx.lifecycle.viewmodel.MutableCreationExtras; import androidx.savedstate.SavedStateRegistry; import androidx.savedstate.SavedStateRegistryController; import androidx.savedstate.SavedStateRegistryOwner; import androidx.savedstate.ViewTreeSavedStateRegistryOwner; import androidx.tracing.Trace; import androidx.work.WorkRequest; import java.util.Iterator; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicInteger; import kotlin.Unit; import kotlin.jvm.functions.Function0; /* loaded from: classes.dex */ public class ComponentActivity extends androidx.core.app.ComponentActivity implements ContextAware, LifecycleOwner, ViewModelStoreOwner, HasDefaultViewModelProviderFactory, SavedStateRegistryOwner, OnBackPressedDispatcherOwner, ActivityResultRegistryOwner, ActivityResultCaller, OnConfigurationChangedProvider, OnTrimMemoryProvider, OnNewIntentProvider, OnMultiWindowModeChangedProvider, OnPictureInPictureModeChangedProvider, MenuHost, FullyDrawnReporterOwner { private static final String ACTIVITY_RESULT_TAG = "android:support:activity-result"; private final ActivityResultRegistry mActivityResultRegistry; @LayoutRes private int mContentLayoutId; final ContextAwareHelper mContextAwareHelper; private ViewModelProvider.Factory mDefaultFactory; private boolean mDispatchingOnMultiWindowModeChanged; private boolean mDispatchingOnPictureInPictureModeChanged; @NonNull final FullyDrawnReporter mFullyDrawnReporter; private final LifecycleRegistry mLifecycleRegistry; private final MenuHostHelper 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; private final ReportFullyDrawnExecutor mReportFullyDrawnExecutor; final SavedStateRegistryController mSavedStateRegistryController; private ViewModelStore mViewModelStore; public static final class NonConfigurationInstances { Object custom; ViewModelStore viewModelStore; } public interface ReportFullyDrawnExecutor extends Executor { void viewCreated(@NonNull View view); } @Override // androidx.activity.result.ActivityResultRegistryOwner @NonNull public final ActivityResultRegistry getActivityResultRegistry() { return this.mActivityResultRegistry; } @Override // androidx.activity.FullyDrawnReporterOwner @NonNull public FullyDrawnReporter getFullyDrawnReporter() { return this.mFullyDrawnReporter; } @Override // androidx.core.app.ComponentActivity, androidx.lifecycle.LifecycleOwner @NonNull public Lifecycle getLifecycle() { return this.mLifecycleRegistry; } @Override // androidx.activity.OnBackPressedDispatcherOwner @NonNull public final OnBackPressedDispatcher getOnBackPressedDispatcher() { return this.mOnBackPressedDispatcher; } @Nullable @Deprecated public Object onRetainCustomNonConfigurationInstance() { return null; } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ Unit lambda$new$0() { reportFullyDrawn(); return null; } public ComponentActivity() { this.mContextAwareHelper = new ContextAwareHelper(); this.mMenuHostHelper = new MenuHostHelper(new Runnable() { // from class: androidx.activity.ComponentActivity$$ExternalSyntheticLambda0 @Override // java.lang.Runnable public final void run() { ComponentActivity.this.invalidateMenu(); } }); this.mLifecycleRegistry = new LifecycleRegistry(this); SavedStateRegistryController create = SavedStateRegistryController.create(this); this.mSavedStateRegistryController = create; this.mOnBackPressedDispatcher = new OnBackPressedDispatcher(new Runnable() { // from class: androidx.activity.ComponentActivity.1 @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; } } } }); ReportFullyDrawnExecutor createFullyDrawnExecutor = createFullyDrawnExecutor(); this.mReportFullyDrawnExecutor = createFullyDrawnExecutor; this.mFullyDrawnReporter = new FullyDrawnReporter(createFullyDrawnExecutor, new Function0() { // from class: androidx.activity.ComponentActivity$$ExternalSyntheticLambda1 @Override // kotlin.jvm.functions.Function0 public final Object invoke() { Unit lambda$new$0; lambda$new$0 = ComponentActivity.this.lambda$new$0(); return lambda$new$0; } }); this.mNextLocalRequestCode = new AtomicInteger(); this.mActivityResultRegistry = new ActivityResultRegistry() { // from class: androidx.activity.ComponentActivity.2 @Override // androidx.activity.result.ActivityResultRegistry public void onLaunch(final int i, @NonNull ActivityResultContract activityResultContract, I i2, @Nullable ActivityOptionsCompat activityOptionsCompat) { Bundle bundle; ComponentActivity componentActivity = ComponentActivity.this; final ActivityResultContract.SynchronousResult synchronousResult = activityResultContract.getSynchronousResult(componentActivity, i2); if (synchronousResult != null) { new Handler(Looper.getMainLooper()).post(new Runnable() { // from class: androidx.activity.ComponentActivity.2.1 @Override // java.lang.Runnable public void run() { dispatchResult(i, synchronousResult.getValue()); } }); return; } Intent createIntent = activityResultContract.createIntent(componentActivity, i2); if (createIntent.getExtras() != null && createIntent.getExtras().getClassLoader() == null) { createIntent.setExtrasClassLoader(componentActivity.getClassLoader()); } if (createIntent.hasExtra(ActivityResultContracts.StartActivityForResult.EXTRA_ACTIVITY_OPTIONS_BUNDLE)) { Bundle bundleExtra = createIntent.getBundleExtra(ActivityResultContracts.StartActivityForResult.EXTRA_ACTIVITY_OPTIONS_BUNDLE); createIntent.removeExtra(ActivityResultContracts.StartActivityForResult.EXTRA_ACTIVITY_OPTIONS_BUNDLE); bundle = bundleExtra; } else { bundle = activityOptionsCompat != null ? activityOptionsCompat.toBundle() : null; } if (ActivityResultContracts.RequestMultiplePermissions.ACTION_REQUEST_PERMISSIONS.equals(createIntent.getAction())) { String[] stringArrayExtra = createIntent.getStringArrayExtra(ActivityResultContracts.RequestMultiplePermissions.EXTRA_PERMISSIONS); if (stringArrayExtra == null) { stringArrayExtra = new String[0]; } ActivityCompat.requestPermissions(componentActivity, stringArrayExtra, i); return; } if (ActivityResultContracts.StartIntentSenderForResult.ACTION_INTENT_SENDER_REQUEST.equals(createIntent.getAction())) { IntentSenderRequest intentSenderRequest = (IntentSenderRequest) createIntent.getParcelableExtra(ActivityResultContracts.StartIntentSenderForResult.EXTRA_INTENT_SENDER_REQUEST); try { ActivityCompat.startIntentSenderForResult(componentActivity, intentSenderRequest.getIntentSender(), i, intentSenderRequest.getFillInIntent(), intentSenderRequest.getFlagsMask(), intentSenderRequest.getFlagsValues(), 0, bundle); return; } catch (IntentSender.SendIntentException e) { new Handler(Looper.getMainLooper()).post(new Runnable() { // from class: androidx.activity.ComponentActivity.2.2 @Override // java.lang.Runnable public void run() { dispatchResult(i, 0, new Intent().setAction(ActivityResultContracts.StartIntentSenderForResult.ACTION_INTENT_SENDER_REQUEST).putExtra(ActivityResultContracts.StartIntentSenderForResult.EXTRA_SEND_INTENT_EXCEPTION, e)); } }); return; } } ActivityCompat.startActivityForResult(componentActivity, createIntent, i, bundle); } }; 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().addObserver(new LifecycleEventObserver() { // from class: androidx.activity.ComponentActivity.3 @Override // androidx.lifecycle.LifecycleEventObserver public void onStateChanged(@NonNull LifecycleOwner lifecycleOwner, @NonNull Lifecycle.Event event) { if (event == Lifecycle.Event.ON_STOP) { Window window = ComponentActivity.this.getWindow(); View peekDecorView = window != null ? window.peekDecorView() : null; if (peekDecorView != null) { Api19Impl.cancelPendingInputEvents(peekDecorView); } } } }); getLifecycle().addObserver(new LifecycleEventObserver() { // from class: androidx.activity.ComponentActivity.4 @Override // androidx.lifecycle.LifecycleEventObserver public void onStateChanged(@NonNull LifecycleOwner lifecycleOwner, @NonNull Lifecycle.Event event) { if (event == Lifecycle.Event.ON_DESTROY) { ComponentActivity.this.mContextAwareHelper.clearAvailableContext(); if (ComponentActivity.this.isChangingConfigurations()) { return; } ComponentActivity.this.getViewModelStore().clear(); } } }); getLifecycle().addObserver(new LifecycleEventObserver() { // from class: androidx.activity.ComponentActivity.5 @Override // androidx.lifecycle.LifecycleEventObserver public void onStateChanged(@NonNull LifecycleOwner lifecycleOwner, @NonNull Lifecycle.Event event) { ComponentActivity.this.ensureViewModelStore(); ComponentActivity.this.getLifecycle().removeObserver(this); } }); create.performAttach(); SavedStateHandleSupport.enableSavedStateHandles(this); getSavedStateRegistry().registerSavedStateProvider(ACTIVITY_RESULT_TAG, new SavedStateRegistry.SavedStateProvider() { // from class: androidx.activity.ComponentActivity$$ExternalSyntheticLambda2 @Override // androidx.savedstate.SavedStateRegistry.SavedStateProvider public final Bundle saveState() { Bundle lambda$new$1; lambda$new$1 = ComponentActivity.this.lambda$new$1(); return lambda$new$1; } }); addOnContextAvailableListener(new OnContextAvailableListener() { // from class: androidx.activity.ComponentActivity$$ExternalSyntheticLambda3 @Override // androidx.activity.contextaware.OnContextAvailableListener public final void onContextAvailable(Context context) { ComponentActivity.this.lambda$new$2(context); } }); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ Bundle lambda$new$1() { Bundle bundle = new Bundle(); this.mActivityResultRegistry.onSaveInstanceState(bundle); return bundle; } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void lambda$new$2(Context context) { Bundle consumeRestoredStateForKey = getSavedStateRegistry().consumeRestoredStateForKey(ACTIVITY_RESULT_TAG); if (consumeRestoredStateForKey != null) { this.mActivityResultRegistry.onRestoreInstanceState(consumeRestoredStateForKey); } } @ContentView public ComponentActivity(@LayoutRes int i) { this(); this.mContentLayoutId = i; } @Override // androidx.core.app.ComponentActivity, android.app.Activity @OptIn(markerClass = {BuildCompat.PrereleaseSdkCheck.class}) public void onCreate(@Nullable Bundle bundle) { this.mSavedStateRegistryController.performRestore(bundle); this.mContextAwareHelper.dispatchOnContextAvailable(this); super.onCreate(bundle); ReportFragment.injectIfNeededIn(this); if (BuildCompat.isAtLeastT()) { this.mOnBackPressedDispatcher.setOnBackInvokedDispatcher(Api33Impl.getOnBackInvokedDispatcher(this)); } int i = this.mContentLayoutId; if (i != 0) { setContentView(i); } } @Override // androidx.core.app.ComponentActivity, android.app.Activity @CallSuper public void onSaveInstanceState(@NonNull Bundle bundle) { Lifecycle lifecycle = getLifecycle(); if (lifecycle instanceof LifecycleRegistry) { ((LifecycleRegistry) lifecycle).setCurrentState(Lifecycle.State.CREATED); } super.onSaveInstanceState(bundle); this.mSavedStateRegistryController.performSave(bundle); } @Override // android.app.Activity @Nullable public final Object onRetainNonConfigurationInstance() { NonConfigurationInstances nonConfigurationInstances; Object onRetainCustomNonConfigurationInstance = onRetainCustomNonConfigurationInstance(); ViewModelStore viewModelStore = this.mViewModelStore; if (viewModelStore == null && (nonConfigurationInstances = (NonConfigurationInstances) getLastNonConfigurationInstance()) != null) { viewModelStore = nonConfigurationInstances.viewModelStore; } if (viewModelStore == null && onRetainCustomNonConfigurationInstance == null) { return null; } NonConfigurationInstances nonConfigurationInstances2 = new NonConfigurationInstances(); nonConfigurationInstances2.custom = onRetainCustomNonConfigurationInstance; nonConfigurationInstances2.viewModelStore = viewModelStore; return nonConfigurationInstances2; } @Nullable @Deprecated public Object getLastCustomNonConfigurationInstance() { NonConfigurationInstances nonConfigurationInstances = (NonConfigurationInstances) getLastNonConfigurationInstance(); if (nonConfigurationInstances != null) { return nonConfigurationInstances.custom; } return null; } @Override // android.app.Activity public void setContentView(@LayoutRes int i) { initViewTreeOwners(); this.mReportFullyDrawnExecutor.viewCreated(getWindow().getDecorView()); super.setContentView(i); } @Override // android.app.Activity public void setContentView(@SuppressLint({"UnknownNullness", "MissingNullability"}) View view) { initViewTreeOwners(); this.mReportFullyDrawnExecutor.viewCreated(getWindow().getDecorView()); super.setContentView(view); } @Override // android.app.Activity public void setContentView(@SuppressLint({"UnknownNullness", "MissingNullability"}) View view, @SuppressLint({"UnknownNullness", "MissingNullability"}) ViewGroup.LayoutParams layoutParams) { initViewTreeOwners(); this.mReportFullyDrawnExecutor.viewCreated(getWindow().getDecorView()); super.setContentView(view, layoutParams); } @Override // android.app.Activity public void addContentView(@SuppressLint({"UnknownNullness", "MissingNullability"}) View view, @SuppressLint({"UnknownNullness", "MissingNullability"}) ViewGroup.LayoutParams layoutParams) { initViewTreeOwners(); this.mReportFullyDrawnExecutor.viewCreated(getWindow().getDecorView()); super.addContentView(view, layoutParams); } private void initViewTreeOwners() { ViewTreeLifecycleOwner.set(getWindow().getDecorView(), this); ViewTreeViewModelStoreOwner.set(getWindow().getDecorView(), this); ViewTreeSavedStateRegistryOwner.set(getWindow().getDecorView(), this); ViewTreeOnBackPressedDispatcherOwner.set(getWindow().getDecorView(), this); ViewTreeFullyDrawnReporterOwner.set(getWindow().getDecorView(), this); } @Override // androidx.activity.contextaware.ContextAware @Nullable public Context peekAvailableContext() { return this.mContextAwareHelper.peekAvailableContext(); } @Override // androidx.activity.contextaware.ContextAware public final void addOnContextAvailableListener(@NonNull OnContextAvailableListener onContextAvailableListener) { this.mContextAwareHelper.addOnContextAvailableListener(onContextAvailableListener); } @Override // androidx.activity.contextaware.ContextAware public final void removeOnContextAvailableListener(@NonNull OnContextAvailableListener onContextAvailableListener) { this.mContextAwareHelper.removeOnContextAvailableListener(onContextAvailableListener); } @Override // android.app.Activity, android.view.Window.Callback public boolean onPreparePanel(int i, @Nullable View view, @NonNull Menu menu) { if (i != 0) { return true; } super.onPreparePanel(i, view, menu); this.mMenuHostHelper.onPrepareMenu(menu); return true; } @Override // android.app.Activity, android.view.Window.Callback public boolean onCreatePanelMenu(int i, @NonNull Menu menu) { if (i != 0) { return true; } super.onCreatePanelMenu(i, menu); this.mMenuHostHelper.onCreateMenu(menu, getMenuInflater()); return true; } @Override // android.app.Activity, android.view.Window.Callback public boolean onMenuItemSelected(int i, @NonNull MenuItem menuItem) { if (super.onMenuItemSelected(i, menuItem)) { return true; } if (i == 0) { return this.mMenuHostHelper.onMenuItemSelected(menuItem); } return false; } @Override // android.app.Activity, android.view.Window.Callback public void onPanelClosed(int i, @NonNull Menu menu) { this.mMenuHostHelper.onMenuClosed(menu); super.onPanelClosed(i, menu); } @Override // androidx.core.view.MenuHost public void addMenuProvider(@NonNull MenuProvider menuProvider) { this.mMenuHostHelper.addMenuProvider(menuProvider); } @Override // androidx.core.view.MenuHost public void addMenuProvider(@NonNull MenuProvider menuProvider, @NonNull LifecycleOwner lifecycleOwner) { this.mMenuHostHelper.addMenuProvider(menuProvider, lifecycleOwner); } @Override // androidx.core.view.MenuHost @SuppressLint({"LambdaLast"}) public void addMenuProvider(@NonNull MenuProvider menuProvider, @NonNull LifecycleOwner lifecycleOwner, @NonNull Lifecycle.State state) { this.mMenuHostHelper.addMenuProvider(menuProvider, lifecycleOwner, state); } @Override // androidx.core.view.MenuHost public void removeMenuProvider(@NonNull MenuProvider menuProvider) { this.mMenuHostHelper.removeMenuProvider(menuProvider); } @Override // androidx.core.view.MenuHost public void invalidateMenu() { invalidateOptionsMenu(); } @Override // androidx.lifecycle.ViewModelStoreOwner @NonNull public ViewModelStore 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; } public void ensureViewModelStore() { if (this.mViewModelStore == null) { NonConfigurationInstances nonConfigurationInstances = (NonConfigurationInstances) getLastNonConfigurationInstance(); if (nonConfigurationInstances != null) { this.mViewModelStore = nonConfigurationInstances.viewModelStore; } if (this.mViewModelStore == null) { this.mViewModelStore = new ViewModelStore(); } } } @Override // androidx.lifecycle.HasDefaultViewModelProviderFactory @NonNull public ViewModelProvider.Factory getDefaultViewModelProviderFactory() { if (this.mDefaultFactory == null) { this.mDefaultFactory = new SavedStateViewModelFactory(getApplication(), this, getIntent() != null ? getIntent().getExtras() : null); } return this.mDefaultFactory; } @Override // androidx.lifecycle.HasDefaultViewModelProviderFactory @NonNull @CallSuper public CreationExtras getDefaultViewModelCreationExtras() { MutableCreationExtras mutableCreationExtras = new MutableCreationExtras(); if (getApplication() != null) { mutableCreationExtras.set(ViewModelProvider.AndroidViewModelFactory.APPLICATION_KEY, getApplication()); } mutableCreationExtras.set(SavedStateHandleSupport.SAVED_STATE_REGISTRY_OWNER_KEY, this); mutableCreationExtras.set(SavedStateHandleSupport.VIEW_MODEL_STORE_OWNER_KEY, this); if (getIntent() != null && getIntent().getExtras() != null) { mutableCreationExtras.set(SavedStateHandleSupport.DEFAULT_ARGS_KEY, getIntent().getExtras()); } return mutableCreationExtras; } @Override // android.app.Activity @MainThread public void onBackPressed() { this.mOnBackPressedDispatcher.onBackPressed(); } @Override // androidx.savedstate.SavedStateRegistryOwner @NonNull public final SavedStateRegistry getSavedStateRegistry() { return this.mSavedStateRegistryController.getSavedStateRegistry(); } @Override // android.app.Activity @Deprecated public void startActivityForResult(@NonNull Intent intent, int i) { super.startActivityForResult(intent, i); } @Override // android.app.Activity @Deprecated public void startActivityForResult(@NonNull Intent intent, int i, @Nullable Bundle bundle) { super.startActivityForResult(intent, i, bundle); } @Override // android.app.Activity @Deprecated public void startIntentSenderForResult(@NonNull IntentSender intentSender, int i, @Nullable 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(@NonNull IntentSender intentSender, int i, @Nullable Intent intent, int i2, int i3, int i4, @Nullable Bundle bundle) throws IntentSender.SendIntentException { super.startIntentSenderForResult(intentSender, i, intent, i2, i3, i4, bundle); } @Override // android.app.Activity @CallSuper @Deprecated public void onActivityResult(int i, int i2, @Nullable Intent intent) { if (this.mActivityResultRegistry.dispatchResult(i, i2, intent)) { return; } super.onActivityResult(i, i2, intent); } @Override // android.app.Activity @CallSuper @Deprecated public void onRequestPermissionsResult(int i, @NonNull String[] strArr, @NonNull int[] iArr) { if (this.mActivityResultRegistry.dispatchResult(i, -1, new Intent().putExtra(ActivityResultContracts.RequestMultiplePermissions.EXTRA_PERMISSIONS, strArr).putExtra(ActivityResultContracts.RequestMultiplePermissions.EXTRA_PERMISSION_GRANT_RESULTS, iArr))) { return; } super.onRequestPermissionsResult(i, strArr, iArr); } @Override // androidx.activity.result.ActivityResultCaller @NonNull public final ActivityResultLauncher registerForActivityResult(@NonNull ActivityResultContract activityResultContract, @NonNull ActivityResultRegistry activityResultRegistry, @NonNull ActivityResultCallback activityResultCallback) { return activityResultRegistry.register("activity_rq#" + this.mNextLocalRequestCode.getAndIncrement(), this, activityResultContract, activityResultCallback); } @Override // androidx.activity.result.ActivityResultCaller @NonNull public final ActivityResultLauncher registerForActivityResult(@NonNull ActivityResultContract activityResultContract, @NonNull ActivityResultCallback activityResultCallback) { return registerForActivityResult(activityResultContract, this.mActivityResultRegistry, activityResultCallback); } @Override // android.app.Activity, android.content.ComponentCallbacks @CallSuper public void onConfigurationChanged(@NonNull Configuration configuration) { super.onConfigurationChanged(configuration); Iterator> it = this.mOnConfigurationChangedListeners.iterator(); while (it.hasNext()) { it.next().accept(configuration); } } @Override // androidx.core.content.OnConfigurationChangedProvider public final void addOnConfigurationChangedListener(@NonNull Consumer consumer) { this.mOnConfigurationChangedListeners.add(consumer); } @Override // androidx.core.content.OnConfigurationChangedProvider public final void removeOnConfigurationChangedListener(@NonNull Consumer consumer) { this.mOnConfigurationChangedListeners.remove(consumer); } @Override // android.app.Activity, android.content.ComponentCallbacks2 @CallSuper public void onTrimMemory(int i) { super.onTrimMemory(i); Iterator> it = this.mOnTrimMemoryListeners.iterator(); while (it.hasNext()) { it.next().accept(Integer.valueOf(i)); } } @Override // androidx.core.content.OnTrimMemoryProvider public final void addOnTrimMemoryListener(@NonNull Consumer consumer) { this.mOnTrimMemoryListeners.add(consumer); } @Override // androidx.core.content.OnTrimMemoryProvider public final void removeOnTrimMemoryListener(@NonNull Consumer consumer) { this.mOnTrimMemoryListeners.remove(consumer); } @Override // android.app.Activity @CallSuper public void onNewIntent(@SuppressLint({"UnknownNullness", "MissingNullability"}) Intent intent) { super.onNewIntent(intent); Iterator> it = this.mOnNewIntentListeners.iterator(); while (it.hasNext()) { it.next().accept(intent); } } @Override // androidx.core.app.OnNewIntentProvider public final void addOnNewIntentListener(@NonNull Consumer consumer) { this.mOnNewIntentListeners.add(consumer); } @Override // androidx.core.app.OnNewIntentProvider public final void removeOnNewIntentListener(@NonNull Consumer consumer) { this.mOnNewIntentListeners.remove(consumer); } @Override // android.app.Activity @CallSuper public void onMultiWindowModeChanged(boolean z) { if (this.mDispatchingOnMultiWindowModeChanged) { return; } Iterator> it = this.mOnMultiWindowModeChangedListeners.iterator(); while (it.hasNext()) { it.next().accept(new MultiWindowModeChangedInfo(z)); } } @Override // android.app.Activity @RequiresApi(api = 26) @CallSuper public void onMultiWindowModeChanged(boolean z, @NonNull 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 MultiWindowModeChangedInfo(z, configuration)); } } catch (Throwable th) { this.mDispatchingOnMultiWindowModeChanged = false; throw th; } } @Override // androidx.core.app.OnMultiWindowModeChangedProvider public final void addOnMultiWindowModeChangedListener(@NonNull Consumer consumer) { this.mOnMultiWindowModeChangedListeners.add(consumer); } @Override // androidx.core.app.OnMultiWindowModeChangedProvider public final void removeOnMultiWindowModeChangedListener(@NonNull Consumer consumer) { this.mOnMultiWindowModeChangedListeners.remove(consumer); } @Override // android.app.Activity @CallSuper public void onPictureInPictureModeChanged(boolean z) { if (this.mDispatchingOnPictureInPictureModeChanged) { return; } Iterator> it = this.mOnPictureInPictureModeChangedListeners.iterator(); while (it.hasNext()) { it.next().accept(new PictureInPictureModeChangedInfo(z)); } } @Override // android.app.Activity @RequiresApi(api = 26) @CallSuper public void onPictureInPictureModeChanged(boolean z, @NonNull 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 PictureInPictureModeChangedInfo(z, configuration)); } } catch (Throwable th) { this.mDispatchingOnPictureInPictureModeChanged = false; throw th; } } @Override // androidx.core.app.OnPictureInPictureModeChangedProvider public final void addOnPictureInPictureModeChangedListener(@NonNull Consumer consumer) { this.mOnPictureInPictureModeChangedListeners.add(consumer); } @Override // androidx.core.app.OnPictureInPictureModeChangedProvider public final void removeOnPictureInPictureModeChangedListener(@NonNull Consumer consumer) { this.mOnPictureInPictureModeChangedListeners.remove(consumer); } @Override // android.app.Activity public void reportFullyDrawn() { try { if (Trace.isEnabled()) { Trace.beginSection("reportFullyDrawn() for ComponentActivity"); } super.reportFullyDrawn(); this.mFullyDrawnReporter.fullyDrawnReported(); Trace.endSection(); } catch (Throwable th) { Trace.endSection(); throw th; } } private ReportFullyDrawnExecutor createFullyDrawnExecutor() { return new ReportFullyDrawnExecutorApi16Impl(); } @RequiresApi(19) public static class Api19Impl { private Api19Impl() { } public static void cancelPendingInputEvents(View view) { view.cancelPendingInputEvents(); } } @RequiresApi(33) public static class Api33Impl { private Api33Impl() { } @DoNotInline public static OnBackInvokedDispatcher getOnBackInvokedDispatcher(Activity activity) { return activity.getOnBackInvokedDispatcher(); } } public static class ReportFullyDrawnExecutorApi1 implements ReportFullyDrawnExecutor { final Handler mHandler = createHandler(); @Override // androidx.activity.ComponentActivity.ReportFullyDrawnExecutor public void viewCreated(@NonNull View view) { } @Override // java.util.concurrent.Executor public void execute(Runnable runnable) { this.mHandler.postAtFrontOfQueue(runnable); } @NonNull private Handler createHandler() { Looper myLooper = Looper.myLooper(); if (myLooper == null) { myLooper = Looper.getMainLooper(); } return new Handler(myLooper); } } @RequiresApi(16) public class ReportFullyDrawnExecutorApi16Impl implements ReportFullyDrawnExecutor, ViewTreeObserver.OnDrawListener, Runnable { final long mEndWatchTimeMillis = SystemClock.uptimeMillis() + WorkRequest.MIN_BACKOFF_MILLIS; boolean mOnDrawScheduled = false; Runnable mRunnable; public ReportFullyDrawnExecutorApi16Impl() { } @Override // androidx.activity.ComponentActivity.ReportFullyDrawnExecutor public void viewCreated(@NonNull View view) { if (this.mOnDrawScheduled) { return; } this.mOnDrawScheduled = true; view.getViewTreeObserver().addOnDrawListener(this); } @Override // java.util.concurrent.Executor public void execute(Runnable runnable) { this.mRunnable = runnable; View decorView = ComponentActivity.this.getWindow().getDecorView(); if (this.mOnDrawScheduled) { if (Looper.myLooper() == Looper.getMainLooper()) { decorView.invalidate(); return; } else { decorView.postInvalidate(); return; } } decorView.postOnAnimation(new Runnable() { // from class: androidx.activity.ComponentActivity$ReportFullyDrawnExecutorApi16Impl$$ExternalSyntheticLambda0 @Override // java.lang.Runnable public final void run() { ComponentActivity.ReportFullyDrawnExecutorApi16Impl.this.lambda$execute$0(); } }); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void lambda$execute$0() { Runnable runnable = this.mRunnable; if (runnable != null) { runnable.run(); this.mRunnable = null; } } @Override // android.view.ViewTreeObserver.OnDrawListener public void onDraw() { Runnable runnable = this.mRunnable; if (runnable == null) { if (SystemClock.uptimeMillis() > this.mEndWatchTimeMillis) { this.mOnDrawScheduled = false; ComponentActivity.this.getWindow().getDecorView().post(this); return; } return; } runnable.run(); this.mRunnable = null; if (ComponentActivity.this.mFullyDrawnReporter.isFullyDrawnReported()) { this.mOnDrawScheduled = false; ComponentActivity.this.getWindow().getDecorView().post(this); } } @Override // java.lang.Runnable public void run() { ComponentActivity.this.getWindow().getDecorView().getViewTreeObserver().removeOnDrawListener(this); } } }