what-the-bank/sources/androidx/savedstate/Recreator.java

101 lines
3.6 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package androidx.savedstate;
import android.os.Bundle;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.Set;
import o.C14957gcv;
import o.FNE;
import o.InterfaceC16541pFg;
import o.InterfaceC3451axm;
import o.InterfaceC9254dgJ;
import o.wdQ;
/* loaded from: classes.dex */
public final class Recreator implements InterfaceC3451axm {
private final InterfaceC9254dgJ d;
public Recreator(InterfaceC9254dgJ interfaceC9254dgJ) {
C14957gcv.e(interfaceC9254dgJ, "");
this.d = interfaceC9254dgJ;
}
@Override // o.InterfaceC3451axm
public final void c(InterfaceC16541pFg interfaceC16541pFg, wdQ.HBt hBt) {
C14957gcv.e(interfaceC16541pFg, "");
C14957gcv.e(hBt, "");
if (hBt != wdQ.HBt.ON_CREATE) {
throw new AssertionError("Next event must be ON_CREATE");
}
interfaceC16541pFg.getLifecycle().a(this);
Bundle AH_ = this.d.getSavedStateRegistry().AH_("androidx.savedstate.Restarter");
if (AH_ == null) {
return;
}
ArrayList<String> stringArrayList = AH_.getStringArrayList("classes_to_restore");
if (stringArrayList == null) {
throw new IllegalStateException("Bundle with restored state for the component \"androidx.savedstate.Restarter\" must contain list of strings by the key \"classes_to_restore\"");
}
for (String str : stringArrayList) {
try {
Class<? extends U> asSubclass = Class.forName(str, false, Recreator.class.getClassLoader()).asSubclass(FNE.IeS.class);
C14957gcv.c(asSubclass, "");
try {
Constructor declaredConstructor = asSubclass.getDeclaredConstructor(new Class[0]);
declaredConstructor.setAccessible(true);
try {
Object newInstance = declaredConstructor.newInstance(new Object[0]);
C14957gcv.c(newInstance, "");
((FNE.IeS) newInstance).d(this.d);
} catch (Exception e) {
throw new RuntimeException("Failed to instantiate ".concat(String.valueOf(str)), e);
}
} catch (NoSuchMethodException e2) {
StringBuilder sb = new StringBuilder("Class ");
sb.append(asSubclass.getSimpleName());
sb.append(" must have default constructor in order to be automatically recreated");
throw new IllegalStateException(sb.toString(), e2);
}
} catch (ClassNotFoundException e3) {
StringBuilder sb2 = new StringBuilder("Class ");
sb2.append(str);
sb2.append(" wasn't found");
throw new RuntimeException(sb2.toString(), e3);
}
}
}
/* loaded from: classes.dex */
public static final class LWm implements FNE.Sts {
public final Set<String> d;
public LWm(FNE fne) {
C14957gcv.e(fne, "");
this.d = new LinkedHashSet();
fne.a("androidx.savedstate.Restarter", this);
}
@Override // o.FNE.Sts
public final Bundle AK_() {
Bundle bundle = new Bundle();
bundle.putStringArrayList("classes_to_restore", new ArrayList<>(this.d));
return bundle;
}
}
/* loaded from: classes.dex */
public static final class HBt {
private HBt() {
}
public /* synthetic */ HBt(byte b) {
this();
}
}
static {
new HBt((byte) 0);
}
}