mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-28 18:12:31 -06:00
874 lines
40 KiB
Java
874 lines
40 KiB
Java
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.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.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.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;
|
|
private int mContentLayoutId;
|
|
final ContextAwareHelper mContextAwareHelper;
|
|
private ViewModelProvider.Factory mDefaultFactory;
|
|
private boolean mDispatchingOnMultiWindowModeChanged;
|
|
private boolean mDispatchingOnPictureInPictureModeChanged;
|
|
final FullyDrawnReporter mFullyDrawnReporter;
|
|
private final LifecycleRegistry mLifecycleRegistry;
|
|
private final MenuHostHelper mMenuHostHelper;
|
|
private final AtomicInteger mNextLocalRequestCode;
|
|
private OnBackPressedDispatcher mOnBackPressedDispatcher;
|
|
private final CopyOnWriteArrayList<Consumer<Configuration>> mOnConfigurationChangedListeners;
|
|
private final CopyOnWriteArrayList<Consumer<MultiWindowModeChangedInfo>> mOnMultiWindowModeChangedListeners;
|
|
private final CopyOnWriteArrayList<Consumer<Intent>> mOnNewIntentListeners;
|
|
private final CopyOnWriteArrayList<Consumer<PictureInPictureModeChangedInfo>> mOnPictureInPictureModeChangedListeners;
|
|
private final CopyOnWriteArrayList<Consumer<Integer>> mOnTrimMemoryListeners;
|
|
final ReportFullyDrawnExecutor mReportFullyDrawnExecutor;
|
|
final SavedStateRegistryController mSavedStateRegistryController;
|
|
private ViewModelStore mViewModelStore;
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
/* loaded from: classes.dex */
|
|
public interface ReportFullyDrawnExecutor extends Executor {
|
|
void activityDestroyed();
|
|
|
|
void viewCreated(View view);
|
|
}
|
|
|
|
@Override // androidx.activity.result.ActivityResultRegistryOwner
|
|
public final ActivityResultRegistry getActivityResultRegistry() {
|
|
return this.mActivityResultRegistry;
|
|
}
|
|
|
|
@Override // androidx.activity.FullyDrawnReporterOwner
|
|
public FullyDrawnReporter getFullyDrawnReporter() {
|
|
return this.mFullyDrawnReporter;
|
|
}
|
|
|
|
@Override // androidx.core.app.ComponentActivity, androidx.lifecycle.LifecycleOwner
|
|
public Lifecycle getLifecycle() {
|
|
return this.mLifecycleRegistry;
|
|
}
|
|
|
|
@Deprecated
|
|
public Object onRetainCustomNonConfigurationInstance() {
|
|
return null;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes.dex */
|
|
public static final class NonConfigurationInstances {
|
|
Object custom;
|
|
ViewModelStore viewModelStore;
|
|
|
|
NonConfigurationInstances() {
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* renamed from: lambda$new$0$androidx-activity-ComponentActivity, reason: not valid java name */
|
|
public /* synthetic */ Unit m7lambda$new$0$androidxactivityComponentActivity() {
|
|
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 = null;
|
|
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() {
|
|
return ComponentActivity.this.m7lambda$new$0$androidxactivityComponentActivity();
|
|
}
|
|
});
|
|
this.mNextLocalRequestCode = new AtomicInteger();
|
|
this.mActivityResultRegistry = new ActivityResultRegistry() { // from class: androidx.activity.ComponentActivity.1
|
|
@Override // androidx.activity.result.ActivityResultRegistry
|
|
public <I, O> void onLaunch(final int i, ActivityResultContract<I, O> activityResultContract, I i2, ActivityOptionsCompat activityOptionsCompat) {
|
|
Bundle bundle;
|
|
ComponentActivity componentActivity = ComponentActivity.this;
|
|
final ActivityResultContract.SynchronousResult<O> synchronousResult = activityResultContract.getSynchronousResult(componentActivity, i2);
|
|
if (synchronousResult != null) {
|
|
new Handler(Looper.getMainLooper()).post(new Runnable() { // from class: androidx.activity.ComponentActivity.1.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.1.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.2
|
|
@Override // androidx.lifecycle.LifecycleEventObserver
|
|
public void onStateChanged(LifecycleOwner lifecycleOwner, 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.3
|
|
@Override // androidx.lifecycle.LifecycleEventObserver
|
|
public void onStateChanged(LifecycleOwner lifecycleOwner, Lifecycle.Event event) {
|
|
if (event == Lifecycle.Event.ON_DESTROY) {
|
|
ComponentActivity.this.mContextAwareHelper.clearAvailableContext();
|
|
if (!ComponentActivity.this.isChangingConfigurations()) {
|
|
ComponentActivity.this.getViewModelStore().clear();
|
|
}
|
|
ComponentActivity.this.mReportFullyDrawnExecutor.activityDestroyed();
|
|
}
|
|
}
|
|
});
|
|
getLifecycle().addObserver(new LifecycleEventObserver() { // from class: androidx.activity.ComponentActivity.4
|
|
@Override // androidx.lifecycle.LifecycleEventObserver
|
|
public void onStateChanged(LifecycleOwner lifecycleOwner, 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() {
|
|
return ComponentActivity.this.m8lambda$new$1$androidxactivityComponentActivity();
|
|
}
|
|
});
|
|
addOnContextAvailableListener(new OnContextAvailableListener() { // from class: androidx.activity.ComponentActivity$$ExternalSyntheticLambda3
|
|
@Override // androidx.activity.contextaware.OnContextAvailableListener
|
|
public final void onContextAvailable(Context context) {
|
|
ComponentActivity.this.m9lambda$new$2$androidxactivityComponentActivity(context);
|
|
}
|
|
});
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* renamed from: lambda$new$1$androidx-activity-ComponentActivity, reason: not valid java name */
|
|
public /* synthetic */ Bundle m8lambda$new$1$androidxactivityComponentActivity() {
|
|
Bundle bundle = new Bundle();
|
|
this.mActivityResultRegistry.onSaveInstanceState(bundle);
|
|
return bundle;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* renamed from: lambda$new$2$androidx-activity-ComponentActivity, reason: not valid java name */
|
|
public /* synthetic */ void m9lambda$new$2$androidxactivityComponentActivity(Context context) {
|
|
Bundle consumeRestoredStateForKey = getSavedStateRegistry().consumeRestoredStateForKey(ACTIVITY_RESULT_TAG);
|
|
if (consumeRestoredStateForKey != null) {
|
|
this.mActivityResultRegistry.onRestoreInstanceState(consumeRestoredStateForKey);
|
|
}
|
|
}
|
|
|
|
public ComponentActivity(int i) {
|
|
this();
|
|
this.mContentLayoutId = i;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
@Override // androidx.core.app.ComponentActivity, android.app.Activity
|
|
public void onCreate(Bundle bundle) {
|
|
this.mSavedStateRegistryController.performRestore(bundle);
|
|
this.mContextAwareHelper.dispatchOnContextAvailable(this);
|
|
super.onCreate(bundle);
|
|
ReportFragment.injectIfNeededIn(this);
|
|
int i = this.mContentLayoutId;
|
|
if (i != 0) {
|
|
setContentView(i);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
@Override // androidx.core.app.ComponentActivity, android.app.Activity
|
|
public void onSaveInstanceState(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
|
|
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;
|
|
}
|
|
|
|
@Deprecated
|
|
public Object getLastCustomNonConfigurationInstance() {
|
|
NonConfigurationInstances nonConfigurationInstances = (NonConfigurationInstances) getLastNonConfigurationInstance();
|
|
if (nonConfigurationInstances != null) {
|
|
return nonConfigurationInstances.custom;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void setContentView(int i) {
|
|
initializeViewTreeOwners();
|
|
this.mReportFullyDrawnExecutor.viewCreated(getWindow().getDecorView());
|
|
super.setContentView(i);
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void setContentView(View view) {
|
|
initializeViewTreeOwners();
|
|
this.mReportFullyDrawnExecutor.viewCreated(getWindow().getDecorView());
|
|
super.setContentView(view);
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void setContentView(View view, ViewGroup.LayoutParams layoutParams) {
|
|
initializeViewTreeOwners();
|
|
this.mReportFullyDrawnExecutor.viewCreated(getWindow().getDecorView());
|
|
super.setContentView(view, layoutParams);
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void addContentView(View view, ViewGroup.LayoutParams layoutParams) {
|
|
initializeViewTreeOwners();
|
|
this.mReportFullyDrawnExecutor.viewCreated(getWindow().getDecorView());
|
|
super.addContentView(view, layoutParams);
|
|
}
|
|
|
|
public void initializeViewTreeOwners() {
|
|
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
|
|
public Context peekAvailableContext() {
|
|
return this.mContextAwareHelper.getContext();
|
|
}
|
|
|
|
@Override // androidx.activity.contextaware.ContextAware
|
|
public final void addOnContextAvailableListener(OnContextAvailableListener onContextAvailableListener) {
|
|
this.mContextAwareHelper.addOnContextAvailableListener(onContextAvailableListener);
|
|
}
|
|
|
|
@Override // androidx.activity.contextaware.ContextAware
|
|
public final void removeOnContextAvailableListener(OnContextAvailableListener onContextAvailableListener) {
|
|
this.mContextAwareHelper.removeOnContextAvailableListener(onContextAvailableListener);
|
|
}
|
|
|
|
@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.onPrepareMenu(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.onCreateMenu(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.onMenuItemSelected(menuItem);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override // android.app.Activity, android.view.Window.Callback
|
|
public void onPanelClosed(int i, Menu menu) {
|
|
this.mMenuHostHelper.onMenuClosed(menu);
|
|
super.onPanelClosed(i, menu);
|
|
}
|
|
|
|
@Override // androidx.core.view.MenuHost
|
|
public void addMenuProvider(MenuProvider menuProvider) {
|
|
this.mMenuHostHelper.addMenuProvider(menuProvider);
|
|
}
|
|
|
|
@Override // androidx.core.view.MenuHost
|
|
public void addMenuProvider(MenuProvider menuProvider, LifecycleOwner lifecycleOwner) {
|
|
this.mMenuHostHelper.addMenuProvider(menuProvider, lifecycleOwner);
|
|
}
|
|
|
|
@Override // androidx.core.view.MenuHost
|
|
public void addMenuProvider(MenuProvider menuProvider, LifecycleOwner lifecycleOwner, Lifecycle.State state) {
|
|
this.mMenuHostHelper.addMenuProvider(menuProvider, lifecycleOwner, state);
|
|
}
|
|
|
|
@Override // androidx.core.view.MenuHost
|
|
public void removeMenuProvider(MenuProvider menuProvider) {
|
|
this.mMenuHostHelper.removeMenuProvider(menuProvider);
|
|
}
|
|
|
|
@Override // androidx.core.view.MenuHost
|
|
public void invalidateMenu() {
|
|
invalidateOptionsMenu();
|
|
}
|
|
|
|
@Override // androidx.lifecycle.ViewModelStoreOwner
|
|
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;
|
|
}
|
|
|
|
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
|
|
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
|
|
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
|
|
@Deprecated
|
|
public void onBackPressed() {
|
|
getOnBackPressedDispatcher().onBackPressed();
|
|
}
|
|
|
|
@Override // androidx.activity.OnBackPressedDispatcherOwner
|
|
public final OnBackPressedDispatcher getOnBackPressedDispatcher() {
|
|
if (this.mOnBackPressedDispatcher == null) {
|
|
this.mOnBackPressedDispatcher = new OnBackPressedDispatcher(new Runnable() { // from class: androidx.activity.ComponentActivity.5
|
|
@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;
|
|
}
|
|
} catch (NullPointerException e2) {
|
|
if (!TextUtils.equals(e2.getMessage(), "Attempt to invoke virtual method 'android.os.Handler android.app.FragmentHostCallback.getHandler()' on a null object reference")) {
|
|
throw e2;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
getLifecycle().addObserver(new LifecycleEventObserver() { // from class: androidx.activity.ComponentActivity.6
|
|
@Override // androidx.lifecycle.LifecycleEventObserver
|
|
public void onStateChanged(LifecycleOwner lifecycleOwner, Lifecycle.Event event) {
|
|
if (event != Lifecycle.Event.ON_CREATE || Build.VERSION.SDK_INT < 33) {
|
|
return;
|
|
}
|
|
ComponentActivity.this.mOnBackPressedDispatcher.setOnBackInvokedDispatcher(Api33Impl.getOnBackInvokedDispatcher((ComponentActivity) lifecycleOwner));
|
|
}
|
|
});
|
|
}
|
|
return this.mOnBackPressedDispatcher;
|
|
}
|
|
|
|
@Override // androidx.savedstate.SavedStateRegistryOwner
|
|
public final SavedStateRegistry getSavedStateRegistry() {
|
|
return this.mSavedStateRegistryController.getSavedStateRegistry();
|
|
}
|
|
|
|
@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);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
@Override // android.app.Activity
|
|
@Deprecated
|
|
public void onActivityResult(int i, int i2, Intent intent) {
|
|
if (this.mActivityResultRegistry.dispatchResult(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.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
|
|
public final <I, O> ActivityResultLauncher<I> registerForActivityResult(ActivityResultContract<I, O> activityResultContract, ActivityResultRegistry activityResultRegistry, ActivityResultCallback<O> activityResultCallback) {
|
|
return activityResultRegistry.register("activity_rq#" + this.mNextLocalRequestCode.getAndIncrement(), this, activityResultContract, activityResultCallback);
|
|
}
|
|
|
|
@Override // androidx.activity.result.ActivityResultCaller
|
|
public final <I, O> ActivityResultLauncher<I> registerForActivityResult(ActivityResultContract<I, O> activityResultContract, ActivityResultCallback<O> activityResultCallback) {
|
|
return registerForActivityResult(activityResultContract, this.mActivityResultRegistry, activityResultCallback);
|
|
}
|
|
|
|
@Override // android.app.Activity, android.content.ComponentCallbacks
|
|
public void onConfigurationChanged(Configuration configuration) {
|
|
super.onConfigurationChanged(configuration);
|
|
Iterator<Consumer<Configuration>> it = this.mOnConfigurationChangedListeners.iterator();
|
|
while (it.hasNext()) {
|
|
it.next().accept(configuration);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.core.content.OnConfigurationChangedProvider
|
|
public final void addOnConfigurationChangedListener(Consumer<Configuration> consumer) {
|
|
this.mOnConfigurationChangedListeners.add(consumer);
|
|
}
|
|
|
|
@Override // androidx.core.content.OnConfigurationChangedProvider
|
|
public final void removeOnConfigurationChangedListener(Consumer<Configuration> consumer) {
|
|
this.mOnConfigurationChangedListeners.remove(consumer);
|
|
}
|
|
|
|
@Override // android.app.Activity, android.content.ComponentCallbacks2
|
|
public void onTrimMemory(int i) {
|
|
super.onTrimMemory(i);
|
|
Iterator<Consumer<Integer>> it = this.mOnTrimMemoryListeners.iterator();
|
|
while (it.hasNext()) {
|
|
it.next().accept(Integer.valueOf(i));
|
|
}
|
|
}
|
|
|
|
@Override // androidx.core.content.OnTrimMemoryProvider
|
|
public final void addOnTrimMemoryListener(Consumer<Integer> consumer) {
|
|
this.mOnTrimMemoryListeners.add(consumer);
|
|
}
|
|
|
|
@Override // androidx.core.content.OnTrimMemoryProvider
|
|
public final void removeOnTrimMemoryListener(Consumer<Integer> consumer) {
|
|
this.mOnTrimMemoryListeners.remove(consumer);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
@Override // android.app.Activity
|
|
public void onNewIntent(Intent intent) {
|
|
super.onNewIntent(intent);
|
|
Iterator<Consumer<Intent>> it = this.mOnNewIntentListeners.iterator();
|
|
while (it.hasNext()) {
|
|
it.next().accept(intent);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.core.app.OnNewIntentProvider
|
|
public final void addOnNewIntentListener(Consumer<Intent> consumer) {
|
|
this.mOnNewIntentListeners.add(consumer);
|
|
}
|
|
|
|
@Override // androidx.core.app.OnNewIntentProvider
|
|
public final void removeOnNewIntentListener(Consumer<Intent> consumer) {
|
|
this.mOnNewIntentListeners.remove(consumer);
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void onMultiWindowModeChanged(boolean z) {
|
|
if (this.mDispatchingOnMultiWindowModeChanged) {
|
|
return;
|
|
}
|
|
Iterator<Consumer<MultiWindowModeChangedInfo>> it = this.mOnMultiWindowModeChangedListeners.iterator();
|
|
while (it.hasNext()) {
|
|
it.next().accept(new MultiWindowModeChangedInfo(z));
|
|
}
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void onMultiWindowModeChanged(boolean z, Configuration configuration) {
|
|
this.mDispatchingOnMultiWindowModeChanged = true;
|
|
try {
|
|
super.onMultiWindowModeChanged(z, configuration);
|
|
this.mDispatchingOnMultiWindowModeChanged = false;
|
|
Iterator<Consumer<MultiWindowModeChangedInfo>> 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(Consumer<MultiWindowModeChangedInfo> consumer) {
|
|
this.mOnMultiWindowModeChangedListeners.add(consumer);
|
|
}
|
|
|
|
@Override // androidx.core.app.OnMultiWindowModeChangedProvider
|
|
public final void removeOnMultiWindowModeChangedListener(Consumer<MultiWindowModeChangedInfo> consumer) {
|
|
this.mOnMultiWindowModeChangedListeners.remove(consumer);
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void onPictureInPictureModeChanged(boolean z) {
|
|
if (this.mDispatchingOnPictureInPictureModeChanged) {
|
|
return;
|
|
}
|
|
Iterator<Consumer<PictureInPictureModeChangedInfo>> it = this.mOnPictureInPictureModeChangedListeners.iterator();
|
|
while (it.hasNext()) {
|
|
it.next().accept(new PictureInPictureModeChangedInfo(z));
|
|
}
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void onPictureInPictureModeChanged(boolean z, Configuration configuration) {
|
|
this.mDispatchingOnPictureInPictureModeChanged = true;
|
|
try {
|
|
super.onPictureInPictureModeChanged(z, configuration);
|
|
this.mDispatchingOnPictureInPictureModeChanged = false;
|
|
Iterator<Consumer<PictureInPictureModeChangedInfo>> 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(Consumer<PictureInPictureModeChangedInfo> consumer) {
|
|
this.mOnPictureInPictureModeChangedListeners.add(consumer);
|
|
}
|
|
|
|
@Override // androidx.core.app.OnPictureInPictureModeChangedProvider
|
|
public final void removeOnPictureInPictureModeChangedListener(Consumer<PictureInPictureModeChangedInfo> 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();
|
|
} finally {
|
|
Trace.endSection();
|
|
}
|
|
}
|
|
|
|
private ReportFullyDrawnExecutor createFullyDrawnExecutor() {
|
|
return new ReportFullyDrawnExecutorApi16Impl();
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
static class Api19Impl {
|
|
private Api19Impl() {
|
|
}
|
|
|
|
static void cancelPendingInputEvents(View view) {
|
|
view.cancelPendingInputEvents();
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
static class Api33Impl {
|
|
private Api33Impl() {
|
|
}
|
|
|
|
static OnBackInvokedDispatcher getOnBackInvokedDispatcher(Activity activity) {
|
|
return activity.getOnBackInvokedDispatcher();
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
static class ReportFullyDrawnExecutorApi1 implements ReportFullyDrawnExecutor {
|
|
final Handler mHandler = createHandler();
|
|
|
|
@Override // androidx.activity.ComponentActivity.ReportFullyDrawnExecutor
|
|
public void activityDestroyed() {
|
|
}
|
|
|
|
@Override // androidx.activity.ComponentActivity.ReportFullyDrawnExecutor
|
|
public void viewCreated(View view) {
|
|
}
|
|
|
|
ReportFullyDrawnExecutorApi1() {
|
|
}
|
|
|
|
@Override // java.util.concurrent.Executor
|
|
public void execute(Runnable runnable) {
|
|
this.mHandler.postAtFrontOfQueue(runnable);
|
|
}
|
|
|
|
private Handler createHandler() {
|
|
Looper myLooper = Looper.myLooper();
|
|
if (myLooper == null) {
|
|
myLooper = Looper.getMainLooper();
|
|
}
|
|
return new Handler(myLooper);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes.dex */
|
|
public class ReportFullyDrawnExecutorApi16Impl implements ReportFullyDrawnExecutor, ViewTreeObserver.OnDrawListener, Runnable {
|
|
final long mEndWatchTimeMillis = SystemClock.uptimeMillis() + WorkRequest.MIN_BACKOFF_MILLIS;
|
|
boolean mOnDrawScheduled = false;
|
|
Runnable mRunnable;
|
|
|
|
ReportFullyDrawnExecutorApi16Impl() {
|
|
}
|
|
|
|
@Override // androidx.activity.ComponentActivity.ReportFullyDrawnExecutor
|
|
public void viewCreated(View view) {
|
|
if (this.mOnDrawScheduled) {
|
|
return;
|
|
}
|
|
this.mOnDrawScheduled = true;
|
|
view.getViewTreeObserver().addOnDrawListener(this);
|
|
}
|
|
|
|
@Override // androidx.activity.ComponentActivity.ReportFullyDrawnExecutor
|
|
public void activityDestroyed() {
|
|
ComponentActivity.this.getWindow().getDecorView().removeCallbacks(this);
|
|
ComponentActivity.this.getWindow().getDecorView().getViewTreeObserver().removeOnDrawListener(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.m10x96b76666();
|
|
}
|
|
});
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* renamed from: lambda$execute$0$androidx-activity-ComponentActivity$ReportFullyDrawnExecutorApi16Impl, reason: not valid java name */
|
|
public /* synthetic */ void m10x96b76666() {
|
|
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);
|
|
}
|
|
}
|
|
}
|