Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,91 @@
package androidx.lifecycle;
import android.os.Bundle;
import androidx.annotation.RestrictTo;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.viewmodel.CreationExtras;
import androidx.savedstate.SavedStateRegistry;
import androidx.savedstate.SavedStateRegistryOwner;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public abstract class AbstractSavedStateViewModelFactory extends ViewModelProvider.OnRequeryFactory implements ViewModelProvider.Factory {
public static final Companion Companion = new Companion(null);
public static final String TAG_SAVED_STATE_HANDLE_CONTROLLER = "androidx.lifecycle.savedstate.vm.tag";
private Bundle defaultArgs;
private Lifecycle lifecycle;
private SavedStateRegistry savedStateRegistry;
public abstract <T extends ViewModel> T create(String str, Class<T> cls, SavedStateHandle savedStateHandle);
public AbstractSavedStateViewModelFactory() {
}
public AbstractSavedStateViewModelFactory(SavedStateRegistryOwner owner, Bundle bundle) {
Intrinsics.checkNotNullParameter(owner, "owner");
this.savedStateRegistry = owner.getSavedStateRegistry();
this.lifecycle = owner.getLifecycle();
this.defaultArgs = bundle;
}
@Override // androidx.lifecycle.ViewModelProvider.Factory
public <T extends ViewModel> T create(Class<T> modelClass, CreationExtras extras) {
Intrinsics.checkNotNullParameter(modelClass, "modelClass");
Intrinsics.checkNotNullParameter(extras, "extras");
String str = (String) extras.get(ViewModelProvider.NewInstanceFactory.VIEW_MODEL_KEY);
if (str == null) {
throw new IllegalStateException("VIEW_MODEL_KEY must always be provided by ViewModelProvider");
}
if (this.savedStateRegistry != null) {
return (T) create(str, modelClass);
}
return (T) create(str, modelClass, SavedStateHandleSupport.createSavedStateHandle(extras));
}
private final <T extends ViewModel> T create(String str, Class<T> cls) {
SavedStateRegistry savedStateRegistry = this.savedStateRegistry;
Intrinsics.checkNotNull(savedStateRegistry);
Lifecycle lifecycle = this.lifecycle;
Intrinsics.checkNotNull(lifecycle);
SavedStateHandleController create = LegacySavedStateHandleController.create(savedStateRegistry, lifecycle, str, this.defaultArgs);
T t = (T) create(str, cls, create.getHandle());
t.setTagIfAbsent("androidx.lifecycle.savedstate.vm.tag", create);
return t;
}
@Override // androidx.lifecycle.ViewModelProvider.Factory
public <T extends ViewModel> T create(Class<T> modelClass) {
Intrinsics.checkNotNullParameter(modelClass, "modelClass");
String canonicalName = modelClass.getCanonicalName();
if (canonicalName == null) {
throw new IllegalArgumentException("Local and anonymous classes can not be ViewModels");
}
if (this.lifecycle == null) {
throw new UnsupportedOperationException("AbstractSavedStateViewModelFactory constructed with empty constructor supports only calls to create(modelClass: Class<T>, extras: CreationExtras).");
}
return (T) create(canonicalName, modelClass);
}
@Override // androidx.lifecycle.ViewModelProvider.OnRequeryFactory
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public void onRequery(ViewModel viewModel) {
Intrinsics.checkNotNullParameter(viewModel, "viewModel");
SavedStateRegistry savedStateRegistry = this.savedStateRegistry;
if (savedStateRegistry != null) {
Intrinsics.checkNotNull(savedStateRegistry);
Lifecycle lifecycle = this.lifecycle;
Intrinsics.checkNotNull(lifecycle);
LegacySavedStateHandleController.attachHandleIfNeeded(viewModel, savedStateRegistry, lifecycle);
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
}

View File

@@ -0,0 +1,20 @@
package androidx.lifecycle;
import android.app.Application;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public class AndroidViewModel extends ViewModel {
private final Application application;
public AndroidViewModel(Application application) {
Intrinsics.checkNotNullParameter(application, "application");
this.application = application;
}
public <T extends Application> T getApplication() {
T t = (T) this.application;
Intrinsics.checkNotNull(t, "null cannot be cast to non-null type T of androidx.lifecycle.AndroidViewModel.getApplication");
return t;
}
}

View File

@@ -0,0 +1,193 @@
package androidx.lifecycle;
import androidx.annotation.Nullable;
import androidx.lifecycle.Lifecycle;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Deprecated
/* loaded from: classes.dex */
final class ClassesInfoCache {
private static final int CALL_TYPE_NO_ARG = 0;
private static final int CALL_TYPE_PROVIDER = 1;
private static final int CALL_TYPE_PROVIDER_WITH_EVENT = 2;
static ClassesInfoCache sInstance = new ClassesInfoCache();
private final Map<Class<?>, CallbackInfo> mCallbackMap = new HashMap();
private final Map<Class<?>, Boolean> mHasLifecycleMethods = new HashMap();
public boolean hasLifecycleMethods(Class<?> cls) {
Boolean bool = this.mHasLifecycleMethods.get(cls);
if (bool != null) {
return bool.booleanValue();
}
Method[] declaredMethods = getDeclaredMethods(cls);
for (Method method : declaredMethods) {
if (((OnLifecycleEvent) method.getAnnotation(OnLifecycleEvent.class)) != null) {
createInfo(cls, declaredMethods);
return true;
}
}
this.mHasLifecycleMethods.put(cls, Boolean.FALSE);
return false;
}
private Method[] getDeclaredMethods(Class<?> cls) {
try {
return cls.getDeclaredMethods();
} catch (NoClassDefFoundError e) {
throw new IllegalArgumentException("The observer class has some methods that use newer APIs which are not available in the current OS version. Lifecycles cannot access even other methods so you should make sure that your observer classes only access framework classes that are available in your min API level OR use lifecycle:compiler annotation processor.", e);
}
}
public CallbackInfo getInfo(Class<?> cls) {
CallbackInfo callbackInfo = this.mCallbackMap.get(cls);
return callbackInfo != null ? callbackInfo : createInfo(cls, null);
}
private void verifyAndPutHandler(Map<MethodReference, Lifecycle.Event> map, MethodReference methodReference, Lifecycle.Event event, Class<?> cls) {
Lifecycle.Event event2 = map.get(methodReference);
if (event2 == null || event == event2) {
if (event2 == null) {
map.put(methodReference, event);
return;
}
return;
}
throw new IllegalArgumentException("Method " + methodReference.mMethod.getName() + " in " + cls.getName() + " already declared with different @OnLifecycleEvent value: previous value " + event2 + ", new value " + event);
}
private CallbackInfo createInfo(Class<?> cls, @Nullable Method[] methodArr) {
int i;
CallbackInfo info;
Class<? super Object> superclass = cls.getSuperclass();
HashMap hashMap = new HashMap();
if (superclass != null && (info = getInfo(superclass)) != null) {
hashMap.putAll(info.mHandlerToEvent);
}
for (Class<?> cls2 : cls.getInterfaces()) {
for (Map.Entry<MethodReference, Lifecycle.Event> entry : getInfo(cls2).mHandlerToEvent.entrySet()) {
verifyAndPutHandler(hashMap, entry.getKey(), entry.getValue(), cls);
}
}
if (methodArr == null) {
methodArr = getDeclaredMethods(cls);
}
boolean z = false;
for (Method method : methodArr) {
OnLifecycleEvent onLifecycleEvent = (OnLifecycleEvent) method.getAnnotation(OnLifecycleEvent.class);
if (onLifecycleEvent != null) {
Class<?>[] parameterTypes = method.getParameterTypes();
if (parameterTypes.length <= 0) {
i = 0;
} else {
if (!LifecycleOwner.class.isAssignableFrom(parameterTypes[0])) {
throw new IllegalArgumentException("invalid parameter type. Must be one and instanceof LifecycleOwner");
}
i = 1;
}
Lifecycle.Event value = onLifecycleEvent.value();
if (parameterTypes.length > 1) {
if (!Lifecycle.Event.class.isAssignableFrom(parameterTypes[1])) {
throw new IllegalArgumentException("invalid parameter type. second arg must be an event");
}
if (value != Lifecycle.Event.ON_ANY) {
throw new IllegalArgumentException("Second arg is supported only for ON_ANY value");
}
i = 2;
}
if (parameterTypes.length > 2) {
throw new IllegalArgumentException("cannot have more than 2 params");
}
verifyAndPutHandler(hashMap, new MethodReference(i, method), value, cls);
z = true;
}
}
CallbackInfo callbackInfo = new CallbackInfo(hashMap);
this.mCallbackMap.put(cls, callbackInfo);
this.mHasLifecycleMethods.put(cls, Boolean.valueOf(z));
return callbackInfo;
}
@Deprecated
public static class CallbackInfo {
final Map<Lifecycle.Event, List<MethodReference>> mEventToHandlers = new HashMap();
final Map<MethodReference, Lifecycle.Event> mHandlerToEvent;
public CallbackInfo(Map<MethodReference, Lifecycle.Event> map) {
this.mHandlerToEvent = map;
for (Map.Entry<MethodReference, Lifecycle.Event> entry : map.entrySet()) {
Lifecycle.Event value = entry.getValue();
List<MethodReference> list = this.mEventToHandlers.get(value);
if (list == null) {
list = new ArrayList<>();
this.mEventToHandlers.put(value, list);
}
list.add(entry.getKey());
}
}
public void invokeCallbacks(LifecycleOwner lifecycleOwner, Lifecycle.Event event, Object obj) {
invokeMethodsForEvent(this.mEventToHandlers.get(event), lifecycleOwner, event, obj);
invokeMethodsForEvent(this.mEventToHandlers.get(Lifecycle.Event.ON_ANY), lifecycleOwner, event, obj);
}
private static void invokeMethodsForEvent(List<MethodReference> list, LifecycleOwner lifecycleOwner, Lifecycle.Event event, Object obj) {
if (list != null) {
for (int size = list.size() - 1; size >= 0; size--) {
list.get(size).invokeCallback(lifecycleOwner, event, obj);
}
}
}
}
@Deprecated
public static final class MethodReference {
final int mCallType;
final Method mMethod;
public MethodReference(int i, Method method) {
this.mCallType = i;
this.mMethod = method;
method.setAccessible(true);
}
public void invokeCallback(LifecycleOwner lifecycleOwner, Lifecycle.Event event, Object obj) {
try {
int i = this.mCallType;
if (i == 0) {
this.mMethod.invoke(obj, new Object[0]);
} else if (i == 1) {
this.mMethod.invoke(obj, lifecycleOwner);
} else {
if (i != 2) {
return;
}
this.mMethod.invoke(obj, lifecycleOwner, event);
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e2) {
throw new RuntimeException("Failed to call observer method", e2.getCause());
}
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof MethodReference)) {
return false;
}
MethodReference methodReference = (MethodReference) obj;
return this.mCallType == methodReference.mCallType && this.mMethod.getName().equals(methodReference.mMethod.getName());
}
public int hashCode() {
return (this.mCallType * 31) + this.mMethod.getName().hashCode();
}
}
}

View File

@@ -0,0 +1,27 @@
package androidx.lifecycle;
import androidx.lifecycle.Lifecycle;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public final class CompositeGeneratedAdaptersObserver implements LifecycleEventObserver {
private final GeneratedAdapter[] generatedAdapters;
public CompositeGeneratedAdaptersObserver(GeneratedAdapter[] generatedAdapters) {
Intrinsics.checkNotNullParameter(generatedAdapters, "generatedAdapters");
this.generatedAdapters = generatedAdapters;
}
@Override // androidx.lifecycle.LifecycleEventObserver
public void onStateChanged(LifecycleOwner source, Lifecycle.Event event) {
Intrinsics.checkNotNullParameter(source, "source");
Intrinsics.checkNotNullParameter(event, "event");
MethodCallsLogger methodCallsLogger = new MethodCallsLogger();
for (GeneratedAdapter generatedAdapter : this.generatedAdapters) {
generatedAdapter.callMethods(source, event, false, methodCallsLogger);
}
for (GeneratedAdapter generatedAdapter2 : this.generatedAdapters) {
generatedAdapter2.callMethods(source, event, true, methodCallsLogger);
}
}
}

View File

@@ -0,0 +1,145 @@
package androidx.lifecycle;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import androidx.annotation.WorkerThread;
import androidx.arch.core.executor.ArchTaskExecutor;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public abstract class ComputableLiveData<T> {
private final LiveData<T> _liveData;
private final AtomicBoolean computing;
private final Executor executor;
private final AtomicBoolean invalid;
public final Runnable invalidationRunnable;
private final LiveData<T> liveData;
public final Runnable refreshRunnable;
/* JADX WARN: Multi-variable type inference failed */
public ComputableLiveData() {
this(null, 1, 0 == true ? 1 : 0);
}
@VisibleForTesting
public static /* synthetic */ void getInvalidationRunnable$lifecycle_livedata_release$annotations() {
}
@VisibleForTesting
public static /* synthetic */ void getRefreshRunnable$lifecycle_livedata_release$annotations() {
}
@WorkerThread
public abstract T compute();
public final AtomicBoolean getComputing$lifecycle_livedata_release() {
return this.computing;
}
public final Executor getExecutor$lifecycle_livedata_release() {
return this.executor;
}
public final AtomicBoolean getInvalid$lifecycle_livedata_release() {
return this.invalid;
}
public LiveData<T> getLiveData() {
return this.liveData;
}
public ComputableLiveData(Executor executor) {
Intrinsics.checkNotNullParameter(executor, "executor");
this.executor = executor;
LiveData<T> liveData = new LiveData<T>(this) { // from class: androidx.lifecycle.ComputableLiveData$_liveData$1
final /* synthetic */ ComputableLiveData<T> this$0;
{
this.this$0 = this;
}
@Override // androidx.lifecycle.LiveData
public void onActive() {
this.this$0.getExecutor$lifecycle_livedata_release().execute(this.this$0.refreshRunnable);
}
};
this._liveData = liveData;
this.liveData = liveData;
this.invalid = new AtomicBoolean(true);
this.computing = new AtomicBoolean(false);
this.refreshRunnable = new Runnable() { // from class: androidx.lifecycle.ComputableLiveData$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
ComputableLiveData.refreshRunnable$lambda$0(ComputableLiveData.this);
}
};
this.invalidationRunnable = new Runnable() { // from class: androidx.lifecycle.ComputableLiveData$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
ComputableLiveData.invalidationRunnable$lambda$1(ComputableLiveData.this);
}
};
}
/* JADX WARN: Illegal instructions before constructor call */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public /* synthetic */ ComputableLiveData(java.util.concurrent.Executor r1, int r2, kotlin.jvm.internal.DefaultConstructorMarker r3) {
/*
r0 = this;
r2 = r2 & 1
if (r2 == 0) goto Ld
java.util.concurrent.Executor r1 = androidx.arch.core.executor.ArchTaskExecutor.getIOThreadExecutor()
java.lang.String r2 = "getIOThreadExecutor()"
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r1, r2)
Ld:
r0.<init>(r1)
return
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.lifecycle.ComputableLiveData.<init>(java.util.concurrent.Executor, int, kotlin.jvm.internal.DefaultConstructorMarker):void");
}
/* JADX INFO: Access modifiers changed from: private */
/* JADX WARN: Multi-variable type inference failed */
public static final void refreshRunnable$lambda$0(ComputableLiveData this$0) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
while (this$0.computing.compareAndSet(false, true)) {
Object obj = null;
boolean z = false;
while (this$0.invalid.compareAndSet(true, false)) {
try {
obj = this$0.compute();
z = true;
} catch (Throwable th) {
this$0.computing.set(false);
throw th;
}
}
if (z) {
this$0.getLiveData().postValue(obj);
}
this$0.computing.set(false);
if (!z || !this$0.invalid.get()) {
return;
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public static final void invalidationRunnable$lambda$1(ComputableLiveData this$0) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
boolean hasActiveObservers = this$0.getLiveData().hasActiveObservers();
if (this$0.invalid.compareAndSet(false, true) && hasActiveObservers) {
this$0.executor.execute(this$0.refreshRunnable);
}
}
public void invalidate() {
ArchTaskExecutor.getInstance().executeOnMainThread(this.invalidationRunnable);
}
}

View File

@@ -0,0 +1,30 @@
package androidx.lifecycle;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public interface DefaultLifecycleObserver extends LifecycleObserver {
default void onCreate(LifecycleOwner owner) {
Intrinsics.checkNotNullParameter(owner, "owner");
}
default void onDestroy(LifecycleOwner owner) {
Intrinsics.checkNotNullParameter(owner, "owner");
}
default void onPause(LifecycleOwner owner) {
Intrinsics.checkNotNullParameter(owner, "owner");
}
default void onResume(LifecycleOwner owner) {
Intrinsics.checkNotNullParameter(owner, "owner");
}
default void onStart(LifecycleOwner owner) {
Intrinsics.checkNotNullParameter(owner, "owner");
}
default void onStop(LifecycleOwner owner) {
Intrinsics.checkNotNullParameter(owner, "owner");
}
}

View File

@@ -0,0 +1,85 @@
package androidx.lifecycle;
import androidx.lifecycle.Lifecycle;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public final class DefaultLifecycleObserverAdapter implements LifecycleEventObserver {
private final DefaultLifecycleObserver defaultLifecycleObserver;
private final LifecycleEventObserver lifecycleEventObserver;
public /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
static {
int[] iArr = new int[Lifecycle.Event.values().length];
try {
iArr[Lifecycle.Event.ON_CREATE.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
iArr[Lifecycle.Event.ON_START.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
iArr[Lifecycle.Event.ON_RESUME.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
iArr[Lifecycle.Event.ON_PAUSE.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
iArr[Lifecycle.Event.ON_STOP.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
iArr[Lifecycle.Event.ON_DESTROY.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
iArr[Lifecycle.Event.ON_ANY.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
$EnumSwitchMapping$0 = iArr;
}
}
public DefaultLifecycleObserverAdapter(DefaultLifecycleObserver defaultLifecycleObserver, LifecycleEventObserver lifecycleEventObserver) {
Intrinsics.checkNotNullParameter(defaultLifecycleObserver, "defaultLifecycleObserver");
this.defaultLifecycleObserver = defaultLifecycleObserver;
this.lifecycleEventObserver = lifecycleEventObserver;
}
@Override // androidx.lifecycle.LifecycleEventObserver
public void onStateChanged(LifecycleOwner source, Lifecycle.Event event) {
Intrinsics.checkNotNullParameter(source, "source");
Intrinsics.checkNotNullParameter(event, "event");
switch (WhenMappings.$EnumSwitchMapping$0[event.ordinal()]) {
case 1:
this.defaultLifecycleObserver.onCreate(source);
break;
case 2:
this.defaultLifecycleObserver.onStart(source);
break;
case 3:
this.defaultLifecycleObserver.onResume(source);
break;
case 4:
this.defaultLifecycleObserver.onPause(source);
break;
case 5:
this.defaultLifecycleObserver.onStop(source);
break;
case 6:
this.defaultLifecycleObserver.onDestroy(source);
break;
case 7:
throw new IllegalArgumentException("ON_ANY must not been send by anybody");
}
LifecycleEventObserver lifecycleEventObserver = this.lifecycleEventObserver;
if (lifecycleEventObserver != null) {
lifecycleEventObserver.onStateChanged(source, event);
}
}
}

View File

@@ -0,0 +1,95 @@
package androidx.lifecycle;
import androidx.annotation.AnyThread;
import androidx.annotation.MainThread;
import java.util.ArrayDeque;
import java.util.Queue;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.Dispatchers;
import kotlinx.coroutines.MainCoroutineDispatcher;
/* loaded from: classes.dex */
public final class DispatchQueue {
private boolean finished;
private boolean isDraining;
private boolean paused = true;
private final Queue<Runnable> queue = new ArrayDeque();
@MainThread
public final boolean canRun() {
return this.finished || !this.paused;
}
@MainThread
public final void pause() {
this.paused = true;
}
@MainThread
public final void resume() {
if (this.paused) {
if (!(!this.finished)) {
throw new IllegalStateException("Cannot resume a finished dispatcher".toString());
}
this.paused = false;
drainQueue();
}
}
@MainThread
public final void finish() {
this.finished = true;
drainQueue();
}
@MainThread
public final void drainQueue() {
if (this.isDraining) {
return;
}
try {
this.isDraining = true;
while ((!this.queue.isEmpty()) && canRun()) {
Runnable poll = this.queue.poll();
if (poll != null) {
poll.run();
}
}
} finally {
this.isDraining = false;
}
}
@AnyThread
public final void dispatchAndEnqueue(CoroutineContext context, final Runnable runnable) {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(runnable, "runnable");
MainCoroutineDispatcher immediate = Dispatchers.getMain().getImmediate();
if (immediate.isDispatchNeeded(context) || canRun()) {
immediate.mo4148dispatch(context, new Runnable() { // from class: androidx.lifecycle.DispatchQueue$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
DispatchQueue.dispatchAndEnqueue$lambda$2$lambda$1(DispatchQueue.this, runnable);
}
});
} else {
enqueue(runnable);
}
}
/* JADX INFO: Access modifiers changed from: private */
public static final void dispatchAndEnqueue$lambda$2$lambda$1(DispatchQueue this$0, Runnable runnable) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(runnable, "$runnable");
this$0.enqueue(runnable);
}
@MainThread
private final void enqueue(Runnable runnable) {
if (!this.queue.offer(runnable)) {
throw new IllegalStateException("cannot enqueue any more runnables".toString());
}
drainQueue();
}
}

View File

@@ -0,0 +1,45 @@
package androidx.lifecycle;
import android.app.Activity;
import android.app.Application;
import android.os.Bundle;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public class EmptyActivityLifecycleCallbacks implements Application.ActivityLifecycleCallbacks {
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityCreated(Activity activity, Bundle bundle) {
Intrinsics.checkNotNullParameter(activity, "activity");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityDestroyed(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityPaused(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityResumed(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
Intrinsics.checkNotNullParameter(activity, "activity");
Intrinsics.checkNotNullParameter(outState, "outState");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityStarted(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityStopped(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
}
}

View File

@@ -0,0 +1,10 @@
package androidx.lifecycle;
import androidx.annotation.RestrictTo;
import androidx.lifecycle.Lifecycle;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public interface GeneratedAdapter {
void callMethods(LifecycleOwner lifecycleOwner, Lifecycle.Event event, boolean z, MethodCallsLogger methodCallsLogger);
}

View File

@@ -0,0 +1,9 @@
package androidx.lifecycle;
import androidx.annotation.RestrictTo;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
@Deprecated
/* loaded from: classes.dex */
public interface GenericLifecycleObserver extends LifecycleEventObserver {
}

View File

@@ -0,0 +1,13 @@
package androidx.lifecycle;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.viewmodel.CreationExtras;
/* loaded from: classes.dex */
public interface HasDefaultViewModelProviderFactory {
ViewModelProvider.Factory getDefaultViewModelProviderFactory();
default CreationExtras getDefaultViewModelCreationExtras() {
return CreationExtras.Empty.INSTANCE;
}
}

View File

@@ -0,0 +1,80 @@
package androidx.lifecycle;
import android.os.Bundle;
import androidx.lifecycle.LegacySavedStateHandleController;
import androidx.lifecycle.Lifecycle;
import androidx.savedstate.SavedStateRegistry;
import androidx.savedstate.SavedStateRegistryOwner;
import java.util.Iterator;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public final class LegacySavedStateHandleController {
public static final LegacySavedStateHandleController INSTANCE = new LegacySavedStateHandleController();
public static final String TAG_SAVED_STATE_HANDLE_CONTROLLER = "androidx.lifecycle.savedstate.vm.tag";
private LegacySavedStateHandleController() {
}
public static final SavedStateHandleController create(SavedStateRegistry registry, Lifecycle lifecycle, String str, Bundle bundle) {
Intrinsics.checkNotNullParameter(registry, "registry");
Intrinsics.checkNotNullParameter(lifecycle, "lifecycle");
Intrinsics.checkNotNull(str);
SavedStateHandleController savedStateHandleController = new SavedStateHandleController(str, SavedStateHandle.Companion.createHandle(registry.consumeRestoredStateForKey(str), bundle));
savedStateHandleController.attachToLifecycle(registry, lifecycle);
INSTANCE.tryToAddRecreator(registry, lifecycle);
return savedStateHandleController;
}
public static final void attachHandleIfNeeded(ViewModel viewModel, SavedStateRegistry registry, Lifecycle lifecycle) {
Intrinsics.checkNotNullParameter(viewModel, "viewModel");
Intrinsics.checkNotNullParameter(registry, "registry");
Intrinsics.checkNotNullParameter(lifecycle, "lifecycle");
SavedStateHandleController savedStateHandleController = (SavedStateHandleController) viewModel.getTag("androidx.lifecycle.savedstate.vm.tag");
if (savedStateHandleController == null || savedStateHandleController.isAttached()) {
return;
}
savedStateHandleController.attachToLifecycle(registry, lifecycle);
INSTANCE.tryToAddRecreator(registry, lifecycle);
}
private final void tryToAddRecreator(final SavedStateRegistry savedStateRegistry, final Lifecycle lifecycle) {
Lifecycle.State currentState = lifecycle.getCurrentState();
if (currentState == Lifecycle.State.INITIALIZED || currentState.isAtLeast(Lifecycle.State.STARTED)) {
savedStateRegistry.runOnNextRecreation(OnRecreation.class);
} else {
lifecycle.addObserver(new LifecycleEventObserver() { // from class: androidx.lifecycle.LegacySavedStateHandleController$tryToAddRecreator$1
@Override // androidx.lifecycle.LifecycleEventObserver
public void onStateChanged(LifecycleOwner source, Lifecycle.Event event) {
Intrinsics.checkNotNullParameter(source, "source");
Intrinsics.checkNotNullParameter(event, "event");
if (event == Lifecycle.Event.ON_START) {
Lifecycle.this.removeObserver(this);
savedStateRegistry.runOnNextRecreation(LegacySavedStateHandleController.OnRecreation.class);
}
}
});
}
}
public static final class OnRecreation implements SavedStateRegistry.AutoRecreated {
@Override // androidx.savedstate.SavedStateRegistry.AutoRecreated
public void onRecreated(SavedStateRegistryOwner owner) {
Intrinsics.checkNotNullParameter(owner, "owner");
if (!(owner instanceof ViewModelStoreOwner)) {
throw new IllegalStateException("Internal error: OnRecreation should be registered only on components that implement ViewModelStoreOwner".toString());
}
ViewModelStore viewModelStore = ((ViewModelStoreOwner) owner).getViewModelStore();
SavedStateRegistry savedStateRegistry = owner.getSavedStateRegistry();
Iterator<String> it = viewModelStore.keys().iterator();
while (it.hasNext()) {
ViewModel viewModel = viewModelStore.get(it.next());
Intrinsics.checkNotNull(viewModel);
LegacySavedStateHandleController.attachHandleIfNeeded(viewModel, savedStateRegistry, owner.getLifecycle());
}
if (!viewModelStore.keys().isEmpty()) {
savedStateRegistry.runOnNextRecreation(OnRecreation.class);
}
}
}
}

View File

@@ -0,0 +1,226 @@
package androidx.lifecycle;
import androidx.annotation.MainThread;
import androidx.annotation.RestrictTo;
import java.util.concurrent.atomic.AtomicReference;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public abstract class Lifecycle {
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
private AtomicReference<Object> internalScopeRef = new AtomicReference<>();
@MainThread
public abstract void addObserver(LifecycleObserver lifecycleObserver);
@MainThread
public abstract State getCurrentState();
public final AtomicReference<Object> getInternalScopeRef() {
return this.internalScopeRef;
}
@MainThread
public abstract void removeObserver(LifecycleObserver lifecycleObserver);
public final void setInternalScopeRef(AtomicReference<Object> atomicReference) {
Intrinsics.checkNotNullParameter(atomicReference, "<set-?>");
this.internalScopeRef = atomicReference;
}
public enum Event {
ON_CREATE,
ON_START,
ON_RESUME,
ON_PAUSE,
ON_STOP,
ON_DESTROY,
ON_ANY;
public static final Companion Companion = new Companion(null);
public /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
static {
int[] iArr = new int[Event.values().length];
try {
iArr[Event.ON_CREATE.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
iArr[Event.ON_STOP.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
iArr[Event.ON_START.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
iArr[Event.ON_PAUSE.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
iArr[Event.ON_RESUME.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
iArr[Event.ON_DESTROY.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
iArr[Event.ON_ANY.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
$EnumSwitchMapping$0 = iArr;
}
}
public static final Event downFrom(State state) {
return Companion.downFrom(state);
}
public static final Event downTo(State state) {
return Companion.downTo(state);
}
public static final Event upFrom(State state) {
return Companion.upFrom(state);
}
public static final Event upTo(State state) {
return Companion.upTo(state);
}
public final State getTargetState() {
switch (WhenMappings.$EnumSwitchMapping$0[ordinal()]) {
case 1:
case 2:
return State.CREATED;
case 3:
case 4:
return State.STARTED;
case 5:
return State.RESUMED;
case 6:
return State.DESTROYED;
default:
throw new IllegalArgumentException(this + " has no target state");
}
}
public static final class Companion {
public /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
static {
int[] iArr = new int[State.values().length];
try {
iArr[State.CREATED.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
iArr[State.STARTED.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
iArr[State.RESUMED.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
iArr[State.DESTROYED.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
iArr[State.INITIALIZED.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
$EnumSwitchMapping$0 = iArr;
}
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final Event downFrom(State state) {
Intrinsics.checkNotNullParameter(state, "state");
int i = WhenMappings.$EnumSwitchMapping$0[state.ordinal()];
if (i == 1) {
return Event.ON_DESTROY;
}
if (i == 2) {
return Event.ON_STOP;
}
if (i != 3) {
return null;
}
return Event.ON_PAUSE;
}
public final Event downTo(State state) {
Intrinsics.checkNotNullParameter(state, "state");
int i = WhenMappings.$EnumSwitchMapping$0[state.ordinal()];
if (i == 1) {
return Event.ON_STOP;
}
if (i == 2) {
return Event.ON_PAUSE;
}
if (i != 4) {
return null;
}
return Event.ON_DESTROY;
}
public final Event upFrom(State state) {
Intrinsics.checkNotNullParameter(state, "state");
int i = WhenMappings.$EnumSwitchMapping$0[state.ordinal()];
if (i == 1) {
return Event.ON_START;
}
if (i == 2) {
return Event.ON_RESUME;
}
if (i != 5) {
return null;
}
return Event.ON_CREATE;
}
public final Event upTo(State state) {
Intrinsics.checkNotNullParameter(state, "state");
int i = WhenMappings.$EnumSwitchMapping$0[state.ordinal()];
if (i == 1) {
return Event.ON_CREATE;
}
if (i == 2) {
return Event.ON_START;
}
if (i != 3) {
return null;
}
return Event.ON_RESUME;
}
}
}
public enum State {
DESTROYED,
INITIALIZED,
CREATED,
STARTED,
RESUMED;
public final boolean isAtLeast(State state) {
Intrinsics.checkNotNullParameter(state, "state");
return compareTo(state) >= 0;
}
}
}

View File

@@ -0,0 +1,70 @@
package androidx.lifecycle;
import androidx.annotation.MainThread;
import androidx.lifecycle.Lifecycle;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlinx.coroutines.Job;
@MainThread
@SourceDebugExtension({"SMAP\nLifecycleController.kt\nKotlin\n*S Kotlin\n*F\n+ 1 LifecycleController.kt\nandroidx/lifecycle/LifecycleController\n*L\n1#1,70:1\n57#1,3:71\n57#1,3:74\n*S KotlinDebug\n*F\n+ 1 LifecycleController.kt\nandroidx/lifecycle/LifecycleController\n*L\n49#1:71,3\n36#1:74,3\n*E\n"})
/* loaded from: classes.dex */
public final class LifecycleController {
private final DispatchQueue dispatchQueue;
private final Lifecycle lifecycle;
private final Lifecycle.State minState;
private final LifecycleEventObserver observer;
public LifecycleController(Lifecycle lifecycle, Lifecycle.State minState, DispatchQueue dispatchQueue, final Job parentJob) {
Intrinsics.checkNotNullParameter(lifecycle, "lifecycle");
Intrinsics.checkNotNullParameter(minState, "minState");
Intrinsics.checkNotNullParameter(dispatchQueue, "dispatchQueue");
Intrinsics.checkNotNullParameter(parentJob, "parentJob");
this.lifecycle = lifecycle;
this.minState = minState;
this.dispatchQueue = dispatchQueue;
LifecycleEventObserver lifecycleEventObserver = new LifecycleEventObserver() { // from class: androidx.lifecycle.LifecycleController$$ExternalSyntheticLambda0
@Override // androidx.lifecycle.LifecycleEventObserver
public final void onStateChanged(LifecycleOwner lifecycleOwner, Lifecycle.Event event) {
LifecycleController.observer$lambda$0(LifecycleController.this, parentJob, lifecycleOwner, event);
}
};
this.observer = lifecycleEventObserver;
if (lifecycle.getCurrentState() != Lifecycle.State.DESTROYED) {
lifecycle.addObserver(lifecycleEventObserver);
} else {
Job.DefaultImpls.cancel$default(parentJob, null, 1, null);
finish();
}
}
/* JADX INFO: Access modifiers changed from: private */
public static final void observer$lambda$0(LifecycleController this$0, Job parentJob, LifecycleOwner source, Lifecycle.Event event) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(parentJob, "$parentJob");
Intrinsics.checkNotNullParameter(source, "source");
Intrinsics.checkNotNullParameter(event, "<anonymous parameter 1>");
if (source.getLifecycle().getCurrentState() != Lifecycle.State.DESTROYED) {
if (source.getLifecycle().getCurrentState().compareTo(this$0.minState) < 0) {
this$0.dispatchQueue.pause();
return;
} else {
this$0.dispatchQueue.resume();
return;
}
}
Job.DefaultImpls.cancel$default(parentJob, null, 1, null);
this$0.finish();
}
private final void handleDestroy(Job job) {
Job.DefaultImpls.cancel$default(job, null, 1, null);
finish();
}
@MainThread
public final void finish() {
this.lifecycle.removeObserver(this.observer);
this.dispatchQueue.finish();
}
}

View File

@@ -0,0 +1,57 @@
package androidx.lifecycle;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.CoroutineScope;
@DebugMetadata(c = "androidx.lifecycle.LifecycleCoroutineScope$launchWhenCreated$1", f = "Lifecycle.kt", l = {337}, m = "invokeSuspend")
/* loaded from: classes.dex */
public final class LifecycleCoroutineScope$launchWhenCreated$1 extends SuspendLambda implements Function2 {
final /* synthetic */ Function2 $block;
int label;
final /* synthetic */ LifecycleCoroutineScope this$0;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public LifecycleCoroutineScope$launchWhenCreated$1(LifecycleCoroutineScope lifecycleCoroutineScope, Function2 function2, Continuation continuation) {
super(2, continuation);
this.this$0 = lifecycleCoroutineScope;
this.$block = function2;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation create(Object obj, Continuation continuation) {
return new LifecycleCoroutineScope$launchWhenCreated$1(this.this$0, this.$block, continuation);
}
@Override // kotlin.jvm.functions.Function2
public final Object invoke(CoroutineScope coroutineScope, Continuation continuation) {
return ((LifecycleCoroutineScope$launchWhenCreated$1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
Object coroutine_suspended;
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
int i = this.label;
if (i == 0) {
ResultKt.throwOnFailure(obj);
Lifecycle lifecycle$lifecycle_common = this.this$0.getLifecycle$lifecycle_common();
Function2 function2 = this.$block;
this.label = 1;
if (PausingDispatcherKt.whenCreated(lifecycle$lifecycle_common, function2, this) == coroutine_suspended) {
return coroutine_suspended;
}
} else {
if (i != 1) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
ResultKt.throwOnFailure(obj);
}
return Unit.INSTANCE;
}
}

View File

@@ -0,0 +1,57 @@
package androidx.lifecycle;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.CoroutineScope;
@DebugMetadata(c = "androidx.lifecycle.LifecycleCoroutineScope$launchWhenResumed$1", f = "Lifecycle.kt", l = {375}, m = "invokeSuspend")
/* loaded from: classes.dex */
public final class LifecycleCoroutineScope$launchWhenResumed$1 extends SuspendLambda implements Function2 {
final /* synthetic */ Function2 $block;
int label;
final /* synthetic */ LifecycleCoroutineScope this$0;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public LifecycleCoroutineScope$launchWhenResumed$1(LifecycleCoroutineScope lifecycleCoroutineScope, Function2 function2, Continuation continuation) {
super(2, continuation);
this.this$0 = lifecycleCoroutineScope;
this.$block = function2;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation create(Object obj, Continuation continuation) {
return new LifecycleCoroutineScope$launchWhenResumed$1(this.this$0, this.$block, continuation);
}
@Override // kotlin.jvm.functions.Function2
public final Object invoke(CoroutineScope coroutineScope, Continuation continuation) {
return ((LifecycleCoroutineScope$launchWhenResumed$1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
Object coroutine_suspended;
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
int i = this.label;
if (i == 0) {
ResultKt.throwOnFailure(obj);
Lifecycle lifecycle$lifecycle_common = this.this$0.getLifecycle$lifecycle_common();
Function2 function2 = this.$block;
this.label = 1;
if (PausingDispatcherKt.whenResumed(lifecycle$lifecycle_common, function2, this) == coroutine_suspended) {
return coroutine_suspended;
}
} else {
if (i != 1) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
ResultKt.throwOnFailure(obj);
}
return Unit.INSTANCE;
}
}

View File

@@ -0,0 +1,57 @@
package androidx.lifecycle;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.CoroutineScope;
@DebugMetadata(c = "androidx.lifecycle.LifecycleCoroutineScope$launchWhenStarted$1", f = "Lifecycle.kt", l = {356}, m = "invokeSuspend")
/* loaded from: classes.dex */
public final class LifecycleCoroutineScope$launchWhenStarted$1 extends SuspendLambda implements Function2 {
final /* synthetic */ Function2 $block;
int label;
final /* synthetic */ LifecycleCoroutineScope this$0;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public LifecycleCoroutineScope$launchWhenStarted$1(LifecycleCoroutineScope lifecycleCoroutineScope, Function2 function2, Continuation continuation) {
super(2, continuation);
this.this$0 = lifecycleCoroutineScope;
this.$block = function2;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation create(Object obj, Continuation continuation) {
return new LifecycleCoroutineScope$launchWhenStarted$1(this.this$0, this.$block, continuation);
}
@Override // kotlin.jvm.functions.Function2
public final Object invoke(CoroutineScope coroutineScope, Continuation continuation) {
return ((LifecycleCoroutineScope$launchWhenStarted$1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
Object coroutine_suspended;
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
int i = this.label;
if (i == 0) {
ResultKt.throwOnFailure(obj);
Lifecycle lifecycle$lifecycle_common = this.this$0.getLifecycle$lifecycle_common();
Function2 function2 = this.$block;
this.label = 1;
if (PausingDispatcherKt.whenStarted(lifecycle$lifecycle_common, function2, this) == coroutine_suspended) {
return coroutine_suspended;
}
} else {
if (i != 1) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
ResultKt.throwOnFailure(obj);
}
return Unit.INSTANCE;
}
}

View File

@@ -0,0 +1,37 @@
package androidx.lifecycle;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.BuildersKt__Builders_commonKt;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.Job;
/* loaded from: classes.dex */
public abstract class LifecycleCoroutineScope implements CoroutineScope {
@Override // kotlinx.coroutines.CoroutineScope
public abstract /* synthetic */ CoroutineContext getCoroutineContext();
public abstract Lifecycle getLifecycle$lifecycle_common();
public final Job launchWhenCreated(Function2 block) {
Job launch$default;
Intrinsics.checkNotNullParameter(block, "block");
launch$default = BuildersKt__Builders_commonKt.launch$default(this, null, null, new LifecycleCoroutineScope$launchWhenCreated$1(this, block, null), 3, null);
return launch$default;
}
public final Job launchWhenStarted(Function2 block) {
Job launch$default;
Intrinsics.checkNotNullParameter(block, "block");
launch$default = BuildersKt__Builders_commonKt.launch$default(this, null, null, new LifecycleCoroutineScope$launchWhenStarted$1(this, block, null), 3, null);
return launch$default;
}
public final Job launchWhenResumed(Function2 block) {
Job launch$default;
Intrinsics.checkNotNullParameter(block, "block");
launch$default = BuildersKt__Builders_commonKt.launch$default(this, null, null, new LifecycleCoroutineScope$launchWhenResumed$1(this, block, null), 3, null);
return launch$default;
}
}

View File

@@ -0,0 +1,54 @@
package androidx.lifecycle;
import androidx.lifecycle.Lifecycle;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.JobKt__JobKt;
@DebugMetadata(c = "androidx.lifecycle.LifecycleCoroutineScopeImpl$register$1", f = "Lifecycle.kt", l = {}, m = "invokeSuspend")
/* loaded from: classes.dex */
public final class LifecycleCoroutineScopeImpl$register$1 extends SuspendLambda implements Function2 {
private /* synthetic */ Object L$0;
int label;
final /* synthetic */ LifecycleCoroutineScopeImpl this$0;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public LifecycleCoroutineScopeImpl$register$1(LifecycleCoroutineScopeImpl lifecycleCoroutineScopeImpl, Continuation continuation) {
super(2, continuation);
this.this$0 = lifecycleCoroutineScopeImpl;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation create(Object obj, Continuation continuation) {
LifecycleCoroutineScopeImpl$register$1 lifecycleCoroutineScopeImpl$register$1 = new LifecycleCoroutineScopeImpl$register$1(this.this$0, continuation);
lifecycleCoroutineScopeImpl$register$1.L$0 = obj;
return lifecycleCoroutineScopeImpl$register$1;
}
@Override // kotlin.jvm.functions.Function2
public final Object invoke(CoroutineScope coroutineScope, Continuation continuation) {
return ((LifecycleCoroutineScopeImpl$register$1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
if (this.label == 0) {
ResultKt.throwOnFailure(obj);
CoroutineScope coroutineScope = (CoroutineScope) this.L$0;
if (this.this$0.getLifecycle$lifecycle_common().getCurrentState().compareTo(Lifecycle.State.INITIALIZED) < 0) {
JobKt__JobKt.cancel$default(coroutineScope.getCoroutineContext(), null, 1, null);
} else {
this.this$0.getLifecycle$lifecycle_common().addObserver(this.this$0);
}
return Unit.INSTANCE;
}
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
}

View File

@@ -0,0 +1,48 @@
package androidx.lifecycle;
import androidx.lifecycle.Lifecycle;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.BuildersKt__Builders_commonKt;
import kotlinx.coroutines.Dispatchers;
import kotlinx.coroutines.JobKt__JobKt;
/* loaded from: classes.dex */
public final class LifecycleCoroutineScopeImpl extends LifecycleCoroutineScope implements LifecycleEventObserver {
private final CoroutineContext coroutineContext;
private final Lifecycle lifecycle;
@Override // androidx.lifecycle.LifecycleCoroutineScope, kotlinx.coroutines.CoroutineScope
public CoroutineContext getCoroutineContext() {
return this.coroutineContext;
}
@Override // androidx.lifecycle.LifecycleCoroutineScope
public Lifecycle getLifecycle$lifecycle_common() {
return this.lifecycle;
}
public LifecycleCoroutineScopeImpl(Lifecycle lifecycle, CoroutineContext coroutineContext) {
Intrinsics.checkNotNullParameter(lifecycle, "lifecycle");
Intrinsics.checkNotNullParameter(coroutineContext, "coroutineContext");
this.lifecycle = lifecycle;
this.coroutineContext = coroutineContext;
if (getLifecycle$lifecycle_common().getCurrentState() == Lifecycle.State.DESTROYED) {
JobKt__JobKt.cancel$default(getCoroutineContext(), null, 1, null);
}
}
public final void register() {
BuildersKt__Builders_commonKt.launch$default(this, Dispatchers.getMain().getImmediate(), null, new LifecycleCoroutineScopeImpl$register$1(this, null), 2, null);
}
@Override // androidx.lifecycle.LifecycleEventObserver
public void onStateChanged(LifecycleOwner source, Lifecycle.Event event) {
Intrinsics.checkNotNullParameter(source, "source");
Intrinsics.checkNotNullParameter(event, "event");
if (getLifecycle$lifecycle_common().getCurrentState().compareTo(Lifecycle.State.DESTROYED) <= 0) {
getLifecycle$lifecycle_common().removeObserver(this);
JobKt__JobKt.cancel$default(getCoroutineContext(), null, 1, null);
}
}
}

View File

@@ -0,0 +1,37 @@
package androidx.lifecycle;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import androidx.annotation.VisibleForTesting;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public final class LifecycleDispatcher {
public static final LifecycleDispatcher INSTANCE = new LifecycleDispatcher();
private static final AtomicBoolean initialized = new AtomicBoolean(false);
private LifecycleDispatcher() {
}
public static final void init(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
if (initialized.getAndSet(true)) {
return;
}
Context applicationContext = context.getApplicationContext();
Intrinsics.checkNotNull(applicationContext, "null cannot be cast to non-null type android.app.Application");
((Application) applicationContext).registerActivityLifecycleCallbacks(new DispatcherActivityCallback());
}
@VisibleForTesting
public static final class DispatcherActivityCallback extends EmptyActivityLifecycleCallbacks {
@Override // androidx.lifecycle.EmptyActivityLifecycleCallbacks, android.app.Application.ActivityLifecycleCallbacks
public void onActivityCreated(Activity activity, Bundle bundle) {
Intrinsics.checkNotNullParameter(activity, "activity");
ReportFragment.Companion.injectIfNeededIn(activity);
}
}
}

View File

@@ -0,0 +1,8 @@
package androidx.lifecycle;
import androidx.lifecycle.Lifecycle;
/* loaded from: classes.dex */
public interface LifecycleEventObserver extends LifecycleObserver {
void onStateChanged(LifecycleOwner lifecycleOwner, Lifecycle.Event event);
}

View File

@@ -0,0 +1,15 @@
package androidx.lifecycle;
import java.util.concurrent.atomic.AtomicReference;
/* loaded from: classes.dex */
public abstract /* synthetic */ class LifecycleKt$$ExternalSyntheticBackportWithForwarding0 {
public static /* synthetic */ boolean m(AtomicReference atomicReference, Object obj, Object obj2) {
while (!atomicReference.compareAndSet(obj, obj2)) {
if (atomicReference.get() != obj) {
return false;
}
}
return true;
}
}

View File

@@ -0,0 +1,22 @@
package androidx.lifecycle;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.Dispatchers;
import kotlinx.coroutines.SupervisorKt;
/* loaded from: classes.dex */
public final class LifecycleKt {
public static final LifecycleCoroutineScope getCoroutineScope(Lifecycle lifecycle) {
LifecycleCoroutineScopeImpl lifecycleCoroutineScopeImpl;
Intrinsics.checkNotNullParameter(lifecycle, "<this>");
do {
LifecycleCoroutineScopeImpl lifecycleCoroutineScopeImpl2 = (LifecycleCoroutineScopeImpl) lifecycle.getInternalScopeRef().get();
if (lifecycleCoroutineScopeImpl2 != null) {
return lifecycleCoroutineScopeImpl2;
}
lifecycleCoroutineScopeImpl = new LifecycleCoroutineScopeImpl(lifecycle, SupervisorKt.SupervisorJob$default(null, 1, null).plus(Dispatchers.getMain().getImmediate()));
} while (!LifecycleKt$$ExternalSyntheticBackportWithForwarding0.m(lifecycle.getInternalScopeRef(), null, lifecycleCoroutineScopeImpl));
lifecycleCoroutineScopeImpl.register();
return lifecycleCoroutineScopeImpl;
}
}

View File

@@ -0,0 +1,5 @@
package androidx.lifecycle;
/* loaded from: classes.dex */
public interface LifecycleObserver {
}

View File

@@ -0,0 +1,6 @@
package androidx.lifecycle;
/* loaded from: classes.dex */
public interface LifecycleOwner {
Lifecycle getLifecycle();
}

View File

@@ -0,0 +1,11 @@
package androidx.lifecycle;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public final class LifecycleOwnerKt {
public static final LifecycleCoroutineScope getLifecycleScope(LifecycleOwner lifecycleOwner) {
Intrinsics.checkNotNullParameter(lifecycleOwner, "<this>");
return LifecycleKt.getCoroutineScope(lifecycleOwner.getLifecycle());
}
}

View File

@@ -0,0 +1,301 @@
package androidx.lifecycle;
import android.annotation.SuppressLint;
import androidx.annotation.MainThread;
import androidx.annotation.VisibleForTesting;
import androidx.arch.core.executor.ArchTaskExecutor;
import androidx.arch.core.internal.FastSafeIterableMap;
import androidx.arch.core.internal.SafeIterableMap;
import androidx.lifecycle.Lifecycle;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public class LifecycleRegistry extends Lifecycle {
public static final Companion Companion = new Companion(null);
private int addingObserverCounter;
private final boolean enforceMainThread;
private boolean handlingEvent;
private final WeakReference<LifecycleOwner> lifecycleOwner;
private boolean newEventOccurred;
private FastSafeIterableMap<LifecycleObserver, ObserverWithState> observerMap;
private ArrayList<Lifecycle.State> parentStates;
private Lifecycle.State state;
public /* synthetic */ LifecycleRegistry(LifecycleOwner lifecycleOwner, boolean z, DefaultConstructorMarker defaultConstructorMarker) {
this(lifecycleOwner, z);
}
@VisibleForTesting
public static final LifecycleRegistry createUnsafe(LifecycleOwner lifecycleOwner) {
return Companion.createUnsafe(lifecycleOwner);
}
@Override // androidx.lifecycle.Lifecycle
public Lifecycle.State getCurrentState() {
return this.state;
}
private LifecycleRegistry(LifecycleOwner lifecycleOwner, boolean z) {
this.enforceMainThread = z;
this.observerMap = new FastSafeIterableMap<>();
this.state = Lifecycle.State.INITIALIZED;
this.parentStates = new ArrayList<>();
this.lifecycleOwner = new WeakReference<>(lifecycleOwner);
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public LifecycleRegistry(LifecycleOwner provider) {
this(provider, true);
Intrinsics.checkNotNullParameter(provider, "provider");
}
@MainThread
public void markState(Lifecycle.State state) {
Intrinsics.checkNotNullParameter(state, "state");
enforceMainThreadIfNeeded("markState");
setCurrentState(state);
}
public void setCurrentState(Lifecycle.State state) {
Intrinsics.checkNotNullParameter(state, "state");
enforceMainThreadIfNeeded("setCurrentState");
moveToState(state);
}
public void handleLifecycleEvent(Lifecycle.Event event) {
Intrinsics.checkNotNullParameter(event, "event");
enforceMainThreadIfNeeded("handleLifecycleEvent");
moveToState(event.getTargetState());
}
private final void moveToState(Lifecycle.State state) {
Lifecycle.State state2 = this.state;
if (state2 == state) {
return;
}
if (state2 == Lifecycle.State.INITIALIZED && state == Lifecycle.State.DESTROYED) {
throw new IllegalStateException(("no event down from " + this.state + " in component " + this.lifecycleOwner.get()).toString());
}
this.state = state;
if (this.handlingEvent || this.addingObserverCounter != 0) {
this.newEventOccurred = true;
return;
}
this.handlingEvent = true;
sync();
this.handlingEvent = false;
if (this.state == Lifecycle.State.DESTROYED) {
this.observerMap = new FastSafeIterableMap<>();
}
}
private final boolean isSynced() {
if (this.observerMap.size() == 0) {
return true;
}
Map.Entry<LifecycleObserver, ObserverWithState> eldest = this.observerMap.eldest();
Intrinsics.checkNotNull(eldest);
Lifecycle.State state = eldest.getValue().getState();
Map.Entry<LifecycleObserver, ObserverWithState> newest = this.observerMap.newest();
Intrinsics.checkNotNull(newest);
Lifecycle.State state2 = newest.getValue().getState();
return state == state2 && this.state == state2;
}
private final Lifecycle.State calculateTargetState(LifecycleObserver lifecycleObserver) {
ObserverWithState value;
Map.Entry<LifecycleObserver, ObserverWithState> ceil = this.observerMap.ceil(lifecycleObserver);
Lifecycle.State state = null;
Lifecycle.State state2 = (ceil == null || (value = ceil.getValue()) == null) ? null : value.getState();
if (!this.parentStates.isEmpty()) {
state = this.parentStates.get(r0.size() - 1);
}
Companion companion = Companion;
return companion.min$lifecycle_runtime_release(companion.min$lifecycle_runtime_release(this.state, state2), state);
}
@Override // androidx.lifecycle.Lifecycle
public void addObserver(LifecycleObserver observer) {
LifecycleOwner lifecycleOwner;
Intrinsics.checkNotNullParameter(observer, "observer");
enforceMainThreadIfNeeded("addObserver");
Lifecycle.State state = this.state;
Lifecycle.State state2 = Lifecycle.State.DESTROYED;
if (state != state2) {
state2 = Lifecycle.State.INITIALIZED;
}
ObserverWithState observerWithState = new ObserverWithState(observer, state2);
if (this.observerMap.putIfAbsent(observer, observerWithState) == null && (lifecycleOwner = this.lifecycleOwner.get()) != null) {
boolean z = this.addingObserverCounter != 0 || this.handlingEvent;
Lifecycle.State calculateTargetState = calculateTargetState(observer);
this.addingObserverCounter++;
while (observerWithState.getState().compareTo(calculateTargetState) < 0 && this.observerMap.contains(observer)) {
pushParentState(observerWithState.getState());
Lifecycle.Event upFrom = Lifecycle.Event.Companion.upFrom(observerWithState.getState());
if (upFrom == null) {
throw new IllegalStateException("no event up from " + observerWithState.getState());
}
observerWithState.dispatchEvent(lifecycleOwner, upFrom);
popParentState();
calculateTargetState = calculateTargetState(observer);
}
if (!z) {
sync();
}
this.addingObserverCounter--;
}
}
private final void popParentState() {
this.parentStates.remove(r0.size() - 1);
}
private final void pushParentState(Lifecycle.State state) {
this.parentStates.add(state);
}
@Override // androidx.lifecycle.Lifecycle
public void removeObserver(LifecycleObserver observer) {
Intrinsics.checkNotNullParameter(observer, "observer");
enforceMainThreadIfNeeded("removeObserver");
this.observerMap.remove(observer);
}
public int getObserverCount() {
enforceMainThreadIfNeeded("getObserverCount");
return this.observerMap.size();
}
private final void forwardPass(LifecycleOwner lifecycleOwner) {
SafeIterableMap<LifecycleObserver, ObserverWithState>.IteratorWithAdditions iteratorWithAdditions = this.observerMap.iteratorWithAdditions();
Intrinsics.checkNotNullExpressionValue(iteratorWithAdditions, "observerMap.iteratorWithAdditions()");
while (iteratorWithAdditions.hasNext() && !this.newEventOccurred) {
Map.Entry next = iteratorWithAdditions.next();
LifecycleObserver lifecycleObserver = (LifecycleObserver) next.getKey();
ObserverWithState observerWithState = (ObserverWithState) next.getValue();
while (observerWithState.getState().compareTo(this.state) < 0 && !this.newEventOccurred && this.observerMap.contains(lifecycleObserver)) {
pushParentState(observerWithState.getState());
Lifecycle.Event upFrom = Lifecycle.Event.Companion.upFrom(observerWithState.getState());
if (upFrom == null) {
throw new IllegalStateException("no event up from " + observerWithState.getState());
}
observerWithState.dispatchEvent(lifecycleOwner, upFrom);
popParentState();
}
}
}
private final void backwardPass(LifecycleOwner lifecycleOwner) {
Iterator<Map.Entry<LifecycleObserver, ObserverWithState>> descendingIterator = this.observerMap.descendingIterator();
Intrinsics.checkNotNullExpressionValue(descendingIterator, "observerMap.descendingIterator()");
while (descendingIterator.hasNext() && !this.newEventOccurred) {
Map.Entry<LifecycleObserver, ObserverWithState> next = descendingIterator.next();
Intrinsics.checkNotNullExpressionValue(next, "next()");
LifecycleObserver key = next.getKey();
ObserverWithState value = next.getValue();
while (value.getState().compareTo(this.state) > 0 && !this.newEventOccurred && this.observerMap.contains(key)) {
Lifecycle.Event downFrom = Lifecycle.Event.Companion.downFrom(value.getState());
if (downFrom == null) {
throw new IllegalStateException("no event down from " + value.getState());
}
pushParentState(downFrom.getTargetState());
value.dispatchEvent(lifecycleOwner, downFrom);
popParentState();
}
}
}
private final void sync() {
LifecycleOwner lifecycleOwner = this.lifecycleOwner.get();
if (lifecycleOwner == null) {
throw new IllegalStateException("LifecycleOwner of this LifecycleRegistry is already garbage collected. It is too late to change lifecycle state.");
}
while (!isSynced()) {
this.newEventOccurred = false;
Lifecycle.State state = this.state;
Map.Entry<LifecycleObserver, ObserverWithState> eldest = this.observerMap.eldest();
Intrinsics.checkNotNull(eldest);
if (state.compareTo(eldest.getValue().getState()) < 0) {
backwardPass(lifecycleOwner);
}
Map.Entry<LifecycleObserver, ObserverWithState> newest = this.observerMap.newest();
if (!this.newEventOccurred && newest != null && this.state.compareTo(newest.getValue().getState()) > 0) {
forwardPass(lifecycleOwner);
}
}
this.newEventOccurred = false;
}
@SuppressLint({"RestrictedApi"})
private final void enforceMainThreadIfNeeded(String str) {
if (!this.enforceMainThread || ArchTaskExecutor.getInstance().isMainThread()) {
return;
}
throw new IllegalStateException(("Method " + str + " must be called on the main thread").toString());
}
public static final class ObserverWithState {
private LifecycleEventObserver lifecycleObserver;
private Lifecycle.State state;
public final LifecycleEventObserver getLifecycleObserver() {
return this.lifecycleObserver;
}
public final Lifecycle.State getState() {
return this.state;
}
public final void setLifecycleObserver(LifecycleEventObserver lifecycleEventObserver) {
Intrinsics.checkNotNullParameter(lifecycleEventObserver, "<set-?>");
this.lifecycleObserver = lifecycleEventObserver;
}
public final void setState(Lifecycle.State state) {
Intrinsics.checkNotNullParameter(state, "<set-?>");
this.state = state;
}
public ObserverWithState(LifecycleObserver lifecycleObserver, Lifecycle.State initialState) {
Intrinsics.checkNotNullParameter(initialState, "initialState");
Intrinsics.checkNotNull(lifecycleObserver);
this.lifecycleObserver = Lifecycling.lifecycleEventObserver(lifecycleObserver);
this.state = initialState;
}
public final void dispatchEvent(LifecycleOwner lifecycleOwner, Lifecycle.Event event) {
Intrinsics.checkNotNullParameter(event, "event");
Lifecycle.State targetState = event.getTargetState();
this.state = LifecycleRegistry.Companion.min$lifecycle_runtime_release(this.state, targetState);
LifecycleEventObserver lifecycleEventObserver = this.lifecycleObserver;
Intrinsics.checkNotNull(lifecycleOwner);
lifecycleEventObserver.onStateChanged(lifecycleOwner, event);
this.state = targetState;
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
@VisibleForTesting
public final LifecycleRegistry createUnsafe(LifecycleOwner owner) {
Intrinsics.checkNotNullParameter(owner, "owner");
return new LifecycleRegistry(owner, false, null);
}
public final Lifecycle.State min$lifecycle_runtime_release(Lifecycle.State state1, Lifecycle.State state) {
Intrinsics.checkNotNullParameter(state1, "state1");
return (state == null || state.compareTo(state1) >= 0) ? state1 : state;
}
}
}

View File

@@ -0,0 +1,11 @@
package androidx.lifecycle;
import androidx.annotation.NonNull;
@Deprecated
/* loaded from: classes.dex */
public interface LifecycleRegistryOwner extends LifecycleOwner {
@Override // androidx.lifecycle.LifecycleOwner
@NonNull
LifecycleRegistry getLifecycle();
}

View File

@@ -0,0 +1,52 @@
package androidx.lifecycle;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import androidx.annotation.CallSuper;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public class LifecycleService extends Service implements LifecycleOwner {
private final ServiceLifecycleDispatcher dispatcher = new ServiceLifecycleDispatcher(this);
@Override // android.app.Service
@CallSuper
public void onCreate() {
this.dispatcher.onServicePreSuperOnCreate();
super.onCreate();
}
@Override // android.app.Service
@CallSuper
public IBinder onBind(Intent intent) {
Intrinsics.checkNotNullParameter(intent, "intent");
this.dispatcher.onServicePreSuperOnBind();
return null;
}
@Override // android.app.Service
@CallSuper
public void onStart(Intent intent, int i) {
this.dispatcher.onServicePreSuperOnStart();
super.onStart(intent, i);
}
@Override // android.app.Service
@CallSuper
public int onStartCommand(Intent intent, int i, int i2) {
return super.onStartCommand(intent, i, i2);
}
@Override // android.app.Service
@CallSuper
public void onDestroy() {
this.dispatcher.onServicePreSuperOnDestroy();
super.onDestroy();
}
@Override // androidx.lifecycle.LifecycleOwner
public Lifecycle getLifecycle() {
return this.dispatcher.getLifecycle();
}
}

View File

@@ -0,0 +1,176 @@
package androidx.lifecycle;
import androidx.annotation.RestrictTo;
import csdk.gluads.Consts;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import kotlin.collections.CollectionsKt__CollectionsJVMKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsJVMKt;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public final class Lifecycling {
private static final int GENERATED_CALLBACK = 2;
private static final int REFLECTIVE_CALLBACK = 1;
public static final Lifecycling INSTANCE = new Lifecycling();
private static final Map<Class<?>, Integer> callbackCache = new HashMap();
private static final Map<Class<?>, List<Constructor<? extends GeneratedAdapter>>> classToAdapters = new HashMap();
private Lifecycling() {
}
public static final LifecycleEventObserver lifecycleEventObserver(Object object) {
Intrinsics.checkNotNullParameter(object, "object");
boolean z = object instanceof LifecycleEventObserver;
boolean z2 = object instanceof DefaultLifecycleObserver;
if (z && z2) {
return new DefaultLifecycleObserverAdapter((DefaultLifecycleObserver) object, (LifecycleEventObserver) object);
}
if (z2) {
return new DefaultLifecycleObserverAdapter((DefaultLifecycleObserver) object, null);
}
if (z) {
return (LifecycleEventObserver) object;
}
Class<?> cls = object.getClass();
Lifecycling lifecycling = INSTANCE;
if (lifecycling.getObserverConstructorType(cls) == 2) {
List<Constructor<? extends GeneratedAdapter>> list = classToAdapters.get(cls);
Intrinsics.checkNotNull(list);
List<Constructor<? extends GeneratedAdapter>> list2 = list;
if (list2.size() == 1) {
return new SingleGeneratedAdapterObserver(lifecycling.createGeneratedAdapter(list2.get(0), object));
}
int size = list2.size();
GeneratedAdapter[] generatedAdapterArr = new GeneratedAdapter[size];
for (int i = 0; i < size; i++) {
generatedAdapterArr[i] = INSTANCE.createGeneratedAdapter(list2.get(i), object);
}
return new CompositeGeneratedAdaptersObserver(generatedAdapterArr);
}
return new ReflectiveGenericLifecycleObserver(object);
}
private final GeneratedAdapter createGeneratedAdapter(Constructor<? extends GeneratedAdapter> constructor, Object obj) {
try {
GeneratedAdapter newInstance = constructor.newInstance(obj);
Intrinsics.checkNotNullExpressionValue(newInstance, "{\n constructo…tance(`object`)\n }");
return newInstance;
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InstantiationException e2) {
throw new RuntimeException(e2);
} catch (InvocationTargetException e3) {
throw new RuntimeException(e3);
}
}
private final Constructor<? extends GeneratedAdapter> generatedConstructor(Class<?> cls) {
try {
Package r0 = cls.getPackage();
String name = cls.getCanonicalName();
String fullPackage = r0 != null ? r0.getName() : "";
Intrinsics.checkNotNullExpressionValue(fullPackage, "fullPackage");
if (fullPackage.length() != 0) {
Intrinsics.checkNotNullExpressionValue(name, "name");
name = name.substring(fullPackage.length() + 1);
Intrinsics.checkNotNullExpressionValue(name, "this as java.lang.String).substring(startIndex)");
}
Intrinsics.checkNotNullExpressionValue(name, "if (fullPackage.isEmpty(…g(fullPackage.length + 1)");
String adapterName = getAdapterName(name);
if (fullPackage.length() != 0) {
adapterName = fullPackage + '.' + adapterName;
}
Class<?> cls2 = Class.forName(adapterName);
Intrinsics.checkNotNull(cls2, "null cannot be cast to non-null type java.lang.Class<out androidx.lifecycle.GeneratedAdapter>");
Constructor declaredConstructor = cls2.getDeclaredConstructor(cls);
if (declaredConstructor.isAccessible()) {
return declaredConstructor;
}
declaredConstructor.setAccessible(true);
return declaredConstructor;
} catch (ClassNotFoundException unused) {
return null;
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
}
private final int getObserverConstructorType(Class<?> cls) {
Map<Class<?>, Integer> map = callbackCache;
Integer num = map.get(cls);
if (num != null) {
return num.intValue();
}
int resolveObserverCallbackType = resolveObserverCallbackType(cls);
map.put(cls, Integer.valueOf(resolveObserverCallbackType));
return resolveObserverCallbackType;
}
private final int resolveObserverCallbackType(Class<?> cls) {
ArrayList arrayList;
if (cls.getCanonicalName() == null) {
return 1;
}
Constructor<? extends GeneratedAdapter> generatedConstructor = generatedConstructor(cls);
if (generatedConstructor != null) {
classToAdapters.put(cls, CollectionsKt__CollectionsJVMKt.listOf(generatedConstructor));
return 2;
}
if (ClassesInfoCache.sInstance.hasLifecycleMethods(cls)) {
return 1;
}
Class<? super Object> superclass = cls.getSuperclass();
if (isLifecycleParent(superclass)) {
Intrinsics.checkNotNullExpressionValue(superclass, "superclass");
if (getObserverConstructorType(superclass) == 1) {
return 1;
}
List<Constructor<? extends GeneratedAdapter>> list = classToAdapters.get(superclass);
Intrinsics.checkNotNull(list);
arrayList = new ArrayList(list);
} else {
arrayList = null;
}
Class<?>[] interfaces = cls.getInterfaces();
Intrinsics.checkNotNullExpressionValue(interfaces, "klass.interfaces");
for (Class<?> intrface : interfaces) {
if (isLifecycleParent(intrface)) {
Intrinsics.checkNotNullExpressionValue(intrface, "intrface");
if (getObserverConstructorType(intrface) == 1) {
return 1;
}
if (arrayList == null) {
arrayList = new ArrayList();
}
List<Constructor<? extends GeneratedAdapter>> list2 = classToAdapters.get(intrface);
Intrinsics.checkNotNull(list2);
arrayList.addAll(list2);
}
}
if (arrayList == null) {
return 1;
}
classToAdapters.put(cls, arrayList);
return 2;
}
private final boolean isLifecycleParent(Class<?> cls) {
return cls != null && LifecycleObserver.class.isAssignableFrom(cls);
}
public static final String getAdapterName(String className) {
String replace$default;
Intrinsics.checkNotNullParameter(className, "className");
StringBuilder sb = new StringBuilder();
replace$default = StringsKt__StringsJVMKt.replace$default(className, Consts.STRING_PERIOD, "_", false, 4, (Object) null);
sb.append(replace$default);
sb.append("_LifecycleAdapter");
return sb.toString();
}
}

View File

@@ -0,0 +1,332 @@
package androidx.lifecycle;
import androidx.annotation.MainThread;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.arch.core.executor.ArchTaskExecutor;
import androidx.arch.core.internal.SafeIterableMap;
import androidx.lifecycle.Lifecycle;
import java.util.Iterator;
import java.util.Map;
/* loaded from: classes.dex */
public abstract class LiveData<T> {
static final Object NOT_SET = new Object();
static final int START_VERSION = -1;
int mActiveCount;
private boolean mChangingActiveState;
private volatile Object mData;
final Object mDataLock;
private boolean mDispatchInvalidated;
private boolean mDispatchingValue;
private SafeIterableMap<Observer<? super T>, LiveData<T>.ObserverWrapper> mObservers;
volatile Object mPendingData;
private final Runnable mPostValueRunnable;
private int mVersion;
@Nullable
public T getValue() {
T t = (T) this.mData;
if (t != NOT_SET) {
return t;
}
return null;
}
public int getVersion() {
return this.mVersion;
}
public boolean hasActiveObservers() {
return this.mActiveCount > 0;
}
public boolean isInitialized() {
return this.mData != NOT_SET;
}
public void onActive() {
}
public void onInactive() {
}
public LiveData(T t) {
this.mDataLock = new Object();
this.mObservers = new SafeIterableMap<>();
this.mActiveCount = 0;
this.mPendingData = NOT_SET;
this.mPostValueRunnable = new Runnable() { // from class: androidx.lifecycle.LiveData.1
/* JADX WARN: Multi-variable type inference failed */
@Override // java.lang.Runnable
public void run() {
Object obj;
synchronized (LiveData.this.mDataLock) {
obj = LiveData.this.mPendingData;
LiveData.this.mPendingData = LiveData.NOT_SET;
}
LiveData.this.setValue(obj);
}
};
this.mData = t;
this.mVersion = 0;
}
public LiveData() {
this.mDataLock = new Object();
this.mObservers = new SafeIterableMap<>();
this.mActiveCount = 0;
Object obj = NOT_SET;
this.mPendingData = obj;
this.mPostValueRunnable = new Runnable() { // from class: androidx.lifecycle.LiveData.1
/* JADX WARN: Multi-variable type inference failed */
@Override // java.lang.Runnable
public void run() {
Object obj2;
synchronized (LiveData.this.mDataLock) {
obj2 = LiveData.this.mPendingData;
LiveData.this.mPendingData = LiveData.NOT_SET;
}
LiveData.this.setValue(obj2);
}
};
this.mData = obj;
this.mVersion = -1;
}
private void considerNotify(LiveData<T>.ObserverWrapper observerWrapper) {
if (observerWrapper.mActive) {
if (!observerWrapper.shouldBeActive()) {
observerWrapper.activeStateChanged(false);
return;
}
int i = observerWrapper.mLastVersion;
int i2 = this.mVersion;
if (i >= i2) {
return;
}
observerWrapper.mLastVersion = i2;
observerWrapper.mObserver.onChanged((Object) this.mData);
}
}
public void dispatchingValue(@Nullable LiveData<T>.ObserverWrapper observerWrapper) {
if (this.mDispatchingValue) {
this.mDispatchInvalidated = true;
return;
}
this.mDispatchingValue = true;
do {
this.mDispatchInvalidated = false;
if (observerWrapper != null) {
considerNotify(observerWrapper);
observerWrapper = null;
} else {
SafeIterableMap<Observer<? super T>, LiveData<T>.ObserverWrapper>.IteratorWithAdditions iteratorWithAdditions = this.mObservers.iteratorWithAdditions();
while (iteratorWithAdditions.hasNext()) {
considerNotify((ObserverWrapper) iteratorWithAdditions.next().getValue());
if (this.mDispatchInvalidated) {
break;
}
}
}
} while (this.mDispatchInvalidated);
this.mDispatchingValue = false;
}
@MainThread
public void observe(@NonNull LifecycleOwner lifecycleOwner, @NonNull Observer<? super T> observer) {
assertMainThread("observe");
if (lifecycleOwner.getLifecycle().getCurrentState() == Lifecycle.State.DESTROYED) {
return;
}
LifecycleBoundObserver lifecycleBoundObserver = new LifecycleBoundObserver(lifecycleOwner, observer);
LiveData<T>.ObserverWrapper putIfAbsent = this.mObservers.putIfAbsent(observer, lifecycleBoundObserver);
if (putIfAbsent != null && !putIfAbsent.isAttachedTo(lifecycleOwner)) {
throw new IllegalArgumentException("Cannot add the same observer with different lifecycles");
}
if (putIfAbsent != null) {
return;
}
lifecycleOwner.getLifecycle().addObserver(lifecycleBoundObserver);
}
@MainThread
public void observeForever(@NonNull Observer<? super T> observer) {
assertMainThread("observeForever");
AlwaysActiveObserver alwaysActiveObserver = new AlwaysActiveObserver(observer);
LiveData<T>.ObserverWrapper putIfAbsent = this.mObservers.putIfAbsent(observer, alwaysActiveObserver);
if (putIfAbsent instanceof LifecycleBoundObserver) {
throw new IllegalArgumentException("Cannot add the same observer with different lifecycles");
}
if (putIfAbsent != null) {
return;
}
alwaysActiveObserver.activeStateChanged(true);
}
@MainThread
public void removeObserver(@NonNull Observer<? super T> observer) {
assertMainThread("removeObserver");
LiveData<T>.ObserverWrapper remove = this.mObservers.remove(observer);
if (remove == null) {
return;
}
remove.detachObserver();
remove.activeStateChanged(false);
}
@MainThread
public void removeObservers(@NonNull LifecycleOwner lifecycleOwner) {
assertMainThread("removeObservers");
Iterator<Map.Entry<Observer<? super T>, LiveData<T>.ObserverWrapper>> it = this.mObservers.iterator();
while (it.hasNext()) {
Map.Entry<Observer<? super T>, LiveData<T>.ObserverWrapper> next = it.next();
if (next.getValue().isAttachedTo(lifecycleOwner)) {
removeObserver(next.getKey());
}
}
}
public void postValue(T t) {
boolean z;
synchronized (this.mDataLock) {
z = this.mPendingData == NOT_SET;
this.mPendingData = t;
}
if (z) {
ArchTaskExecutor.getInstance().postToMainThread(this.mPostValueRunnable);
}
}
@MainThread
public void setValue(T t) {
assertMainThread("setValue");
this.mVersion++;
this.mData = t;
dispatchingValue(null);
}
public boolean hasObservers() {
return this.mObservers.size() > 0;
}
@MainThread
public void changeActiveCounter(int i) {
int i2 = this.mActiveCount;
this.mActiveCount = i + i2;
if (this.mChangingActiveState) {
return;
}
this.mChangingActiveState = true;
while (true) {
try {
int i3 = this.mActiveCount;
if (i2 == i3) {
this.mChangingActiveState = false;
return;
}
boolean z = i2 == 0 && i3 > 0;
boolean z2 = i2 > 0 && i3 == 0;
if (z) {
onActive();
} else if (z2) {
onInactive();
}
i2 = i3;
} catch (Throwable th) {
this.mChangingActiveState = false;
throw th;
}
}
}
public class LifecycleBoundObserver extends LiveData<T>.ObserverWrapper implements LifecycleEventObserver {
@NonNull
final LifecycleOwner mOwner;
@Override // androidx.lifecycle.LiveData.ObserverWrapper
public boolean isAttachedTo(LifecycleOwner lifecycleOwner) {
return this.mOwner == lifecycleOwner;
}
public LifecycleBoundObserver(@NonNull LifecycleOwner lifecycleOwner, Observer<? super T> observer) {
super(observer);
this.mOwner = lifecycleOwner;
}
@Override // androidx.lifecycle.LiveData.ObserverWrapper
public boolean shouldBeActive() {
return this.mOwner.getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED);
}
@Override // androidx.lifecycle.LifecycleEventObserver
public void onStateChanged(@NonNull LifecycleOwner lifecycleOwner, @NonNull Lifecycle.Event event) {
Lifecycle.State currentState = this.mOwner.getLifecycle().getCurrentState();
if (currentState == Lifecycle.State.DESTROYED) {
LiveData.this.removeObserver(this.mObserver);
return;
}
Lifecycle.State state = null;
while (state != currentState) {
activeStateChanged(shouldBeActive());
state = currentState;
currentState = this.mOwner.getLifecycle().getCurrentState();
}
}
@Override // androidx.lifecycle.LiveData.ObserverWrapper
public void detachObserver() {
this.mOwner.getLifecycle().removeObserver(this);
}
}
public abstract class ObserverWrapper {
boolean mActive;
int mLastVersion = -1;
final Observer<? super T> mObserver;
public void detachObserver() {
}
public boolean isAttachedTo(LifecycleOwner lifecycleOwner) {
return false;
}
public abstract boolean shouldBeActive();
public ObserverWrapper(Observer<? super T> observer) {
this.mObserver = observer;
}
public void activeStateChanged(boolean z) {
if (z == this.mActive) {
return;
}
this.mActive = z;
LiveData.this.changeActiveCounter(z ? 1 : -1);
if (this.mActive) {
LiveData.this.dispatchingValue(this);
}
}
}
public class AlwaysActiveObserver extends LiveData<T>.ObserverWrapper {
@Override // androidx.lifecycle.LiveData.ObserverWrapper
public boolean shouldBeActive() {
return true;
}
public AlwaysActiveObserver(Observer<? super T> observer) {
super(observer);
}
}
public static void assertMainThread(String str) {
if (ArchTaskExecutor.getInstance().isMainThread()) {
return;
}
throw new IllegalStateException("Cannot invoke " + str + " on a background thread");
}
}

View File

@@ -0,0 +1,91 @@
package androidx.lifecycle;
import androidx.annotation.CallSuper;
import androidx.annotation.MainThread;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.arch.core.internal.SafeIterableMap;
import java.util.Iterator;
import java.util.Map;
/* loaded from: classes.dex */
public class MediatorLiveData<T> extends MutableLiveData<T> {
private SafeIterableMap<LiveData<?>, Source<?>> mSources;
public MediatorLiveData() {
this.mSources = new SafeIterableMap<>();
}
public MediatorLiveData(T t) {
super(t);
this.mSources = new SafeIterableMap<>();
}
@MainThread
public <S> void addSource(@NonNull LiveData<S> liveData, @NonNull Observer<? super S> observer) {
if (liveData == null) {
throw new NullPointerException("source cannot be null");
}
Source<?> source = new Source<>(liveData, observer);
Source<?> putIfAbsent = this.mSources.putIfAbsent(liveData, source);
if (putIfAbsent != null && putIfAbsent.mObserver != observer) {
throw new IllegalArgumentException("This source was already added with the different observer");
}
if (putIfAbsent == null && hasActiveObservers()) {
source.plug();
}
}
@MainThread
public <S> void removeSource(@NonNull LiveData<S> liveData) {
Source<?> remove = this.mSources.remove(liveData);
if (remove != null) {
remove.unplug();
}
}
@Override // androidx.lifecycle.LiveData
@CallSuper
public void onActive() {
Iterator<Map.Entry<LiveData<?>, Source<?>>> it = this.mSources.iterator();
while (it.hasNext()) {
it.next().getValue().plug();
}
}
@Override // androidx.lifecycle.LiveData
@CallSuper
public void onInactive() {
Iterator<Map.Entry<LiveData<?>, Source<?>>> it = this.mSources.iterator();
while (it.hasNext()) {
it.next().getValue().unplug();
}
}
public static class Source<V> implements Observer<V> {
final LiveData<V> mLiveData;
final Observer<? super V> mObserver;
int mVersion = -1;
public Source(LiveData<V> liveData, Observer<? super V> observer) {
this.mLiveData = liveData;
this.mObserver = observer;
}
public void plug() {
this.mLiveData.observeForever(this);
}
public void unplug() {
this.mLiveData.removeObserver(this);
}
@Override // androidx.lifecycle.Observer
public void onChanged(@Nullable V v) {
if (this.mVersion != this.mLiveData.getVersion()) {
this.mVersion = this.mLiveData.getVersion();
this.mObserver.onChanged(v);
}
}
}
}

View File

@@ -0,0 +1,22 @@
package androidx.lifecycle;
import androidx.annotation.RestrictTo;
import java.util.HashMap;
import java.util.Map;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public class MethodCallsLogger {
private final Map<String, Integer> calledMethods = new HashMap();
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public boolean approveCall(String name, int i) {
Intrinsics.checkNotNullParameter(name, "name");
Integer num = this.calledMethods.get(name);
int intValue = num != null ? num.intValue() : 0;
boolean z = (intValue & i) != 0;
this.calledMethods.put(name, Integer.valueOf(i | intValue));
return !z;
}
}

View File

@@ -0,0 +1,21 @@
package androidx.lifecycle;
/* loaded from: classes.dex */
public class MutableLiveData<T> extends LiveData<T> {
public MutableLiveData(T t) {
super(t);
}
public MutableLiveData() {
}
@Override // androidx.lifecycle.LiveData
public void postValue(T t) {
super.postValue(t);
}
@Override // androidx.lifecycle.LiveData
public void setValue(T t) {
super.setValue(t);
}
}

View File

@@ -0,0 +1,6 @@
package androidx.lifecycle;
/* loaded from: classes.dex */
public interface Observer<T> {
void onChanged(T t);
}

View File

@@ -0,0 +1,15 @@
package androidx.lifecycle;
import androidx.lifecycle.Lifecycle;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Deprecated
/* loaded from: classes.dex */
public @interface OnLifecycleEvent {
Lifecycle.Event value();
}

View File

@@ -0,0 +1,28 @@
package androidx.lifecycle;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.CoroutineDispatcher;
import kotlinx.coroutines.Dispatchers;
/* loaded from: classes.dex */
public final class PausingDispatcher extends CoroutineDispatcher {
public final DispatchQueue dispatchQueue = new DispatchQueue();
@Override // kotlinx.coroutines.CoroutineDispatcher
public boolean isDispatchNeeded(CoroutineContext context) {
Intrinsics.checkNotNullParameter(context, "context");
if (Dispatchers.getMain().getImmediate().isDispatchNeeded(context)) {
return true;
}
return !this.dispatchQueue.canRun();
}
@Override // kotlinx.coroutines.CoroutineDispatcher
/* renamed from: dispatch */
public void mo4148dispatch(CoroutineContext context, Runnable block) {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(block, "block");
this.dispatchQueue.dispatchAndEnqueue(context, block);
}
}

View File

@@ -0,0 +1,89 @@
package androidx.lifecycle;
import androidx.lifecycle.Lifecycle;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.Job;
@DebugMetadata(c = "androidx.lifecycle.PausingDispatcherKt$whenStateAtLeast$2", f = "PausingDispatcher.kt", l = {203}, m = "invokeSuspend")
/* loaded from: classes.dex */
public final class PausingDispatcherKt$whenStateAtLeast$2 extends SuspendLambda implements Function2 {
final /* synthetic */ Function2 $block;
final /* synthetic */ Lifecycle.State $minState;
final /* synthetic */ Lifecycle $this_whenStateAtLeast;
private /* synthetic */ Object L$0;
int label;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public PausingDispatcherKt$whenStateAtLeast$2(Lifecycle lifecycle, Lifecycle.State state, Function2 function2, Continuation continuation) {
super(2, continuation);
this.$this_whenStateAtLeast = lifecycle;
this.$minState = state;
this.$block = function2;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation create(Object obj, Continuation continuation) {
PausingDispatcherKt$whenStateAtLeast$2 pausingDispatcherKt$whenStateAtLeast$2 = new PausingDispatcherKt$whenStateAtLeast$2(this.$this_whenStateAtLeast, this.$minState, this.$block, continuation);
pausingDispatcherKt$whenStateAtLeast$2.L$0 = obj;
return pausingDispatcherKt$whenStateAtLeast$2;
}
@Override // kotlin.jvm.functions.Function2
public final Object invoke(CoroutineScope coroutineScope, Continuation continuation) {
return ((PausingDispatcherKt$whenStateAtLeast$2) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
Object coroutine_suspended;
LifecycleController lifecycleController;
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
int i = this.label;
if (i == 0) {
ResultKt.throwOnFailure(obj);
Job job = (Job) ((CoroutineScope) this.L$0).getCoroutineContext().get(Job.Key);
if (job == null) {
throw new IllegalStateException("when[State] methods should have a parent job".toString());
}
PausingDispatcher pausingDispatcher = new PausingDispatcher();
LifecycleController lifecycleController2 = new LifecycleController(this.$this_whenStateAtLeast, this.$minState, pausingDispatcher.dispatchQueue, job);
try {
Function2 function2 = this.$block;
this.L$0 = lifecycleController2;
this.label = 1;
obj = BuildersKt.withContext(pausingDispatcher, function2, this);
if (obj == coroutine_suspended) {
return coroutine_suspended;
}
lifecycleController = lifecycleController2;
} catch (Throwable th) {
th = th;
lifecycleController = lifecycleController2;
lifecycleController.finish();
throw th;
}
} else {
if (i != 1) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
lifecycleController = (LifecycleController) this.L$0;
try {
ResultKt.throwOnFailure(obj);
} catch (Throwable th2) {
th = th2;
lifecycleController.finish();
throw th;
}
}
lifecycleController.finish();
return obj;
}
}

View File

@@ -0,0 +1,38 @@
package androidx.lifecycle;
import androidx.lifecycle.Lifecycle;
import kotlin.coroutines.Continuation;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.Dispatchers;
/* loaded from: classes.dex */
public final class PausingDispatcherKt {
public static final <T> Object whenCreated(LifecycleOwner lifecycleOwner, Function2 function2, Continuation continuation) {
return whenCreated(lifecycleOwner.getLifecycle(), function2, continuation);
}
public static final <T> Object whenCreated(Lifecycle lifecycle, Function2 function2, Continuation continuation) {
return whenStateAtLeast(lifecycle, Lifecycle.State.CREATED, function2, continuation);
}
public static final <T> Object whenStarted(LifecycleOwner lifecycleOwner, Function2 function2, Continuation continuation) {
return whenStarted(lifecycleOwner.getLifecycle(), function2, continuation);
}
public static final <T> Object whenStarted(Lifecycle lifecycle, Function2 function2, Continuation continuation) {
return whenStateAtLeast(lifecycle, Lifecycle.State.STARTED, function2, continuation);
}
public static final <T> Object whenResumed(LifecycleOwner lifecycleOwner, Function2 function2, Continuation continuation) {
return whenResumed(lifecycleOwner.getLifecycle(), function2, continuation);
}
public static final <T> Object whenResumed(Lifecycle lifecycle, Function2 function2, Continuation continuation) {
return whenStateAtLeast(lifecycle, Lifecycle.State.RESUMED, function2, continuation);
}
public static final <T> Object whenStateAtLeast(Lifecycle lifecycle, Lifecycle.State state, Function2 function2, Continuation continuation) {
return BuildersKt.withContext(Dispatchers.getMain().getImmediate(), new PausingDispatcherKt$whenStateAtLeast$2(lifecycle, state, function2, null), continuation);
}
}

View File

@@ -0,0 +1,32 @@
package androidx.lifecycle;
import android.content.Context;
import androidx.lifecycle.ProcessLifecycleOwner;
import androidx.startup.AppInitializer;
import androidx.startup.Initializer;
import java.util.List;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public final class ProcessLifecycleInitializer implements Initializer<LifecycleOwner> {
/* JADX WARN: Can't rename method to resolve collision */
@Override // androidx.startup.Initializer
public LifecycleOwner create(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
AppInitializer appInitializer = AppInitializer.getInstance(context);
Intrinsics.checkNotNullExpressionValue(appInitializer, "getInstance(context)");
if (!appInitializer.isEagerlyInitialized(ProcessLifecycleInitializer.class)) {
throw new IllegalStateException("ProcessLifecycleInitializer cannot be initialized lazily.\n Please ensure that you have:\n <meta-data\n android:name='androidx.lifecycle.ProcessLifecycleInitializer'\n android:value='androidx.startup' />\n under InitializationProvider in your AndroidManifest.xml".toString());
}
LifecycleDispatcher.init(context);
ProcessLifecycleOwner.Companion companion = ProcessLifecycleOwner.Companion;
companion.init$lifecycle_process_release(context);
return companion.get();
}
@Override // androidx.startup.Initializer
public List<Class<? extends Initializer<?>>> dependencies() {
return CollectionsKt__CollectionsKt.emptyList();
}
}

View File

@@ -0,0 +1,211 @@
package androidx.lifecycle;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import androidx.annotation.DoNotInline;
import androidx.annotation.RequiresApi;
import androidx.annotation.VisibleForTesting;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.ProcessLifecycleOwner;
import androidx.lifecycle.ReportFragment;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public final class ProcessLifecycleOwner implements LifecycleOwner {
public static final long TIMEOUT_MS = 700;
private Handler handler;
private int resumedCounter;
private int startedCounter;
public static final Companion Companion = new Companion(null);
private static final ProcessLifecycleOwner newInstance = new ProcessLifecycleOwner();
private boolean pauseSent = true;
private boolean stopSent = true;
private final LifecycleRegistry registry = new LifecycleRegistry(this);
private final Runnable delayedPauseRunnable = new Runnable() { // from class: androidx.lifecycle.ProcessLifecycleOwner$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
ProcessLifecycleOwner.delayedPauseRunnable$lambda$0(ProcessLifecycleOwner.this);
}
};
private final ReportFragment.ActivityInitializationListener initializationListener = new ReportFragment.ActivityInitializationListener() { // from class: androidx.lifecycle.ProcessLifecycleOwner$initializationListener$1
@Override // androidx.lifecycle.ReportFragment.ActivityInitializationListener
public void onCreate() {
}
@Override // androidx.lifecycle.ReportFragment.ActivityInitializationListener
public void onStart() {
ProcessLifecycleOwner.this.activityStarted$lifecycle_process_release();
}
@Override // androidx.lifecycle.ReportFragment.ActivityInitializationListener
public void onResume() {
ProcessLifecycleOwner.this.activityResumed$lifecycle_process_release();
}
};
public static final LifecycleOwner get() {
return Companion.get();
}
@Override // androidx.lifecycle.LifecycleOwner
public Lifecycle getLifecycle() {
return this.registry;
}
private ProcessLifecycleOwner() {
}
/* JADX INFO: Access modifiers changed from: private */
public static final void delayedPauseRunnable$lambda$0(ProcessLifecycleOwner this$0) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
this$0.dispatchPauseIfNeeded$lifecycle_process_release();
this$0.dispatchStopIfNeeded$lifecycle_process_release();
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
@VisibleForTesting
public static /* synthetic */ void getTIMEOUT_MS$lifecycle_process_release$annotations() {
}
private Companion() {
}
public final LifecycleOwner get() {
return ProcessLifecycleOwner.newInstance;
}
public final void init$lifecycle_process_release(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
ProcessLifecycleOwner.newInstance.attach$lifecycle_process_release(context);
}
}
public final void activityStarted$lifecycle_process_release() {
int i = this.startedCounter + 1;
this.startedCounter = i;
if (i == 1 && this.stopSent) {
this.registry.handleLifecycleEvent(Lifecycle.Event.ON_START);
this.stopSent = false;
}
}
public final void activityResumed$lifecycle_process_release() {
int i = this.resumedCounter + 1;
this.resumedCounter = i;
if (i == 1) {
if (this.pauseSent) {
this.registry.handleLifecycleEvent(Lifecycle.Event.ON_RESUME);
this.pauseSent = false;
} else {
Handler handler = this.handler;
Intrinsics.checkNotNull(handler);
handler.removeCallbacks(this.delayedPauseRunnable);
}
}
}
public final void activityPaused$lifecycle_process_release() {
int i = this.resumedCounter - 1;
this.resumedCounter = i;
if (i == 0) {
Handler handler = this.handler;
Intrinsics.checkNotNull(handler);
handler.postDelayed(this.delayedPauseRunnable, 700L);
}
}
public final void activityStopped$lifecycle_process_release() {
this.startedCounter--;
dispatchStopIfNeeded$lifecycle_process_release();
}
public final void dispatchPauseIfNeeded$lifecycle_process_release() {
if (this.resumedCounter == 0) {
this.pauseSent = true;
this.registry.handleLifecycleEvent(Lifecycle.Event.ON_PAUSE);
}
}
public final void dispatchStopIfNeeded$lifecycle_process_release() {
if (this.startedCounter == 0 && this.pauseSent) {
this.registry.handleLifecycleEvent(Lifecycle.Event.ON_STOP);
this.stopSent = true;
}
}
public final void attach$lifecycle_process_release(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
this.handler = new Handler();
this.registry.handleLifecycleEvent(Lifecycle.Event.ON_CREATE);
Context applicationContext = context.getApplicationContext();
Intrinsics.checkNotNull(applicationContext, "null cannot be cast to non-null type android.app.Application");
((Application) applicationContext).registerActivityLifecycleCallbacks(new EmptyActivityLifecycleCallbacks() { // from class: androidx.lifecycle.ProcessLifecycleOwner$attach$1
@Override // android.app.Application.ActivityLifecycleCallbacks
@RequiresApi(29)
public void onActivityPreCreated(Activity activity, Bundle bundle) {
Intrinsics.checkNotNullParameter(activity, "activity");
final ProcessLifecycleOwner processLifecycleOwner = ProcessLifecycleOwner.this;
ProcessLifecycleOwner.Api29Impl.registerActivityLifecycleCallbacks(activity, new EmptyActivityLifecycleCallbacks() { // from class: androidx.lifecycle.ProcessLifecycleOwner$attach$1$onActivityPreCreated$1
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityPostStarted(Activity activity2) {
Intrinsics.checkNotNullParameter(activity2, "activity");
ProcessLifecycleOwner.this.activityStarted$lifecycle_process_release();
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityPostResumed(Activity activity2) {
Intrinsics.checkNotNullParameter(activity2, "activity");
ProcessLifecycleOwner.this.activityResumed$lifecycle_process_release();
}
});
}
@Override // androidx.lifecycle.EmptyActivityLifecycleCallbacks, android.app.Application.ActivityLifecycleCallbacks
public void onActivityCreated(Activity activity, Bundle bundle) {
ReportFragment.ActivityInitializationListener activityInitializationListener;
Intrinsics.checkNotNullParameter(activity, "activity");
if (Build.VERSION.SDK_INT < 29) {
ReportFragment reportFragment = ReportFragment.Companion.get(activity);
activityInitializationListener = ProcessLifecycleOwner.this.initializationListener;
reportFragment.setProcessListener(activityInitializationListener);
}
}
@Override // androidx.lifecycle.EmptyActivityLifecycleCallbacks, android.app.Application.ActivityLifecycleCallbacks
public void onActivityPaused(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
ProcessLifecycleOwner.this.activityPaused$lifecycle_process_release();
}
@Override // androidx.lifecycle.EmptyActivityLifecycleCallbacks, android.app.Application.ActivityLifecycleCallbacks
public void onActivityStopped(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
ProcessLifecycleOwner.this.activityStopped$lifecycle_process_release();
}
});
}
@RequiresApi(29)
public static final class Api29Impl {
public static final Api29Impl INSTANCE = new Api29Impl();
private Api29Impl() {
}
@DoNotInline
public static final void registerActivityLifecycleCallbacks(Activity activity, Application.ActivityLifecycleCallbacks callback) {
Intrinsics.checkNotNullParameter(activity, "activity");
Intrinsics.checkNotNullParameter(callback, "callback");
activity.registerActivityLifecycleCallbacks(callback);
}
}
}

View File

@@ -0,0 +1,22 @@
package androidx.lifecycle;
import androidx.annotation.NonNull;
import androidx.lifecycle.ClassesInfoCache;
import androidx.lifecycle.Lifecycle;
@Deprecated
/* loaded from: classes.dex */
class ReflectiveGenericLifecycleObserver implements LifecycleEventObserver {
private final ClassesInfoCache.CallbackInfo mInfo;
private final Object mWrapped;
public ReflectiveGenericLifecycleObserver(Object obj) {
this.mWrapped = obj;
this.mInfo = ClassesInfoCache.sInstance.getInfo(obj.getClass());
}
@Override // androidx.lifecycle.LifecycleEventObserver
public void onStateChanged(@NonNull LifecycleOwner lifecycleOwner, @NonNull Lifecycle.Event event) {
this.mInfo.invokeCallbacks(lifecycleOwner, event, this.mWrapped);
}
}

View File

@@ -0,0 +1,5 @@
package androidx.lifecycle;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ReportFragment$LifecycleCallbacks$Companion$$ExternalSyntheticApiModelOutline0 {
}

View File

@@ -0,0 +1,248 @@
package androidx.lifecycle;
import android.app.Activity;
import android.app.Application;
import android.app.Fragment;
import android.app.FragmentManager;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.lifecycle.Lifecycle;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public class ReportFragment extends Fragment {
public static final Companion Companion = new Companion(null);
private static final String REPORT_FRAGMENT_TAG = "androidx.lifecycle.LifecycleDispatcher.report_fragment_tag";
private ActivityInitializationListener processListener;
public interface ActivityInitializationListener {
void onCreate();
void onResume();
void onStart();
}
public static final ReportFragment get(Activity activity) {
return Companion.get(activity);
}
public static final void injectIfNeededIn(Activity activity) {
Companion.injectIfNeededIn(activity);
}
public final void setProcessListener(ActivityInitializationListener activityInitializationListener) {
this.processListener = activityInitializationListener;
}
private final void dispatchCreate(ActivityInitializationListener activityInitializationListener) {
if (activityInitializationListener != null) {
activityInitializationListener.onCreate();
}
}
private final void dispatchStart(ActivityInitializationListener activityInitializationListener) {
if (activityInitializationListener != null) {
activityInitializationListener.onStart();
}
}
private final void dispatchResume(ActivityInitializationListener activityInitializationListener) {
if (activityInitializationListener != null) {
activityInitializationListener.onResume();
}
}
@Override // android.app.Fragment
public void onActivityCreated(Bundle bundle) {
super.onActivityCreated(bundle);
dispatchCreate(this.processListener);
dispatch(Lifecycle.Event.ON_CREATE);
}
@Override // android.app.Fragment
public void onStart() {
super.onStart();
dispatchStart(this.processListener);
dispatch(Lifecycle.Event.ON_START);
}
@Override // android.app.Fragment
public void onResume() {
super.onResume();
dispatchResume(this.processListener);
dispatch(Lifecycle.Event.ON_RESUME);
}
@Override // android.app.Fragment
public void onPause() {
super.onPause();
dispatch(Lifecycle.Event.ON_PAUSE);
}
@Override // android.app.Fragment
public void onStop() {
super.onStop();
dispatch(Lifecycle.Event.ON_STOP);
}
@Override // android.app.Fragment
public void onDestroy() {
super.onDestroy();
dispatch(Lifecycle.Event.ON_DESTROY);
this.processListener = null;
}
private final void dispatch(Lifecycle.Event event) {
if (Build.VERSION.SDK_INT < 29) {
Companion companion = Companion;
Activity activity = getActivity();
Intrinsics.checkNotNullExpressionValue(activity, "activity");
companion.dispatch$lifecycle_runtime_release(activity, event);
}
}
@RequiresApi(29)
public static final class LifecycleCallbacks implements Application.ActivityLifecycleCallbacks {
public static final Companion Companion = new Companion(null);
public static final void registerIn(Activity activity) {
Companion.registerIn(activity);
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityCreated(Activity activity, Bundle bundle) {
Intrinsics.checkNotNullParameter(activity, "activity");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityDestroyed(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityPaused(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityResumed(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
Intrinsics.checkNotNullParameter(activity, "activity");
Intrinsics.checkNotNullParameter(bundle, "bundle");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityStarted(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityStopped(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityPostCreated(Activity activity, Bundle bundle) {
Intrinsics.checkNotNullParameter(activity, "activity");
ReportFragment.Companion.dispatch$lifecycle_runtime_release(activity, Lifecycle.Event.ON_CREATE);
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityPostStarted(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
ReportFragment.Companion.dispatch$lifecycle_runtime_release(activity, Lifecycle.Event.ON_START);
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityPostResumed(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
ReportFragment.Companion.dispatch$lifecycle_runtime_release(activity, Lifecycle.Event.ON_RESUME);
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityPrePaused(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
ReportFragment.Companion.dispatch$lifecycle_runtime_release(activity, Lifecycle.Event.ON_PAUSE);
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityPreStopped(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
ReportFragment.Companion.dispatch$lifecycle_runtime_release(activity, Lifecycle.Event.ON_STOP);
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityPreDestroyed(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
ReportFragment.Companion.dispatch$lifecycle_runtime_release(activity, Lifecycle.Event.ON_DESTROY);
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final void registerIn(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
activity.registerActivityLifecycleCallbacks(new LifecycleCallbacks());
}
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public static /* synthetic */ void get$annotations(Activity activity) {
}
private Companion() {
}
public final void injectIfNeededIn(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
if (Build.VERSION.SDK_INT >= 29) {
LifecycleCallbacks.Companion.registerIn(activity);
}
FragmentManager fragmentManager = activity.getFragmentManager();
if (fragmentManager.findFragmentByTag(ReportFragment.REPORT_FRAGMENT_TAG) == null) {
fragmentManager.beginTransaction().add(new ReportFragment(), ReportFragment.REPORT_FRAGMENT_TAG).commit();
fragmentManager.executePendingTransactions();
}
}
/* JADX WARN: Multi-variable type inference failed */
public final void dispatch$lifecycle_runtime_release(Activity activity, Lifecycle.Event event) {
Intrinsics.checkNotNullParameter(activity, "activity");
Intrinsics.checkNotNullParameter(event, "event");
if (activity instanceof LifecycleRegistryOwner) {
((LifecycleRegistryOwner) activity).getLifecycle().handleLifecycleEvent(event);
} else if (activity instanceof LifecycleOwner) {
Lifecycle lifecycle = ((LifecycleOwner) activity).getLifecycle();
if (lifecycle instanceof LifecycleRegistry) {
((LifecycleRegistry) lifecycle).handleLifecycleEvent(event);
}
}
}
public final ReportFragment get(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "<this>");
Fragment findFragmentByTag = activity.getFragmentManager().findFragmentByTag(ReportFragment.REPORT_FRAGMENT_TAG);
Intrinsics.checkNotNull(findFragmentByTag, "null cannot be cast to non-null type androidx.lifecycle.ReportFragment");
return (ReportFragment) findFragmentByTag;
}
}
}

View File

@@ -0,0 +1,317 @@
package androidx.lifecycle;
import android.os.Binder;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.Size;
import android.util.SizeF;
import android.util.SparseArray;
import androidx.annotation.MainThread;
import androidx.annotation.RestrictTo;
import androidx.core.os.BundleKt;
import androidx.savedstate.SavedStateRegistry;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import kotlin.TuplesKt;
import kotlin.collections.MapsKt__MapsKt;
import kotlin.collections.SetsKt___SetsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlinx.coroutines.flow.FlowKt;
import kotlinx.coroutines.flow.MutableStateFlow;
import kotlinx.coroutines.flow.StateFlow;
import kotlinx.coroutines.flow.StateFlowKt;
@SourceDebugExtension({"SMAP\nSavedStateHandle.kt\nKotlin\n*S Kotlin\n*F\n+ 1 SavedStateHandle.kt\nandroidx/lifecycle/SavedStateHandle\n+ 2 Maps.kt\nkotlin/collections/MapsKt__MapsKt\n+ 3 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,450:1\n361#2,3:451\n364#2,4:455\n1#3:454\n*S KotlinDebug\n*F\n+ 1 SavedStateHandle.kt\nandroidx/lifecycle/SavedStateHandle\n*L\n198#1:451,3\n198#1:455,4\n*E\n"})
/* loaded from: classes.dex */
public final class SavedStateHandle {
private static final String KEYS = "keys";
private static final String VALUES = "values";
private final Map<String, MutableStateFlow> flows;
private final Map<String, SavingStateLiveData<?>> liveDatas;
private final Map<String, Object> regular;
private final SavedStateRegistry.SavedStateProvider savedStateProvider;
private final Map<String, SavedStateRegistry.SavedStateProvider> savedStateProviders;
public static final Companion Companion = new Companion(null);
private static final Class<? extends Object>[] ACCEPTABLE_CLASSES = {Boolean.TYPE, boolean[].class, Double.TYPE, double[].class, Integer.TYPE, int[].class, Long.TYPE, long[].class, String.class, String[].class, Binder.class, Bundle.class, Byte.TYPE, byte[].class, Character.TYPE, char[].class, CharSequence.class, CharSequence[].class, ArrayList.class, Float.TYPE, float[].class, Parcelable.class, Parcelable[].class, Serializable.class, Short.TYPE, short[].class, SparseArray.class, Size.class, SizeF.class};
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final SavedStateHandle createHandle(Bundle bundle, Bundle bundle2) {
return Companion.createHandle(bundle, bundle2);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public final SavedStateRegistry.SavedStateProvider savedStateProvider() {
return this.savedStateProvider;
}
/* JADX INFO: Access modifiers changed from: private */
public static final Bundle savedStateProvider$lambda$0(SavedStateHandle this$0) {
Map map;
Intrinsics.checkNotNullParameter(this$0, "this$0");
map = MapsKt__MapsKt.toMap(this$0.savedStateProviders);
for (Map.Entry entry : map.entrySet()) {
this$0.set((String) entry.getKey(), ((SavedStateRegistry.SavedStateProvider) entry.getValue()).saveState());
}
Set<String> keySet = this$0.regular.keySet();
ArrayList arrayList = new ArrayList(keySet.size());
ArrayList arrayList2 = new ArrayList(arrayList.size());
for (String str : keySet) {
arrayList.add(str);
arrayList2.add(this$0.regular.get(str));
}
return BundleKt.bundleOf(TuplesKt.to(KEYS, arrayList), TuplesKt.to(VALUES, arrayList2));
}
public SavedStateHandle(Map<String, ? extends Object> initialState) {
Intrinsics.checkNotNullParameter(initialState, "initialState");
LinkedHashMap linkedHashMap = new LinkedHashMap();
this.regular = linkedHashMap;
this.savedStateProviders = new LinkedHashMap();
this.liveDatas = new LinkedHashMap();
this.flows = new LinkedHashMap();
this.savedStateProvider = new SavedStateRegistry.SavedStateProvider() { // from class: androidx.lifecycle.SavedStateHandle$$ExternalSyntheticLambda0
@Override // androidx.savedstate.SavedStateRegistry.SavedStateProvider
public final Bundle saveState() {
Bundle savedStateProvider$lambda$0;
savedStateProvider$lambda$0 = SavedStateHandle.savedStateProvider$lambda$0(SavedStateHandle.this);
return savedStateProvider$lambda$0;
}
};
linkedHashMap.putAll(initialState);
}
public SavedStateHandle() {
this.regular = new LinkedHashMap();
this.savedStateProviders = new LinkedHashMap();
this.liveDatas = new LinkedHashMap();
this.flows = new LinkedHashMap();
this.savedStateProvider = new SavedStateRegistry.SavedStateProvider() { // from class: androidx.lifecycle.SavedStateHandle$$ExternalSyntheticLambda0
@Override // androidx.savedstate.SavedStateRegistry.SavedStateProvider
public final Bundle saveState() {
Bundle savedStateProvider$lambda$0;
savedStateProvider$lambda$0 = SavedStateHandle.savedStateProvider$lambda$0(SavedStateHandle.this);
return savedStateProvider$lambda$0;
}
};
}
@MainThread
public final boolean contains(String key) {
Intrinsics.checkNotNullParameter(key, "key");
return this.regular.containsKey(key);
}
@MainThread
public final <T> MutableLiveData<T> getLiveData(String key) {
Intrinsics.checkNotNullParameter(key, "key");
MutableLiveData<T> liveDataInternal = getLiveDataInternal(key, false, null);
Intrinsics.checkNotNull(liveDataInternal, "null cannot be cast to non-null type androidx.lifecycle.MutableLiveData<T of androidx.lifecycle.SavedStateHandle.getLiveData>");
return liveDataInternal;
}
@MainThread
public final <T> MutableLiveData<T> getLiveData(String key, T t) {
Intrinsics.checkNotNullParameter(key, "key");
return getLiveDataInternal(key, true, t);
}
private final <T> MutableLiveData<T> getLiveDataInternal(String str, boolean z, T t) {
SavingStateLiveData<?> savingStateLiveData;
SavingStateLiveData<?> savingStateLiveData2 = this.liveDatas.get(str);
SavingStateLiveData<?> savingStateLiveData3 = savingStateLiveData2 instanceof MutableLiveData ? savingStateLiveData2 : null;
if (savingStateLiveData3 != null) {
return savingStateLiveData3;
}
if (this.regular.containsKey(str)) {
savingStateLiveData = new SavingStateLiveData<>(this, str, this.regular.get(str));
} else if (z) {
this.regular.put(str, t);
savingStateLiveData = new SavingStateLiveData<>(this, str, t);
} else {
savingStateLiveData = new SavingStateLiveData<>(this, str);
}
this.liveDatas.put(str, savingStateLiveData);
return savingStateLiveData;
}
@MainThread
public final Set<String> keys() {
Set plus;
Set<String> plus2;
plus = SetsKt___SetsKt.plus((Set) this.regular.keySet(), (Iterable) this.savedStateProviders.keySet());
plus2 = SetsKt___SetsKt.plus(plus, (Iterable) this.liveDatas.keySet());
return plus2;
}
@MainThread
public final <T> T get(String key) {
Intrinsics.checkNotNullParameter(key, "key");
try {
return (T) this.regular.get(key);
} catch (ClassCastException unused) {
remove(key);
return null;
}
}
@MainThread
public final <T> void set(String key, T t) {
Intrinsics.checkNotNullParameter(key, "key");
if (!Companion.validateValue(t)) {
StringBuilder sb = new StringBuilder();
sb.append("Can't put value with type ");
Intrinsics.checkNotNull(t);
sb.append(t.getClass());
sb.append(" into saved state");
throw new IllegalArgumentException(sb.toString());
}
SavingStateLiveData<?> savingStateLiveData = this.liveDatas.get(key);
SavingStateLiveData<?> savingStateLiveData2 = savingStateLiveData instanceof MutableLiveData ? savingStateLiveData : null;
if (savingStateLiveData2 != null) {
savingStateLiveData2.setValue(t);
} else {
this.regular.put(key, t);
}
MutableStateFlow mutableStateFlow = this.flows.get(key);
if (mutableStateFlow == null) {
return;
}
mutableStateFlow.setValue(t);
}
@MainThread
public final <T> T remove(String key) {
Intrinsics.checkNotNullParameter(key, "key");
T t = (T) this.regular.remove(key);
SavingStateLiveData<?> remove = this.liveDatas.remove(key);
if (remove != null) {
remove.detach();
}
this.flows.remove(key);
return t;
}
@MainThread
public final void setSavedStateProvider(String key, SavedStateRegistry.SavedStateProvider provider) {
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(provider, "provider");
this.savedStateProviders.put(key, provider);
}
@MainThread
public final void clearSavedStateProvider(String key) {
Intrinsics.checkNotNullParameter(key, "key");
this.savedStateProviders.remove(key);
}
public static final class SavingStateLiveData<T> extends MutableLiveData<T> {
private SavedStateHandle handle;
private String key;
public final void detach() {
this.handle = null;
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public SavingStateLiveData(SavedStateHandle savedStateHandle, String key, T t) {
super(t);
Intrinsics.checkNotNullParameter(key, "key");
this.key = key;
this.handle = savedStateHandle;
}
public SavingStateLiveData(SavedStateHandle savedStateHandle, String key) {
Intrinsics.checkNotNullParameter(key, "key");
this.key = key;
this.handle = savedStateHandle;
}
@Override // androidx.lifecycle.MutableLiveData, androidx.lifecycle.LiveData
public void setValue(T t) {
SavedStateHandle savedStateHandle = this.handle;
if (savedStateHandle != null) {
savedStateHandle.regular.put(this.key, t);
MutableStateFlow mutableStateFlow = (MutableStateFlow) savedStateHandle.flows.get(this.key);
if (mutableStateFlow != null) {
mutableStateFlow.setValue(t);
}
}
super.setValue(t);
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public final SavedStateHandle createHandle(Bundle bundle, Bundle bundle2) {
if (bundle == null) {
if (bundle2 == null) {
return new SavedStateHandle();
}
HashMap hashMap = new HashMap();
for (String key : bundle2.keySet()) {
Intrinsics.checkNotNullExpressionValue(key, "key");
hashMap.put(key, bundle2.get(key));
}
return new SavedStateHandle(hashMap);
}
ArrayList parcelableArrayList = bundle.getParcelableArrayList(SavedStateHandle.KEYS);
ArrayList parcelableArrayList2 = bundle.getParcelableArrayList(SavedStateHandle.VALUES);
if (parcelableArrayList == null || parcelableArrayList2 == null || parcelableArrayList.size() != parcelableArrayList2.size()) {
throw new IllegalStateException("Invalid bundle passed as restored state".toString());
}
LinkedHashMap linkedHashMap = new LinkedHashMap();
int size = parcelableArrayList.size();
for (int i = 0; i < size; i++) {
Object obj = parcelableArrayList.get(i);
Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type kotlin.String");
linkedHashMap.put((String) obj, parcelableArrayList2.get(i));
}
return new SavedStateHandle(linkedHashMap);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public final boolean validateValue(Object obj) {
if (obj == null) {
return true;
}
for (Class cls : SavedStateHandle.ACCEPTABLE_CLASSES) {
Intrinsics.checkNotNull(cls);
if (cls.isInstance(obj)) {
return true;
}
}
return false;
}
}
@MainThread
public final <T> StateFlow getStateFlow(String key, T t) {
Intrinsics.checkNotNullParameter(key, "key");
Map<String, MutableStateFlow> map = this.flows;
MutableStateFlow mutableStateFlow = map.get(key);
if (mutableStateFlow == null) {
if (!this.regular.containsKey(key)) {
this.regular.put(key, t);
}
mutableStateFlow = StateFlowKt.MutableStateFlow(this.regular.get(key));
this.flows.put(key, mutableStateFlow);
map.put(key, mutableStateFlow);
}
StateFlow asStateFlow = FlowKt.asStateFlow(mutableStateFlow);
Intrinsics.checkNotNull(asStateFlow, "null cannot be cast to non-null type kotlinx.coroutines.flow.StateFlow<T of androidx.lifecycle.SavedStateHandle.getStateFlow>");
return asStateFlow;
}
}

View File

@@ -0,0 +1,25 @@
package androidx.lifecycle;
import androidx.lifecycle.Lifecycle;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public final class SavedStateHandleAttacher implements LifecycleEventObserver {
private final SavedStateHandlesProvider provider;
public SavedStateHandleAttacher(SavedStateHandlesProvider provider) {
Intrinsics.checkNotNullParameter(provider, "provider");
this.provider = provider;
}
@Override // androidx.lifecycle.LifecycleEventObserver
public void onStateChanged(LifecycleOwner source, Lifecycle.Event event) {
Intrinsics.checkNotNullParameter(source, "source");
Intrinsics.checkNotNullParameter(event, "event");
if (event != Lifecycle.Event.ON_CREATE) {
throw new IllegalStateException(("Next event must be ON_CREATE, it was " + event).toString());
}
source.getLifecycle().removeObserver(this);
this.provider.performRestore();
}
}

View File

@@ -0,0 +1,50 @@
package androidx.lifecycle;
import androidx.lifecycle.Lifecycle;
import androidx.savedstate.SavedStateRegistry;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
@SourceDebugExtension({"SMAP\nSavedStateHandleController.kt\nKotlin\n*S Kotlin\n*F\n+ 1 SavedStateHandleController.kt\nandroidx/lifecycle/SavedStateHandleController\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,41:1\n1#2:42\n*E\n"})
/* loaded from: classes.dex */
public final class SavedStateHandleController implements LifecycleEventObserver {
private final SavedStateHandle handle;
private boolean isAttached;
private final String key;
public final SavedStateHandle getHandle() {
return this.handle;
}
public final boolean isAttached() {
return this.isAttached;
}
public SavedStateHandleController(String key, SavedStateHandle handle) {
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(handle, "handle");
this.key = key;
this.handle = handle;
}
public final void attachToLifecycle(SavedStateRegistry registry, Lifecycle lifecycle) {
Intrinsics.checkNotNullParameter(registry, "registry");
Intrinsics.checkNotNullParameter(lifecycle, "lifecycle");
if (!(!this.isAttached)) {
throw new IllegalStateException("Already attached to lifecycleOwner".toString());
}
this.isAttached = true;
lifecycle.addObserver(this);
registry.registerSavedStateProvider(this.key, this.handle.savedStateProvider());
}
@Override // androidx.lifecycle.LifecycleEventObserver
public void onStateChanged(LifecycleOwner source, Lifecycle.Event event) {
Intrinsics.checkNotNullParameter(source, "source");
Intrinsics.checkNotNullParameter(event, "event");
if (event == Lifecycle.Event.ON_DESTROY) {
this.isAttached = false;
source.getLifecycle().removeObserver(this);
}
}
}

View File

@@ -0,0 +1,96 @@
package androidx.lifecycle;
import android.os.Bundle;
import androidx.annotation.MainThread;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.viewmodel.CreationExtras;
import androidx.lifecycle.viewmodel.InitializerViewModelFactoryBuilder;
import androidx.savedstate.SavedStateRegistry;
import androidx.savedstate.SavedStateRegistryOwner;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import kotlin.jvm.internal.SourceDebugExtension;
@SourceDebugExtension({"SMAP\nSavedStateHandleSupport.kt\nKotlin\n*S Kotlin\n*F\n+ 1 SavedStateHandleSupport.kt\nandroidx/lifecycle/SavedStateHandleSupport\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 3 InitializerViewModelFactory.kt\nandroidx/lifecycle/viewmodel/InitializerViewModelFactoryKt\n*L\n1#1,225:1\n1#2:226\n31#3:227\n63#3,2:228\n*S KotlinDebug\n*F\n+ 1 SavedStateHandleSupport.kt\nandroidx/lifecycle/SavedStateHandleSupport\n*L\n109#1:227\n110#1:228,2\n*E\n"})
/* loaded from: classes.dex */
public final class SavedStateHandleSupport {
private static final String SAVED_STATE_KEY = "androidx.lifecycle.internal.SavedStateHandlesProvider";
private static final String VIEWMODEL_KEY = "androidx.lifecycle.internal.SavedStateHandlesVM";
public static final CreationExtras.Key<SavedStateRegistryOwner> SAVED_STATE_REGISTRY_OWNER_KEY = new CreationExtras.Key<SavedStateRegistryOwner>() { // from class: androidx.lifecycle.SavedStateHandleSupport$SAVED_STATE_REGISTRY_OWNER_KEY$1
};
public static final CreationExtras.Key<ViewModelStoreOwner> VIEW_MODEL_STORE_OWNER_KEY = new CreationExtras.Key<ViewModelStoreOwner>() { // from class: androidx.lifecycle.SavedStateHandleSupport$VIEW_MODEL_STORE_OWNER_KEY$1
};
public static final CreationExtras.Key<Bundle> DEFAULT_ARGS_KEY = new CreationExtras.Key<Bundle>() { // from class: androidx.lifecycle.SavedStateHandleSupport$DEFAULT_ARGS_KEY$1
};
public static final SavedStateHandlesVM getSavedStateHandlesVM(ViewModelStoreOwner viewModelStoreOwner) {
Intrinsics.checkNotNullParameter(viewModelStoreOwner, "<this>");
InitializerViewModelFactoryBuilder initializerViewModelFactoryBuilder = new InitializerViewModelFactoryBuilder();
initializerViewModelFactoryBuilder.addInitializer(Reflection.getOrCreateKotlinClass(SavedStateHandlesVM.class), new Function1() { // from class: androidx.lifecycle.SavedStateHandleSupport$savedStateHandlesVM$1$1
@Override // kotlin.jvm.functions.Function1
public final SavedStateHandlesVM invoke(CreationExtras initializer) {
Intrinsics.checkNotNullParameter(initializer, "$this$initializer");
return new SavedStateHandlesVM();
}
});
return (SavedStateHandlesVM) new ViewModelProvider(viewModelStoreOwner, initializerViewModelFactoryBuilder.build()).get(VIEWMODEL_KEY, SavedStateHandlesVM.class);
}
/* JADX WARN: Multi-variable type inference failed */
@MainThread
public static final <T extends SavedStateRegistryOwner & ViewModelStoreOwner> void enableSavedStateHandles(T t) {
Intrinsics.checkNotNullParameter(t, "<this>");
Lifecycle.State currentState = t.getLifecycle().getCurrentState();
if (currentState != Lifecycle.State.INITIALIZED && currentState != Lifecycle.State.CREATED) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
if (t.getSavedStateRegistry().getSavedStateProvider(SAVED_STATE_KEY) == null) {
SavedStateHandlesProvider savedStateHandlesProvider = new SavedStateHandlesProvider(t.getSavedStateRegistry(), t);
t.getSavedStateRegistry().registerSavedStateProvider(SAVED_STATE_KEY, savedStateHandlesProvider);
t.getLifecycle().addObserver(new SavedStateHandleAttacher(savedStateHandlesProvider));
}
}
private static final SavedStateHandle createSavedStateHandle(SavedStateRegistryOwner savedStateRegistryOwner, ViewModelStoreOwner viewModelStoreOwner, String str, Bundle bundle) {
SavedStateHandlesProvider savedStateHandlesProvider = getSavedStateHandlesProvider(savedStateRegistryOwner);
SavedStateHandlesVM savedStateHandlesVM = getSavedStateHandlesVM(viewModelStoreOwner);
SavedStateHandle savedStateHandle = savedStateHandlesVM.getHandles().get(str);
if (savedStateHandle != null) {
return savedStateHandle;
}
SavedStateHandle createHandle = SavedStateHandle.Companion.createHandle(savedStateHandlesProvider.consumeRestoredStateForKey(str), bundle);
savedStateHandlesVM.getHandles().put(str, createHandle);
return createHandle;
}
@MainThread
public static final SavedStateHandle createSavedStateHandle(CreationExtras creationExtras) {
Intrinsics.checkNotNullParameter(creationExtras, "<this>");
SavedStateRegistryOwner savedStateRegistryOwner = (SavedStateRegistryOwner) creationExtras.get(SAVED_STATE_REGISTRY_OWNER_KEY);
if (savedStateRegistryOwner == null) {
throw new IllegalArgumentException("CreationExtras must have a value by `SAVED_STATE_REGISTRY_OWNER_KEY`");
}
ViewModelStoreOwner viewModelStoreOwner = (ViewModelStoreOwner) creationExtras.get(VIEW_MODEL_STORE_OWNER_KEY);
if (viewModelStoreOwner == null) {
throw new IllegalArgumentException("CreationExtras must have a value by `VIEW_MODEL_STORE_OWNER_KEY`");
}
Bundle bundle = (Bundle) creationExtras.get(DEFAULT_ARGS_KEY);
String str = (String) creationExtras.get(ViewModelProvider.NewInstanceFactory.VIEW_MODEL_KEY);
if (str == null) {
throw new IllegalArgumentException("CreationExtras must have a value by `VIEW_MODEL_KEY`");
}
return createSavedStateHandle(savedStateRegistryOwner, viewModelStoreOwner, str, bundle);
}
public static final SavedStateHandlesProvider getSavedStateHandlesProvider(SavedStateRegistryOwner savedStateRegistryOwner) {
Intrinsics.checkNotNullParameter(savedStateRegistryOwner, "<this>");
SavedStateRegistry.SavedStateProvider savedStateProvider = savedStateRegistryOwner.getSavedStateRegistry().getSavedStateProvider(SAVED_STATE_KEY);
SavedStateHandlesProvider savedStateHandlesProvider = savedStateProvider instanceof SavedStateHandlesProvider ? (SavedStateHandlesProvider) savedStateProvider : null;
if (savedStateHandlesProvider != null) {
return savedStateHandlesProvider;
}
throw new IllegalStateException("enableSavedStateHandles() wasn't called prior to createSavedStateHandle() call");
}
}

View File

@@ -0,0 +1,93 @@
package androidx.lifecycle;
import android.os.Bundle;
import androidx.savedstate.SavedStateRegistry;
import java.util.Map;
import kotlin.Lazy;
import kotlin.LazyKt__LazyJVMKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
@SourceDebugExtension({"SMAP\nSavedStateHandleSupport.kt\nKotlin\n*S Kotlin\n*F\n+ 1 SavedStateHandleSupport.kt\nandroidx/lifecycle/SavedStateHandlesProvider\n+ 2 _Maps.kt\nkotlin/collections/MapsKt___MapsKt\n+ 3 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,225:1\n215#2,2:226\n1#3:228\n*S KotlinDebug\n*F\n+ 1 SavedStateHandleSupport.kt\nandroidx/lifecycle/SavedStateHandlesProvider\n*L\n146#1:226,2\n*E\n"})
/* loaded from: classes.dex */
public final class SavedStateHandlesProvider implements SavedStateRegistry.SavedStateProvider {
private boolean restored;
private Bundle restoredState;
private final SavedStateRegistry savedStateRegistry;
private final Lazy viewModel$delegate;
public SavedStateHandlesProvider(SavedStateRegistry savedStateRegistry, final ViewModelStoreOwner viewModelStoreOwner) {
Lazy lazy;
Intrinsics.checkNotNullParameter(savedStateRegistry, "savedStateRegistry");
Intrinsics.checkNotNullParameter(viewModelStoreOwner, "viewModelStoreOwner");
this.savedStateRegistry = savedStateRegistry;
lazy = LazyKt__LazyJVMKt.lazy(new Function0() { // from class: androidx.lifecycle.SavedStateHandlesProvider$viewModel$2
{
super(0);
}
@Override // kotlin.jvm.functions.Function0
public final SavedStateHandlesVM invoke() {
return SavedStateHandleSupport.getSavedStateHandlesVM(ViewModelStoreOwner.this);
}
});
this.viewModel$delegate = lazy;
}
private final SavedStateHandlesVM getViewModel() {
return (SavedStateHandlesVM) this.viewModel$delegate.getValue();
}
@Override // androidx.savedstate.SavedStateRegistry.SavedStateProvider
public Bundle saveState() {
Bundle bundle = new Bundle();
Bundle bundle2 = this.restoredState;
if (bundle2 != null) {
bundle.putAll(bundle2);
}
for (Map.Entry<String, SavedStateHandle> entry : getViewModel().getHandles().entrySet()) {
String key = entry.getKey();
Bundle saveState = entry.getValue().savedStateProvider().saveState();
if (!Intrinsics.areEqual(saveState, Bundle.EMPTY)) {
bundle.putBundle(key, saveState);
}
}
this.restored = false;
return bundle;
}
public final void performRestore() {
if (this.restored) {
return;
}
Bundle consumeRestoredStateForKey = this.savedStateRegistry.consumeRestoredStateForKey("androidx.lifecycle.internal.SavedStateHandlesProvider");
Bundle bundle = new Bundle();
Bundle bundle2 = this.restoredState;
if (bundle2 != null) {
bundle.putAll(bundle2);
}
if (consumeRestoredStateForKey != null) {
bundle.putAll(consumeRestoredStateForKey);
}
this.restoredState = bundle;
this.restored = true;
getViewModel();
}
public final Bundle consumeRestoredStateForKey(String key) {
Intrinsics.checkNotNullParameter(key, "key");
performRestore();
Bundle bundle = this.restoredState;
Bundle bundle2 = bundle != null ? bundle.getBundle(key) : null;
Bundle bundle3 = this.restoredState;
if (bundle3 != null) {
bundle3.remove(key);
}
Bundle bundle4 = this.restoredState;
if (bundle4 != null && bundle4.isEmpty()) {
this.restoredState = null;
}
return bundle2;
}
}

View File

@@ -0,0 +1,13 @@
package androidx.lifecycle;
import java.util.LinkedHashMap;
import java.util.Map;
/* loaded from: classes.dex */
public final class SavedStateHandlesVM extends ViewModel {
private final Map<String, SavedStateHandle> handles = new LinkedHashMap();
public final Map<String, SavedStateHandle> getHandles() {
return this.handles;
}
}

View File

@@ -0,0 +1,145 @@
package androidx.lifecycle;
import android.annotation.SuppressLint;
import android.app.Application;
import android.os.Bundle;
import androidx.annotation.RestrictTo;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.viewmodel.CreationExtras;
import androidx.savedstate.SavedStateRegistry;
import androidx.savedstate.SavedStateRegistryOwner;
import java.lang.reflect.Constructor;
import java.util.List;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public final class SavedStateViewModelFactory extends ViewModelProvider.OnRequeryFactory implements ViewModelProvider.Factory {
private Application application;
private Bundle defaultArgs;
private final ViewModelProvider.Factory factory;
private Lifecycle lifecycle;
private SavedStateRegistry savedStateRegistry;
public SavedStateViewModelFactory() {
this.factory = new ViewModelProvider.AndroidViewModelFactory();
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public SavedStateViewModelFactory(Application application, SavedStateRegistryOwner owner) {
this(application, owner, null);
Intrinsics.checkNotNullParameter(owner, "owner");
}
@SuppressLint({"LambdaLast"})
public SavedStateViewModelFactory(Application application, SavedStateRegistryOwner owner, Bundle bundle) {
ViewModelProvider.AndroidViewModelFactory androidViewModelFactory;
Intrinsics.checkNotNullParameter(owner, "owner");
this.savedStateRegistry = owner.getSavedStateRegistry();
this.lifecycle = owner.getLifecycle();
this.defaultArgs = bundle;
this.application = application;
if (application != null) {
androidViewModelFactory = ViewModelProvider.AndroidViewModelFactory.Companion.getInstance(application);
} else {
androidViewModelFactory = new ViewModelProvider.AndroidViewModelFactory();
}
this.factory = androidViewModelFactory;
}
@Override // androidx.lifecycle.ViewModelProvider.Factory
public <T extends ViewModel> T create(Class<T> modelClass, CreationExtras extras) {
List list;
Constructor findMatchingConstructor;
List list2;
Intrinsics.checkNotNullParameter(modelClass, "modelClass");
Intrinsics.checkNotNullParameter(extras, "extras");
String str = (String) extras.get(ViewModelProvider.NewInstanceFactory.VIEW_MODEL_KEY);
if (str == null) {
throw new IllegalStateException("VIEW_MODEL_KEY must always be provided by ViewModelProvider");
}
if (extras.get(SavedStateHandleSupport.SAVED_STATE_REGISTRY_OWNER_KEY) == null || extras.get(SavedStateHandleSupport.VIEW_MODEL_STORE_OWNER_KEY) == null) {
if (this.lifecycle != null) {
return (T) create(str, modelClass);
}
throw new IllegalStateException("SAVED_STATE_REGISTRY_OWNER_KEY andVIEW_MODEL_STORE_OWNER_KEY must be provided in the creation extras tosuccessfully create a ViewModel.");
}
Application application = (Application) extras.get(ViewModelProvider.AndroidViewModelFactory.APPLICATION_KEY);
boolean isAssignableFrom = AndroidViewModel.class.isAssignableFrom(modelClass);
if (isAssignableFrom && application != null) {
list2 = SavedStateViewModelFactoryKt.ANDROID_VIEWMODEL_SIGNATURE;
findMatchingConstructor = SavedStateViewModelFactoryKt.findMatchingConstructor(modelClass, list2);
} else {
list = SavedStateViewModelFactoryKt.VIEWMODEL_SIGNATURE;
findMatchingConstructor = SavedStateViewModelFactoryKt.findMatchingConstructor(modelClass, list);
}
if (findMatchingConstructor == null) {
return (T) this.factory.create(modelClass, extras);
}
if (isAssignableFrom && application != null) {
return (T) SavedStateViewModelFactoryKt.newInstance(modelClass, findMatchingConstructor, application, SavedStateHandleSupport.createSavedStateHandle(extras));
}
return (T) SavedStateViewModelFactoryKt.newInstance(modelClass, findMatchingConstructor, SavedStateHandleSupport.createSavedStateHandle(extras));
}
public final <T extends ViewModel> T create(String key, Class<T> modelClass) {
List list;
Constructor findMatchingConstructor;
T t;
Application application;
List list2;
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(modelClass, "modelClass");
Lifecycle lifecycle = this.lifecycle;
if (lifecycle == null) {
throw new UnsupportedOperationException("SavedStateViewModelFactory constructed with empty constructor supports only calls to create(modelClass: Class<T>, extras: CreationExtras).");
}
boolean isAssignableFrom = AndroidViewModel.class.isAssignableFrom(modelClass);
if (isAssignableFrom && this.application != null) {
list2 = SavedStateViewModelFactoryKt.ANDROID_VIEWMODEL_SIGNATURE;
findMatchingConstructor = SavedStateViewModelFactoryKt.findMatchingConstructor(modelClass, list2);
} else {
list = SavedStateViewModelFactoryKt.VIEWMODEL_SIGNATURE;
findMatchingConstructor = SavedStateViewModelFactoryKt.findMatchingConstructor(modelClass, list);
}
if (findMatchingConstructor == null) {
if (this.application != null) {
return (T) this.factory.create(modelClass);
}
return (T) ViewModelProvider.NewInstanceFactory.Companion.getInstance().create(modelClass);
}
SavedStateRegistry savedStateRegistry = this.savedStateRegistry;
Intrinsics.checkNotNull(savedStateRegistry);
SavedStateHandleController create = LegacySavedStateHandleController.create(savedStateRegistry, lifecycle, key, this.defaultArgs);
if (isAssignableFrom && (application = this.application) != null) {
Intrinsics.checkNotNull(application);
t = (T) SavedStateViewModelFactoryKt.newInstance(modelClass, findMatchingConstructor, application, create.getHandle());
} else {
t = (T) SavedStateViewModelFactoryKt.newInstance(modelClass, findMatchingConstructor, create.getHandle());
}
t.setTagIfAbsent("androidx.lifecycle.savedstate.vm.tag", create);
return t;
}
@Override // androidx.lifecycle.ViewModelProvider.Factory
public <T extends ViewModel> T create(Class<T> modelClass) {
Intrinsics.checkNotNullParameter(modelClass, "modelClass");
String canonicalName = modelClass.getCanonicalName();
if (canonicalName == null) {
throw new IllegalArgumentException("Local and anonymous classes can not be ViewModels");
}
return (T) create(canonicalName, modelClass);
}
@Override // androidx.lifecycle.ViewModelProvider.OnRequeryFactory
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public void onRequery(ViewModel viewModel) {
Intrinsics.checkNotNullParameter(viewModel, "viewModel");
if (this.lifecycle != null) {
SavedStateRegistry savedStateRegistry = this.savedStateRegistry;
Intrinsics.checkNotNull(savedStateRegistry);
Lifecycle lifecycle = this.lifecycle;
Intrinsics.checkNotNull(lifecycle);
LegacySavedStateHandleController.attachHandleIfNeeded(viewModel, savedStateRegistry, lifecycle);
}
}
}

View File

@@ -0,0 +1,63 @@
package androidx.lifecycle;
import android.app.Application;
import androidx.annotation.RestrictTo;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.List;
import kotlin.collections.ArraysKt___ArraysKt;
import kotlin.collections.CollectionsKt__CollectionsJVMKt;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* loaded from: classes.dex */
public final class SavedStateViewModelFactoryKt {
private static final List<Class<?>> ANDROID_VIEWMODEL_SIGNATURE;
private static final List<Class<?>> VIEWMODEL_SIGNATURE;
public static final <T extends ViewModel> T newInstance(Class<T> modelClass, Constructor<T> constructor, Object... params) {
Intrinsics.checkNotNullParameter(modelClass, "modelClass");
Intrinsics.checkNotNullParameter(constructor, "constructor");
Intrinsics.checkNotNullParameter(params, "params");
try {
return constructor.newInstance(Arrays.copyOf(params, params.length));
} catch (IllegalAccessException e) {
throw new RuntimeException("Failed to access " + modelClass, e);
} catch (InstantiationException e2) {
throw new RuntimeException("A " + modelClass + " cannot be instantiated.", e2);
} catch (InvocationTargetException e3) {
throw new RuntimeException("An exception happened in constructor of " + modelClass, e3.getCause());
}
}
static {
List<Class<?>> listOf;
listOf = CollectionsKt__CollectionsKt.listOf((Object[]) new Class[]{Application.class, SavedStateHandle.class});
ANDROID_VIEWMODEL_SIGNATURE = listOf;
VIEWMODEL_SIGNATURE = CollectionsKt__CollectionsJVMKt.listOf(SavedStateHandle.class);
}
public static final <T> Constructor<T> findMatchingConstructor(Class<T> modelClass, List<? extends Class<?>> signature) {
List list;
Intrinsics.checkNotNullParameter(modelClass, "modelClass");
Intrinsics.checkNotNullParameter(signature, "signature");
Object[] constructors = modelClass.getConstructors();
Intrinsics.checkNotNullExpressionValue(constructors, "modelClass.constructors");
for (Object obj : constructors) {
Constructor<T> constructor = (Constructor<T>) obj;
Class<?>[] parameterTypes = constructor.getParameterTypes();
Intrinsics.checkNotNullExpressionValue(parameterTypes, "constructor.parameterTypes");
list = ArraysKt___ArraysKt.toList(parameterTypes);
if (Intrinsics.areEqual(signature, list)) {
Intrinsics.checkNotNull(constructor, "null cannot be cast to non-null type java.lang.reflect.Constructor<T of androidx.lifecycle.SavedStateViewModelFactoryKt.findMatchingConstructor>");
return constructor;
}
if (signature.size() == list.size() && list.containsAll(signature)) {
throw new UnsupportedOperationException("Class " + modelClass.getSimpleName() + " must have parameters in the proper order: " + signature);
}
}
return null;
}
}

View File

@@ -0,0 +1,77 @@
package androidx.lifecycle;
import android.os.Handler;
import androidx.lifecycle.Lifecycle;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public class ServiceLifecycleDispatcher {
private final Handler handler;
private DispatchRunnable lastDispatchRunnable;
private final LifecycleRegistry registry;
public Lifecycle getLifecycle() {
return this.registry;
}
public ServiceLifecycleDispatcher(LifecycleOwner provider) {
Intrinsics.checkNotNullParameter(provider, "provider");
this.registry = new LifecycleRegistry(provider);
this.handler = new Handler();
}
private final void postDispatchRunnable(Lifecycle.Event event) {
DispatchRunnable dispatchRunnable = this.lastDispatchRunnable;
if (dispatchRunnable != null) {
dispatchRunnable.run();
}
DispatchRunnable dispatchRunnable2 = new DispatchRunnable(this.registry, event);
this.lastDispatchRunnable = dispatchRunnable2;
Handler handler = this.handler;
Intrinsics.checkNotNull(dispatchRunnable2);
handler.postAtFrontOfQueue(dispatchRunnable2);
}
public void onServicePreSuperOnCreate() {
postDispatchRunnable(Lifecycle.Event.ON_CREATE);
}
public void onServicePreSuperOnBind() {
postDispatchRunnable(Lifecycle.Event.ON_START);
}
public void onServicePreSuperOnStart() {
postDispatchRunnable(Lifecycle.Event.ON_START);
}
public void onServicePreSuperOnDestroy() {
postDispatchRunnable(Lifecycle.Event.ON_STOP);
postDispatchRunnable(Lifecycle.Event.ON_DESTROY);
}
public static final class DispatchRunnable implements Runnable {
private final Lifecycle.Event event;
private final LifecycleRegistry registry;
private boolean wasExecuted;
public final Lifecycle.Event getEvent() {
return this.event;
}
public DispatchRunnable(LifecycleRegistry registry, Lifecycle.Event event) {
Intrinsics.checkNotNullParameter(registry, "registry");
Intrinsics.checkNotNullParameter(event, "event");
this.registry = registry;
this.event = event;
}
@Override // java.lang.Runnable
public void run() {
if (this.wasExecuted) {
return;
}
this.registry.handleLifecycleEvent(this.event);
this.wasExecuted = true;
}
}
}

View File

@@ -0,0 +1,22 @@
package androidx.lifecycle;
import androidx.lifecycle.Lifecycle;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public final class SingleGeneratedAdapterObserver implements LifecycleEventObserver {
private final GeneratedAdapter generatedAdapter;
public SingleGeneratedAdapterObserver(GeneratedAdapter generatedAdapter) {
Intrinsics.checkNotNullParameter(generatedAdapter, "generatedAdapter");
this.generatedAdapter = generatedAdapter;
}
@Override // androidx.lifecycle.LifecycleEventObserver
public void onStateChanged(LifecycleOwner source, Lifecycle.Event event) {
Intrinsics.checkNotNullParameter(source, "source");
Intrinsics.checkNotNullParameter(event, "event");
this.generatedAdapter.callMethods(source, event, false, null);
this.generatedAdapter.callMethods(source, event, true, null);
}
}

View File

@@ -0,0 +1,37 @@
package androidx.lifecycle;
import kotlin.Function;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.FunctionAdapter;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public final class Transformations$sam$androidx_lifecycle_Observer$0 implements Observer, FunctionAdapter {
private final /* synthetic */ Function1 function;
public Transformations$sam$androidx_lifecycle_Observer$0(Function1 function) {
Intrinsics.checkNotNullParameter(function, "function");
this.function = function;
}
public final boolean equals(Object obj) {
if ((obj instanceof Observer) && (obj instanceof FunctionAdapter)) {
return Intrinsics.areEqual(getFunctionDelegate(), ((FunctionAdapter) obj).getFunctionDelegate());
}
return false;
}
@Override // kotlin.jvm.internal.FunctionAdapter
public final Function getFunctionDelegate() {
return this.function;
}
public final int hashCode() {
return getFunctionDelegate().hashCode();
}
@Override // androidx.lifecycle.Observer
public final /* synthetic */ void onChanged(Object obj) {
this.function.invoke(obj);
}
}

View File

@@ -0,0 +1,213 @@
package androidx.lifecycle;
import androidx.annotation.CheckResult;
import androidx.annotation.MainThread;
import androidx.arch.core.util.Function;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Ref;
/* loaded from: classes.dex */
public final class Transformations {
@CheckResult
@MainThread
public static final <X, Y> LiveData<Y> map(LiveData<X> liveData, final Function1 transform) {
Intrinsics.checkNotNullParameter(liveData, "<this>");
Intrinsics.checkNotNullParameter(transform, "transform");
final MediatorLiveData mediatorLiveData = new MediatorLiveData();
mediatorLiveData.addSource(liveData, new Transformations$sam$androidx_lifecycle_Observer$0(new Function1() { // from class: androidx.lifecycle.Transformations$map$1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Object invoke(Object obj) {
m159invoke((Transformations$map$1) obj);
return Unit.INSTANCE;
}
/* renamed from: invoke, reason: collision with other method in class */
public final void m159invoke(X x) {
mediatorLiveData.setValue(transform.invoke(x));
}
}));
return mediatorLiveData;
}
@CheckResult
@MainThread
public static final /* synthetic */ LiveData map(LiveData liveData, final Function mapFunction) {
Intrinsics.checkNotNullParameter(liveData, "<this>");
Intrinsics.checkNotNullParameter(mapFunction, "mapFunction");
final MediatorLiveData mediatorLiveData = new MediatorLiveData();
mediatorLiveData.addSource(liveData, new Transformations$sam$androidx_lifecycle_Observer$0(new Function1() { // from class: androidx.lifecycle.Transformations$map$2
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Object invoke(Object obj) {
m160invoke(obj);
return Unit.INSTANCE;
}
/* renamed from: invoke, reason: collision with other method in class */
public final void m160invoke(Object obj) {
MediatorLiveData.this.setValue(mapFunction.apply(obj));
}
}));
return mediatorLiveData;
}
@CheckResult
@MainThread
public static final <X, Y> LiveData<Y> switchMap(LiveData<X> liveData, final Function1 transform) {
Intrinsics.checkNotNullParameter(liveData, "<this>");
Intrinsics.checkNotNullParameter(transform, "transform");
final MediatorLiveData mediatorLiveData = new MediatorLiveData();
mediatorLiveData.addSource(liveData, new Observer<X>() { // from class: androidx.lifecycle.Transformations$switchMap$1
private LiveData<Y> liveData;
public final LiveData<Y> getLiveData() {
return this.liveData;
}
public final void setLiveData(LiveData<Y> liveData2) {
this.liveData = liveData2;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // androidx.lifecycle.Observer
public void onChanged(X x) {
LiveData<Y> liveData2 = (LiveData) Function1.this.invoke(x);
Object obj = this.liveData;
if (obj == liveData2) {
return;
}
if (obj != null) {
MediatorLiveData<Y> mediatorLiveData2 = mediatorLiveData;
Intrinsics.checkNotNull(obj);
mediatorLiveData2.removeSource(obj);
}
this.liveData = liveData2;
if (liveData2 != 0) {
MediatorLiveData<Y> mediatorLiveData3 = mediatorLiveData;
Intrinsics.checkNotNull(liveData2);
final MediatorLiveData<Y> mediatorLiveData4 = mediatorLiveData;
mediatorLiveData3.addSource(liveData2, new Transformations$sam$androidx_lifecycle_Observer$0(new Function1() { // from class: androidx.lifecycle.Transformations$switchMap$1$onChanged$1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Object invoke(Object obj2) {
m161invoke((Transformations$switchMap$1$onChanged$1) obj2);
return Unit.INSTANCE;
}
/* renamed from: invoke, reason: collision with other method in class */
public final void m161invoke(Y y) {
mediatorLiveData4.setValue(y);
}
}));
}
}
});
return mediatorLiveData;
}
@CheckResult
@MainThread
public static final /* synthetic */ LiveData switchMap(LiveData liveData, final Function switchMapFunction) {
Intrinsics.checkNotNullParameter(liveData, "<this>");
Intrinsics.checkNotNullParameter(switchMapFunction, "switchMapFunction");
final MediatorLiveData mediatorLiveData = new MediatorLiveData();
mediatorLiveData.addSource(liveData, new Observer() { // from class: androidx.lifecycle.Transformations$switchMap$2
private LiveData liveData;
public final LiveData getLiveData() {
return this.liveData;
}
public final void setLiveData(LiveData liveData2) {
this.liveData = liveData2;
}
@Override // androidx.lifecycle.Observer
public void onChanged(Object obj) {
LiveData liveData2 = (LiveData) Function.this.apply(obj);
LiveData liveData3 = this.liveData;
if (liveData3 == liveData2) {
return;
}
if (liveData3 != null) {
MediatorLiveData mediatorLiveData2 = mediatorLiveData;
Intrinsics.checkNotNull(liveData3);
mediatorLiveData2.removeSource(liveData3);
}
this.liveData = liveData2;
if (liveData2 != null) {
MediatorLiveData mediatorLiveData3 = mediatorLiveData;
Intrinsics.checkNotNull(liveData2);
final MediatorLiveData mediatorLiveData4 = mediatorLiveData;
mediatorLiveData3.addSource(liveData2, new Transformations$sam$androidx_lifecycle_Observer$0(new Function1() { // from class: androidx.lifecycle.Transformations$switchMap$2$onChanged$1
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Object invoke(Object obj2) {
m162invoke(obj2);
return Unit.INSTANCE;
}
/* renamed from: invoke, reason: collision with other method in class */
public final void m162invoke(Object obj2) {
MediatorLiveData.this.setValue(obj2);
}
}));
}
}
});
return mediatorLiveData;
}
@CheckResult
@MainThread
public static final <X> LiveData<X> distinctUntilChanged(LiveData<X> liveData) {
Intrinsics.checkNotNullParameter(liveData, "<this>");
final MediatorLiveData mediatorLiveData = new MediatorLiveData();
final Ref.BooleanRef booleanRef = new Ref.BooleanRef();
booleanRef.element = true;
if (liveData.isInitialized()) {
mediatorLiveData.setValue(liveData.getValue());
booleanRef.element = false;
}
mediatorLiveData.addSource(liveData, new Transformations$sam$androidx_lifecycle_Observer$0(new Function1() { // from class: androidx.lifecycle.Transformations$distinctUntilChanged$1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Object invoke(Object obj) {
m158invoke((Transformations$distinctUntilChanged$1) obj);
return Unit.INSTANCE;
}
/* renamed from: invoke, reason: collision with other method in class */
public final void m158invoke(X x) {
Object value = mediatorLiveData.getValue();
if (booleanRef.element || ((value == null && x != 0) || !(value == null || Intrinsics.areEqual(value, x)))) {
booleanRef.element = false;
mediatorLiveData.setValue(x);
}
}
}));
return mediatorLiveData;
}
}

View File

@@ -0,0 +1,124 @@
package androidx.lifecycle;
import androidx.annotation.MainThread;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.io.Closeable;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
public abstract class ViewModel {
@Nullable
private final Map<String, Object> mBagOfTags;
private volatile boolean mCleared;
@Nullable
private final Set<Closeable> mCloseables;
public void onCleared() {
}
public ViewModel() {
this.mBagOfTags = new HashMap();
this.mCloseables = new LinkedHashSet();
this.mCleared = false;
}
public ViewModel(@NonNull Closeable... closeableArr) {
this.mBagOfTags = new HashMap();
LinkedHashSet linkedHashSet = new LinkedHashSet();
this.mCloseables = linkedHashSet;
this.mCleared = false;
linkedHashSet.addAll(Arrays.asList(closeableArr));
}
public void addCloseable(@NonNull Closeable closeable) {
Set<Closeable> set = this.mCloseables;
if (set != null) {
synchronized (set) {
this.mCloseables.add(closeable);
}
}
}
@MainThread
public final void clear() {
this.mCleared = true;
Map<String, Object> map = this.mBagOfTags;
if (map != null) {
synchronized (map) {
try {
Iterator<Object> it = this.mBagOfTags.values().iterator();
while (it.hasNext()) {
closeWithRuntimeException(it.next());
}
} finally {
}
}
}
Set<Closeable> set = this.mCloseables;
if (set != null) {
synchronized (set) {
try {
Iterator<Closeable> it2 = this.mCloseables.iterator();
while (it2.hasNext()) {
closeWithRuntimeException(it2.next());
}
} finally {
}
}
}
onCleared();
}
/* JADX WARN: Multi-variable type inference failed */
public <T> T setTagIfAbsent(String str, T t) {
Object obj;
synchronized (this.mBagOfTags) {
try {
obj = this.mBagOfTags.get(str);
if (obj == 0) {
this.mBagOfTags.put(str, t);
}
} catch (Throwable th) {
throw th;
}
}
if (obj != 0) {
t = obj;
}
if (this.mCleared) {
closeWithRuntimeException(t);
}
return t;
}
public <T> T getTag(String str) {
T t;
Map<String, Object> map = this.mBagOfTags;
if (map == null) {
return null;
}
synchronized (map) {
t = (T) this.mBagOfTags.get(str);
}
return t;
}
private static void closeWithRuntimeException(Object obj) {
if (obj instanceof Closeable) {
try {
((Closeable) obj).close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
}

View File

@@ -0,0 +1,64 @@
package androidx.lifecycle;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.viewmodel.CreationExtras;
import kotlin.Lazy;
import kotlin.jvm.JvmClassMappingKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.reflect.KClass;
/* loaded from: classes.dex */
public final class ViewModelLazy<VM extends ViewModel> implements Lazy {
private VM cached;
private final Function0 extrasProducer;
private final Function0 factoryProducer;
private final Function0 storeProducer;
private final KClass viewModelClass;
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public ViewModelLazy(KClass viewModelClass, Function0 storeProducer, Function0 factoryProducer) {
this(viewModelClass, storeProducer, factoryProducer, null, 8, null);
Intrinsics.checkNotNullParameter(viewModelClass, "viewModelClass");
Intrinsics.checkNotNullParameter(storeProducer, "storeProducer");
Intrinsics.checkNotNullParameter(factoryProducer, "factoryProducer");
}
@Override // kotlin.Lazy
public boolean isInitialized() {
return this.cached != null;
}
public ViewModelLazy(KClass viewModelClass, Function0 storeProducer, Function0 factoryProducer, Function0 extrasProducer) {
Intrinsics.checkNotNullParameter(viewModelClass, "viewModelClass");
Intrinsics.checkNotNullParameter(storeProducer, "storeProducer");
Intrinsics.checkNotNullParameter(factoryProducer, "factoryProducer");
Intrinsics.checkNotNullParameter(extrasProducer, "extrasProducer");
this.viewModelClass = viewModelClass;
this.storeProducer = storeProducer;
this.factoryProducer = factoryProducer;
this.extrasProducer = extrasProducer;
}
public /* synthetic */ ViewModelLazy(KClass kClass, Function0 function0, Function0 function02, Function0 function03, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(kClass, function0, function02, (i & 8) != 0 ? new Function0() { // from class: androidx.lifecycle.ViewModelLazy.1
@Override // kotlin.jvm.functions.Function0
public final CreationExtras.Empty invoke() {
return CreationExtras.Empty.INSTANCE;
}
} : function03);
}
@Override // kotlin.Lazy
public VM getValue() {
VM vm = this.cached;
if (vm != null) {
return vm;
}
VM vm2 = (VM) new ViewModelProvider((ViewModelStore) this.storeProducer.invoke(), (ViewModelProvider.Factory) this.factoryProducer.invoke(), (CreationExtras) this.extrasProducer.invoke()).get(JvmClassMappingKt.getJavaClass(this.viewModelClass));
this.cached = vm2;
return vm2;
}
}

View File

@@ -0,0 +1,289 @@
package androidx.lifecycle;
import android.app.Application;
import androidx.annotation.MainThread;
import androidx.annotation.RestrictTo;
import androidx.lifecycle.viewmodel.CreationExtras;
import androidx.lifecycle.viewmodel.InitializerViewModelFactory;
import androidx.lifecycle.viewmodel.MutableCreationExtras;
import androidx.lifecycle.viewmodel.ViewModelInitializer;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
@SourceDebugExtension({"SMAP\nViewModelProvider.kt\nKotlin\n*S Kotlin\n*F\n+ 1 ViewModelProvider.kt\nandroidx/lifecycle/ViewModelProvider\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,375:1\n1#2:376\n*E\n"})
/* loaded from: classes.dex */
public class ViewModelProvider {
private final CreationExtras defaultCreationExtras;
private final Factory factory;
private final ViewModelStore store;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static class OnRequeryFactory {
public void onRequery(ViewModel viewModel) {
Intrinsics.checkNotNullParameter(viewModel, "viewModel");
}
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public ViewModelProvider(ViewModelStore store, Factory factory) {
this(store, factory, null, 4, null);
Intrinsics.checkNotNullParameter(store, "store");
Intrinsics.checkNotNullParameter(factory, "factory");
}
public ViewModelProvider(ViewModelStore store, Factory factory, CreationExtras defaultCreationExtras) {
Intrinsics.checkNotNullParameter(store, "store");
Intrinsics.checkNotNullParameter(factory, "factory");
Intrinsics.checkNotNullParameter(defaultCreationExtras, "defaultCreationExtras");
this.store = store;
this.factory = factory;
this.defaultCreationExtras = defaultCreationExtras;
}
public /* synthetic */ ViewModelProvider(ViewModelStore viewModelStore, Factory factory, CreationExtras creationExtras, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(viewModelStore, factory, (i & 4) != 0 ? CreationExtras.Empty.INSTANCE : creationExtras);
}
public interface Factory {
public static final Companion Companion = Companion.$$INSTANCE;
static Factory from(ViewModelInitializer<?>... viewModelInitializerArr) {
return Companion.from(viewModelInitializerArr);
}
default <T extends ViewModel> T create(Class<T> modelClass) {
Intrinsics.checkNotNullParameter(modelClass, "modelClass");
throw new UnsupportedOperationException("Factory.create(String) is unsupported. This Factory requires `CreationExtras` to be passed into `create` method.");
}
default <T extends ViewModel> T create(Class<T> modelClass, CreationExtras extras) {
Intrinsics.checkNotNullParameter(modelClass, "modelClass");
Intrinsics.checkNotNullParameter(extras, "extras");
return (T) create(modelClass);
}
public static final class Companion {
static final /* synthetic */ Companion $$INSTANCE = new Companion();
private Companion() {
}
public final Factory from(ViewModelInitializer<?>... initializers) {
Intrinsics.checkNotNullParameter(initializers, "initializers");
return new InitializerViewModelFactory((ViewModelInitializer[]) Arrays.copyOf(initializers, initializers.length));
}
}
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public ViewModelProvider(ViewModelStoreOwner owner) {
this(owner.getViewModelStore(), AndroidViewModelFactory.Companion.defaultFactory$lifecycle_viewmodel_release(owner), ViewModelProviderGetKt.defaultCreationExtras(owner));
Intrinsics.checkNotNullParameter(owner, "owner");
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public ViewModelProvider(ViewModelStoreOwner owner, Factory factory) {
this(owner.getViewModelStore(), factory, ViewModelProviderGetKt.defaultCreationExtras(owner));
Intrinsics.checkNotNullParameter(owner, "owner");
Intrinsics.checkNotNullParameter(factory, "factory");
}
@MainThread
public <T extends ViewModel> T get(Class<T> modelClass) {
Intrinsics.checkNotNullParameter(modelClass, "modelClass");
String canonicalName = modelClass.getCanonicalName();
if (canonicalName == null) {
throw new IllegalArgumentException("Local and anonymous classes can not be ViewModels");
}
return (T) get("androidx.lifecycle.ViewModelProvider.DefaultKey:" + canonicalName, modelClass);
}
@MainThread
public <T extends ViewModel> T get(String key, Class<T> modelClass) {
T t;
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(modelClass, "modelClass");
T t2 = (T) this.store.get(key);
if (modelClass.isInstance(t2)) {
Object obj = this.factory;
OnRequeryFactory onRequeryFactory = obj instanceof OnRequeryFactory ? (OnRequeryFactory) obj : null;
if (onRequeryFactory != null) {
Intrinsics.checkNotNull(t2);
onRequeryFactory.onRequery(t2);
}
Intrinsics.checkNotNull(t2, "null cannot be cast to non-null type T of androidx.lifecycle.ViewModelProvider.get");
return t2;
}
MutableCreationExtras mutableCreationExtras = new MutableCreationExtras(this.defaultCreationExtras);
mutableCreationExtras.set(NewInstanceFactory.VIEW_MODEL_KEY, key);
try {
t = (T) this.factory.create(modelClass, mutableCreationExtras);
} catch (AbstractMethodError unused) {
t = (T) this.factory.create(modelClass);
}
this.store.put(key, t);
return t;
}
public static class NewInstanceFactory implements Factory {
public static final Companion Companion = new Companion(null);
public static final CreationExtras.Key<String> VIEW_MODEL_KEY = Companion.ViewModelKeyImpl.INSTANCE;
private static NewInstanceFactory sInstance;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final NewInstanceFactory getInstance() {
return Companion.getInstance();
}
@Override // androidx.lifecycle.ViewModelProvider.Factory
public <T extends ViewModel> T create(Class<T> modelClass) {
Intrinsics.checkNotNullParameter(modelClass, "modelClass");
try {
T newInstance = modelClass.getDeclaredConstructor(new Class[0]).newInstance(new Object[0]);
Intrinsics.checkNotNullExpressionValue(newInstance, "{\n modelC…wInstance()\n }");
return newInstance;
} catch (IllegalAccessException e) {
throw new RuntimeException("Cannot create an instance of " + modelClass, e);
} catch (InstantiationException e2) {
throw new RuntimeException("Cannot create an instance of " + modelClass, e2);
} catch (NoSuchMethodException e3) {
throw new RuntimeException("Cannot create an instance of " + modelClass, e3);
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public static /* synthetic */ void getInstance$annotations() {
}
private Companion() {
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public final NewInstanceFactory getInstance() {
if (NewInstanceFactory.sInstance == null) {
NewInstanceFactory.sInstance = new NewInstanceFactory();
}
NewInstanceFactory newInstanceFactory = NewInstanceFactory.sInstance;
Intrinsics.checkNotNull(newInstanceFactory);
return newInstanceFactory;
}
public static final class ViewModelKeyImpl implements CreationExtras.Key<String> {
public static final ViewModelKeyImpl INSTANCE = new ViewModelKeyImpl();
private ViewModelKeyImpl() {
}
}
}
}
public static class AndroidViewModelFactory extends NewInstanceFactory {
public static final String DEFAULT_KEY = "androidx.lifecycle.ViewModelProvider.DefaultKey";
private static AndroidViewModelFactory sInstance;
private final Application application;
public static final Companion Companion = new Companion(null);
public static final CreationExtras.Key<Application> APPLICATION_KEY = Companion.ApplicationKeyImpl.INSTANCE;
public static final AndroidViewModelFactory getInstance(Application application) {
return Companion.getInstance(application);
}
private AndroidViewModelFactory(Application application, int i) {
this.application = application;
}
public AndroidViewModelFactory() {
this(null, 0);
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public AndroidViewModelFactory(Application application) {
this(application, 0);
Intrinsics.checkNotNullParameter(application, "application");
}
@Override // androidx.lifecycle.ViewModelProvider.Factory
public <T extends ViewModel> T create(Class<T> modelClass, CreationExtras extras) {
Intrinsics.checkNotNullParameter(modelClass, "modelClass");
Intrinsics.checkNotNullParameter(extras, "extras");
if (this.application != null) {
return (T) create(modelClass);
}
Application application = (Application) extras.get(APPLICATION_KEY);
if (application != null) {
return (T) create(modelClass, application);
}
if (AndroidViewModel.class.isAssignableFrom(modelClass)) {
throw new IllegalArgumentException("CreationExtras must have an application by `APPLICATION_KEY`");
}
return (T) super.create(modelClass);
}
@Override // androidx.lifecycle.ViewModelProvider.NewInstanceFactory, androidx.lifecycle.ViewModelProvider.Factory
public <T extends ViewModel> T create(Class<T> modelClass) {
Intrinsics.checkNotNullParameter(modelClass, "modelClass");
Application application = this.application;
if (application == null) {
throw new UnsupportedOperationException("AndroidViewModelFactory constructed with empty constructor works only with create(modelClass: Class<T>, extras: CreationExtras).");
}
return (T) create(modelClass, application);
}
private final <T extends ViewModel> T create(Class<T> cls, Application application) {
if (AndroidViewModel.class.isAssignableFrom(cls)) {
try {
T newInstance = cls.getConstructor(Application.class).newInstance(application);
Intrinsics.checkNotNullExpressionValue(newInstance, "{\n try {\n… }\n }");
return newInstance;
} catch (IllegalAccessException e) {
throw new RuntimeException("Cannot create an instance of " + cls, e);
} catch (InstantiationException e2) {
throw new RuntimeException("Cannot create an instance of " + cls, e2);
} catch (NoSuchMethodException e3) {
throw new RuntimeException("Cannot create an instance of " + cls, e3);
} catch (InvocationTargetException e4) {
throw new RuntimeException("Cannot create an instance of " + cls, e4);
}
}
return (T) super.create(cls);
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final Factory defaultFactory$lifecycle_viewmodel_release(ViewModelStoreOwner owner) {
Intrinsics.checkNotNullParameter(owner, "owner");
return owner instanceof HasDefaultViewModelProviderFactory ? ((HasDefaultViewModelProviderFactory) owner).getDefaultViewModelProviderFactory() : NewInstanceFactory.Companion.getInstance();
}
public final AndroidViewModelFactory getInstance(Application application) {
Intrinsics.checkNotNullParameter(application, "application");
if (AndroidViewModelFactory.sInstance == null) {
AndroidViewModelFactory.sInstance = new AndroidViewModelFactory(application);
}
AndroidViewModelFactory androidViewModelFactory = AndroidViewModelFactory.sInstance;
Intrinsics.checkNotNull(androidViewModelFactory);
return androidViewModelFactory;
}
public static final class ApplicationKeyImpl implements CreationExtras.Key<Application> {
public static final ApplicationKeyImpl INSTANCE = new ApplicationKeyImpl();
private ApplicationKeyImpl() {
}
}
}
}
}

View File

@@ -0,0 +1,23 @@
package androidx.lifecycle;
import androidx.annotation.MainThread;
import androidx.lifecycle.viewmodel.CreationExtras;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public final class ViewModelProviderGetKt {
public static final CreationExtras defaultCreationExtras(ViewModelStoreOwner owner) {
Intrinsics.checkNotNullParameter(owner, "owner");
if (owner instanceof HasDefaultViewModelProviderFactory) {
return ((HasDefaultViewModelProviderFactory) owner).getDefaultViewModelCreationExtras();
}
return CreationExtras.Empty.INSTANCE;
}
@MainThread
public static final /* synthetic */ <VM extends ViewModel> VM get(ViewModelProvider viewModelProvider) {
Intrinsics.checkNotNullParameter(viewModelProvider, "<this>");
Intrinsics.reifiedOperationMarker(4, "VM");
return (VM) viewModelProvider.get(ViewModel.class);
}
}

View File

@@ -0,0 +1,43 @@
package androidx.lifecycle;
import androidx.annotation.RestrictTo;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public class ViewModelStore {
private final Map<String, ViewModel> map = new LinkedHashMap();
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public final void put(String key, ViewModel viewModel) {
Intrinsics.checkNotNullParameter(key, "key");
Intrinsics.checkNotNullParameter(viewModel, "viewModel");
ViewModel put = this.map.put(key, viewModel);
if (put != null) {
put.onCleared();
}
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public final ViewModel get(String key) {
Intrinsics.checkNotNullParameter(key, "key");
return this.map.get(key);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public final Set<String> keys() {
return new HashSet(this.map.keySet());
}
public final void clear() {
Iterator<ViewModel> it = this.map.values().iterator();
while (it.hasNext()) {
it.next().clear();
}
this.map.clear();
}
}

View File

@@ -0,0 +1,6 @@
package androidx.lifecycle;
/* loaded from: classes.dex */
public interface ViewModelStoreOwner {
ViewModelStore getViewModelStore();
}

View File

@@ -0,0 +1,48 @@
package androidx.lifecycle;
import android.view.View;
import androidx.lifecycle.runtime.R;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.sequences.Sequence;
import kotlin.sequences.SequencesKt__SequencesKt;
import kotlin.sequences.SequencesKt___SequencesKt;
/* loaded from: classes.dex */
public final class ViewTreeLifecycleOwner {
public static final void set(View view, LifecycleOwner lifecycleOwner) {
Intrinsics.checkNotNullParameter(view, "<this>");
view.setTag(R.id.view_tree_lifecycle_owner, lifecycleOwner);
}
public static final LifecycleOwner get(View view) {
Sequence generateSequence;
Sequence mapNotNull;
Object firstOrNull;
Intrinsics.checkNotNullParameter(view, "<this>");
generateSequence = SequencesKt__SequencesKt.generateSequence(view, new Function1() { // from class: androidx.lifecycle.ViewTreeLifecycleOwner$findViewTreeLifecycleOwner$1
@Override // kotlin.jvm.functions.Function1
public final View invoke(View currentView) {
Intrinsics.checkNotNullParameter(currentView, "currentView");
Object parent = currentView.getParent();
if (parent instanceof View) {
return (View) parent;
}
return null;
}
});
mapNotNull = SequencesKt___SequencesKt.mapNotNull(generateSequence, new Function1() { // from class: androidx.lifecycle.ViewTreeLifecycleOwner$findViewTreeLifecycleOwner$2
@Override // kotlin.jvm.functions.Function1
public final LifecycleOwner invoke(View viewParent) {
Intrinsics.checkNotNullParameter(viewParent, "viewParent");
Object tag = viewParent.getTag(R.id.view_tree_lifecycle_owner);
if (tag instanceof LifecycleOwner) {
return (LifecycleOwner) tag;
}
return null;
}
});
firstOrNull = SequencesKt___SequencesKt.firstOrNull(mapNotNull);
return (LifecycleOwner) firstOrNull;
}
}

View File

@@ -0,0 +1,12 @@
package androidx.lifecycle;
import android.view.View;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public final class ViewTreeViewModelKt {
public static final /* synthetic */ ViewModelStoreOwner findViewTreeViewModelStoreOwner(View view) {
Intrinsics.checkNotNullParameter(view, "view");
return ViewTreeViewModelStoreOwner.get(view);
}
}

View File

@@ -0,0 +1,48 @@
package androidx.lifecycle;
import android.view.View;
import androidx.lifecycle.viewmodel.R;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.sequences.Sequence;
import kotlin.sequences.SequencesKt__SequencesKt;
import kotlin.sequences.SequencesKt___SequencesKt;
/* loaded from: classes.dex */
public final class ViewTreeViewModelStoreOwner {
public static final void set(View view, ViewModelStoreOwner viewModelStoreOwner) {
Intrinsics.checkNotNullParameter(view, "<this>");
view.setTag(R.id.view_tree_view_model_store_owner, viewModelStoreOwner);
}
public static final ViewModelStoreOwner get(View view) {
Sequence generateSequence;
Sequence mapNotNull;
Object firstOrNull;
Intrinsics.checkNotNullParameter(view, "<this>");
generateSequence = SequencesKt__SequencesKt.generateSequence(view, new Function1() { // from class: androidx.lifecycle.ViewTreeViewModelStoreOwner$findViewTreeViewModelStoreOwner$1
@Override // kotlin.jvm.functions.Function1
public final View invoke(View view2) {
Intrinsics.checkNotNullParameter(view2, "view");
Object parent = view2.getParent();
if (parent instanceof View) {
return (View) parent;
}
return null;
}
});
mapNotNull = SequencesKt___SequencesKt.mapNotNull(generateSequence, new Function1() { // from class: androidx.lifecycle.ViewTreeViewModelStoreOwner$findViewTreeViewModelStoreOwner$2
@Override // kotlin.jvm.functions.Function1
public final ViewModelStoreOwner invoke(View view2) {
Intrinsics.checkNotNullParameter(view2, "view");
Object tag = view2.getTag(R.id.view_tree_view_model_store_owner);
if (tag instanceof ViewModelStoreOwner) {
return (ViewModelStoreOwner) tag;
}
return null;
}
});
firstOrNull = SequencesKt___SequencesKt.firstOrNull(mapNotNull);
return (ViewModelStoreOwner) firstOrNull;
}
}

View File

@@ -0,0 +1,7 @@
package androidx.lifecycle.livedata;
/* loaded from: classes.dex */
public final class R {
private R() {
}
}

View File

@@ -0,0 +1,7 @@
package androidx.lifecycle.livedata.core;
/* loaded from: classes.dex */
public final class R {
private R() {
}
}

View File

@@ -0,0 +1,7 @@
package androidx.lifecycle.process;
/* loaded from: classes.dex */
public final class R {
private R() {
}
}

View File

@@ -0,0 +1,15 @@
package androidx.lifecycle.runtime;
/* loaded from: classes.dex */
public final class R {
public static final class id {
public static int view_tree_lifecycle_owner = 0x7f0a0290;
private id() {
}
}
private R() {
}
}

View File

@@ -0,0 +1,7 @@
package androidx.lifecycle.service;
/* loaded from: classes.dex */
public final class R {
private R() {
}
}

View File

@@ -0,0 +1,32 @@
package androidx.lifecycle.viewmodel;
import java.util.LinkedHashMap;
import java.util.Map;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public abstract class CreationExtras {
private final Map<Key<?>, Object> map = new LinkedHashMap();
public interface Key<T> {
}
public abstract <T> T get(Key<T> key);
public final Map<Key<?>, Object> getMap$lifecycle_viewmodel_release() {
return this.map;
}
public static final class Empty extends CreationExtras {
public static final Empty INSTANCE = new Empty();
@Override // androidx.lifecycle.viewmodel.CreationExtras
public <T> T get(Key<T> key) {
Intrinsics.checkNotNullParameter(key, "key");
return null;
}
private Empty() {
}
}
}

View File

@@ -0,0 +1,34 @@
package androidx.lifecycle.viewmodel;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelProvider;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
@SourceDebugExtension({"SMAP\nInitializerViewModelFactory.kt\nKotlin\n*S Kotlin\n*F\n+ 1 InitializerViewModelFactory.kt\nandroidx/lifecycle/viewmodel/InitializerViewModelFactory\n+ 2 _Arrays.kt\nkotlin/collections/ArraysKt___ArraysKt\n*L\n1#1,115:1\n13579#2,2:116\n*S KotlinDebug\n*F\n+ 1 InitializerViewModelFactory.kt\nandroidx/lifecycle/viewmodel/InitializerViewModelFactory\n*L\n105#1:116,2\n*E\n"})
/* loaded from: classes.dex */
public final class InitializerViewModelFactory implements ViewModelProvider.Factory {
private final ViewModelInitializer<?>[] initializers;
public InitializerViewModelFactory(ViewModelInitializer<?>... initializers) {
Intrinsics.checkNotNullParameter(initializers, "initializers");
this.initializers = initializers;
}
@Override // androidx.lifecycle.ViewModelProvider.Factory
public <T extends ViewModel> T create(Class<T> modelClass, CreationExtras extras) {
Intrinsics.checkNotNullParameter(modelClass, "modelClass");
Intrinsics.checkNotNullParameter(extras, "extras");
T t = null;
for (ViewModelInitializer<?> viewModelInitializer : this.initializers) {
if (Intrinsics.areEqual(viewModelInitializer.getClazz$lifecycle_viewmodel_release(), modelClass)) {
Object invoke = viewModelInitializer.getInitializer$lifecycle_viewmodel_release().invoke(extras);
t = invoke instanceof ViewModel ? (T) invoke : null;
}
}
if (t != null) {
return t;
}
throw new IllegalArgumentException("No initializer set for given class " + modelClass.getName());
}
}

View File

@@ -0,0 +1,30 @@
package androidx.lifecycle.viewmodel;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelProvider;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import kotlin.jvm.JvmClassMappingKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.reflect.KClass;
@ViewModelFactoryDsl
@SourceDebugExtension({"SMAP\nInitializerViewModelFactory.kt\nKotlin\n*S Kotlin\n*F\n+ 1 InitializerViewModelFactory.kt\nandroidx/lifecycle/viewmodel/InitializerViewModelFactoryBuilder\n+ 2 ArraysJVM.kt\nkotlin/collections/ArraysKt__ArraysJVMKt\n*L\n1#1,115:1\n37#2,2:116\n*S KotlinDebug\n*F\n+ 1 InitializerViewModelFactory.kt\nandroidx/lifecycle/viewmodel/InitializerViewModelFactoryBuilder\n*L\n54#1:116,2\n*E\n"})
/* loaded from: classes.dex */
public final class InitializerViewModelFactoryBuilder {
private final List<ViewModelInitializer<?>> initializers = new ArrayList();
public final <T extends ViewModel> void addInitializer(KClass clazz, Function1 initializer) {
Intrinsics.checkNotNullParameter(clazz, "clazz");
Intrinsics.checkNotNullParameter(initializer, "initializer");
this.initializers.add(new ViewModelInitializer<>(JvmClassMappingKt.getJavaClass(clazz), initializer));
}
public final ViewModelProvider.Factory build() {
ViewModelInitializer[] viewModelInitializerArr = (ViewModelInitializer[]) this.initializers.toArray(new ViewModelInitializer[0]);
return new InitializerViewModelFactory((ViewModelInitializer[]) Arrays.copyOf(viewModelInitializerArr, viewModelInitializerArr.length));
}
}

View File

@@ -0,0 +1,24 @@
package androidx.lifecycle.viewmodel;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelProvider;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
/* loaded from: classes.dex */
public final class InitializerViewModelFactoryKt {
public static final ViewModelProvider.Factory viewModelFactory(Function1 builder) {
Intrinsics.checkNotNullParameter(builder, "builder");
InitializerViewModelFactoryBuilder initializerViewModelFactoryBuilder = new InitializerViewModelFactoryBuilder();
builder.invoke(initializerViewModelFactoryBuilder);
return initializerViewModelFactoryBuilder.build();
}
public static final /* synthetic */ <VM extends ViewModel> void initializer(InitializerViewModelFactoryBuilder initializerViewModelFactoryBuilder, Function1 initializer) {
Intrinsics.checkNotNullParameter(initializerViewModelFactoryBuilder, "<this>");
Intrinsics.checkNotNullParameter(initializer, "initializer");
Intrinsics.reifiedOperationMarker(4, "VM");
initializerViewModelFactoryBuilder.addInitializer(Reflection.getOrCreateKotlinClass(ViewModel.class), initializer);
}
}

View File

@@ -0,0 +1,34 @@
package androidx.lifecycle.viewmodel;
import androidx.lifecycle.viewmodel.CreationExtras;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public final class MutableCreationExtras extends CreationExtras {
/* JADX WARN: Multi-variable type inference failed */
public MutableCreationExtras() {
this(null, 1, 0 == true ? 1 : 0);
}
public MutableCreationExtras(CreationExtras initialExtras) {
Intrinsics.checkNotNullParameter(initialExtras, "initialExtras");
getMap$lifecycle_viewmodel_release().putAll(initialExtras.getMap$lifecycle_viewmodel_release());
}
public /* synthetic */ MutableCreationExtras(CreationExtras creationExtras, int i, DefaultConstructorMarker defaultConstructorMarker) {
this((i & 1) != 0 ? CreationExtras.Empty.INSTANCE : creationExtras);
}
/* JADX WARN: Multi-variable type inference failed */
public final <T> void set(CreationExtras.Key<T> key, T t) {
Intrinsics.checkNotNullParameter(key, "key");
getMap$lifecycle_viewmodel_release().put(key, t);
}
@Override // androidx.lifecycle.viewmodel.CreationExtras
public <T> T get(CreationExtras.Key<T> key) {
Intrinsics.checkNotNullParameter(key, "key");
return (T) getMap$lifecycle_viewmodel_release().get(key);
}
}

View File

@@ -0,0 +1,15 @@
package androidx.lifecycle.viewmodel;
/* loaded from: classes.dex */
public final class R {
public static final class id {
public static int view_tree_view_model_store_owner = 0x7f0a0293;
private id() {
}
}
private R() {
}
}

View File

@@ -0,0 +1,9 @@
package androidx.lifecycle.viewmodel;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
/* loaded from: classes.dex */
public @interface ViewModelFactoryDsl {
}

View File

@@ -0,0 +1,26 @@
package androidx.lifecycle.viewmodel;
import androidx.lifecycle.ViewModel;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public final class ViewModelInitializer<T extends ViewModel> {
private final Class<T> clazz;
private final Function1 initializer;
public final Class<T> getClazz$lifecycle_viewmodel_release() {
return this.clazz;
}
public final Function1 getInitializer$lifecycle_viewmodel_release() {
return this.initializer;
}
public ViewModelInitializer(Class<T> clazz, Function1 initializer) {
Intrinsics.checkNotNullParameter(clazz, "clazz");
Intrinsics.checkNotNullParameter(initializer, "initializer");
this.clazz = clazz;
this.initializer = initializer;
}
}

View File

@@ -0,0 +1,7 @@
package androidx.lifecycle.viewmodel.savedstate;
/* loaded from: classes.dex */
public final class R {
private R() {
}
}