what-the-bank/sources/o/CeN.java

293 lines
11 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package o;
import android.content.Intent;
import android.os.Bundle;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;
import o.AbstractC6423cSf;
import o.CeN;
import o.Heg;
import o.InterfaceC0834Plv;
import o.InterfaceC16541pFg;
import o.wdQ;
/* loaded from: classes.dex */
public abstract class CeN {
private Random i = new Random();
public final Map<Integer, String> f = new HashMap();
final Map<String, Integer> c = new HashMap();
private final Map<String, HBt> e = new HashMap();
public ArrayList<String> d = new ArrayList<>();
public final transient Map<String, Sts<?>> b = new HashMap();
public final Map<String, Object> a = new HashMap();
public final Bundle j = new Bundle();
public abstract <I, O> void e(int i, AbstractC6423cSf<I, O> abstractC6423cSf, I i2, Wax wax);
public final <I, O> huo<I> a(final String str, InterfaceC16541pFg interfaceC16541pFg, final AbstractC6423cSf<I, O> abstractC6423cSf, final InterfaceC0834Plv<O> interfaceC0834Plv) {
wdQ lifecycle = interfaceC16541pFg.getLifecycle();
if (lifecycle.a().compareTo(wdQ.IeS.STARTED) >= 0) {
StringBuilder sb = new StringBuilder("LifecycleOwner ");
sb.append(interfaceC16541pFg);
sb.append(" is attempting to register while current state is ");
sb.append(lifecycle.a());
sb.append(". LifecycleOwners must call register before they are STARTED.");
throw new IllegalStateException(sb.toString());
}
c(str);
HBt hBt = this.e.get(str);
if (hBt == null) {
hBt = new HBt(lifecycle);
}
InterfaceC3451axm interfaceC3451axm = new InterfaceC3451axm(this, str, interfaceC0834Plv, abstractC6423cSf) { // from class: androidx.activity.result.ActivityResultRegistry$1
final AbstractC6423cSf a;
final InterfaceC0834Plv b;
final String d;
final CeN e;
{
this.e = this;
this.d = str;
this.b = interfaceC0834Plv;
this.a = abstractC6423cSf;
}
@Override // o.InterfaceC3451axm
public final void c(InterfaceC16541pFg interfaceC16541pFg2, wdQ.HBt hBt2) {
if (wdQ.HBt.ON_START.equals(hBt2)) {
this.e.b.put(this.d, new CeN.Sts<>(this.b, this.a));
if (this.e.a.containsKey(this.d)) {
Object obj = this.e.a.get(this.d);
this.e.a.remove(this.d);
this.b.d(obj);
}
Heg heg = (Heg) this.e.j.getParcelable(this.d);
if (heg != null) {
this.e.j.remove(this.d);
this.b.d(this.a.YG_(heg.e, heg.b));
return;
}
return;
}
if (wdQ.HBt.ON_STOP.equals(hBt2)) {
this.e.b.remove(this.d);
} else if (wdQ.HBt.ON_DESTROY.equals(hBt2)) {
this.e.a(this.d);
}
}
};
hBt.d.e(interfaceC3451axm);
hBt.e.add(interfaceC3451axm);
this.e.put(str, hBt);
return new huo<I>(this, str, abstractC6423cSf) { // from class: o.CeN.4
final String b;
final CeN d;
final AbstractC6423cSf e;
{
this.d = this;
this.b = str;
this.e = abstractC6423cSf;
}
@Override // o.huo
public final void d(I i, Wax wax) {
Integer num = this.d.c.get(this.b);
if (num == null) {
StringBuilder sb2 = new StringBuilder("Attempting to launch an unregistered ActivityResultLauncher with contract ");
sb2.append(this.e);
sb2.append(" and input ");
sb2.append(i);
sb2.append(". You must ensure the ActivityResultLauncher is registered before calling launch().");
throw new IllegalStateException(sb2.toString());
}
this.d.d.add(this.b);
try {
this.d.e(num.intValue(), this.e, i, wax);
} catch (Exception e) {
this.d.d.remove(this.b);
throw e;
}
}
@Override // o.huo
public final void e() {
this.d.a(this.b);
}
};
}
/* JADX WARN: Multi-variable type inference failed */
public final <I, O> huo<I> e(String str, AbstractC6423cSf<I, O> abstractC6423cSf, InterfaceC0834Plv<O> interfaceC0834Plv) {
c(str);
this.b.put(str, new Sts<>(interfaceC0834Plv, abstractC6423cSf));
if (this.a.containsKey(str)) {
Object obj = this.a.get(str);
this.a.remove(str);
interfaceC0834Plv.d(obj);
}
Heg heg = (Heg) this.j.getParcelable(str);
if (heg != null) {
this.j.remove(str);
interfaceC0834Plv.d(abstractC6423cSf.YG_(heg.e, heg.b));
}
return new huo<I>(this, str, abstractC6423cSf) { // from class: o.CeN.5
final AbstractC6423cSf a;
final CeN b;
final String d;
{
this.b = this;
this.d = str;
this.a = abstractC6423cSf;
}
@Override // o.huo
public final void d(I i, Wax wax) {
Integer num = this.b.c.get(this.d);
if (num == null) {
StringBuilder sb = new StringBuilder("Attempting to launch an unregistered ActivityResultLauncher with contract ");
sb.append(this.a);
sb.append(" and input ");
sb.append(i);
sb.append(". You must ensure the ActivityResultLauncher is registered before calling launch().");
throw new IllegalStateException(sb.toString());
}
this.b.d.add(this.d);
try {
this.b.e(num.intValue(), this.a, i, wax);
} catch (Exception e) {
this.b.d.remove(this.d);
throw e;
}
}
@Override // o.huo
public final void e() {
this.b.a(this.d);
}
};
}
public final void a(String str) {
Integer remove;
if (!this.d.contains(str) && (remove = this.c.remove(str)) != null) {
this.f.remove(remove);
}
this.b.remove(str);
if (this.a.containsKey(str)) {
this.a.get(str);
this.a.remove(str);
}
if (this.j.containsKey(str)) {
this.j.getParcelable(str);
this.j.remove(str);
}
HBt hBt = this.e.get(str);
if (hBt != null) {
Iterator<InterfaceC3451axm> it = hBt.e.iterator();
while (it.hasNext()) {
hBt.d.a(it.next());
}
hBt.e.clear();
this.e.remove(str);
}
}
public final void bE_(Bundle bundle) {
bundle.putIntegerArrayList("KEY_COMPONENT_ACTIVITY_REGISTERED_RCS", new ArrayList<>(this.c.values()));
bundle.putStringArrayList("KEY_COMPONENT_ACTIVITY_REGISTERED_KEYS", new ArrayList<>(this.c.keySet()));
bundle.putStringArrayList("KEY_COMPONENT_ACTIVITY_LAUNCHED_KEYS", new ArrayList<>(this.d));
bundle.putBundle("KEY_COMPONENT_ACTIVITY_PENDING_RESULT", (Bundle) this.j.clone());
bundle.putSerializable("KEY_COMPONENT_ACTIVITY_RANDOM_OBJECT", this.i);
}
public final void bD_(Bundle bundle) {
if (bundle == null) {
return;
}
ArrayList<Integer> integerArrayList = bundle.getIntegerArrayList("KEY_COMPONENT_ACTIVITY_REGISTERED_RCS");
ArrayList<String> stringArrayList = bundle.getStringArrayList("KEY_COMPONENT_ACTIVITY_REGISTERED_KEYS");
if (stringArrayList == null || integerArrayList == null) {
return;
}
this.d = bundle.getStringArrayList("KEY_COMPONENT_ACTIVITY_LAUNCHED_KEYS");
this.i = (Random) bundle.getSerializable("KEY_COMPONENT_ACTIVITY_RANDOM_OBJECT");
this.j.putAll(bundle.getBundle("KEY_COMPONENT_ACTIVITY_PENDING_RESULT"));
for (int i = 0; i < stringArrayList.size(); i++) {
String str = stringArrayList.get(i);
if (this.c.containsKey(str)) {
Integer remove = this.c.remove(str);
if (!this.j.containsKey(str)) {
this.f.remove(remove);
}
}
int intValue = integerArrayList.get(i).intValue();
String str2 = stringArrayList.get(i);
this.f.put(Integer.valueOf(intValue), str2);
this.c.put(str2, Integer.valueOf(intValue));
}
}
public final boolean bC_(int i, int i2, Intent intent) {
String str = this.f.get(Integer.valueOf(i));
if (str == null) {
return false;
}
bB_(str, i2, intent, this.b.get(str));
return true;
}
private <O> void bB_(String str, int i, Intent intent, Sts<O> sts) {
if (sts != null && sts.c != null && this.d.contains(str)) {
sts.c.d(sts.a.YG_(i, intent));
this.d.remove(str);
} else {
this.a.remove(str);
this.j.putParcelable(str, new Heg(i, intent));
}
}
private void c(String str) {
if (this.c.get(str) != null) {
return;
}
int nextInt = this.i.nextInt(2147418112);
while (true) {
int i = nextInt + 65536;
if (this.f.containsKey(Integer.valueOf(i))) {
nextInt = this.i.nextInt(2147418112);
} else {
this.f.put(Integer.valueOf(i), str);
this.c.put(str, Integer.valueOf(i));
return;
}
}
}
/* loaded from: classes.dex */
public static class Sts<O> {
final AbstractC6423cSf<?, O> a;
public final InterfaceC0834Plv<O> c;
public Sts(InterfaceC0834Plv<O> interfaceC0834Plv, AbstractC6423cSf<?, O> abstractC6423cSf) {
this.c = interfaceC0834Plv;
this.a = abstractC6423cSf;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public static class HBt {
final wdQ d;
final ArrayList<InterfaceC3451axm> e = new ArrayList<>();
HBt(wdQ wdq) {
this.d = wdq;
}
}
}