- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
421 lines
10 KiB
Java
421 lines
10 KiB
Java
package com.applovin.impl;
|
|
|
|
import android.os.Handler;
|
|
import com.applovin.impl.a7;
|
|
import com.applovin.impl.be;
|
|
import com.applovin.impl.ce;
|
|
import com.applovin.impl.wj;
|
|
import java.io.IOException;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.HashSet;
|
|
import java.util.IdentityHashMap;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
|
|
/* loaded from: classes.dex */
|
|
final class fe {
|
|
private final d d;
|
|
private final ce.a e;
|
|
private final a7.a f;
|
|
private final HashMap g;
|
|
private final Set h;
|
|
private boolean j;
|
|
private xo k;
|
|
private wj i = new wj.a(0);
|
|
private final IdentityHashMap b = new IdentityHashMap();
|
|
private final Map c = new HashMap();
|
|
private final List a = new ArrayList();
|
|
|
|
public interface d {
|
|
void a();
|
|
}
|
|
|
|
public boolean d() {
|
|
return this.j;
|
|
}
|
|
|
|
public fe(d dVar, r0 r0Var, Handler handler) {
|
|
this.d = dVar;
|
|
ce.a aVar = new ce.a();
|
|
this.e = aVar;
|
|
a7.a aVar2 = new a7.a();
|
|
this.f = aVar2;
|
|
this.g = new HashMap();
|
|
this.h = new HashSet();
|
|
if (r0Var != null) {
|
|
aVar.a(handler, r0Var);
|
|
aVar2.a(handler, r0Var);
|
|
}
|
|
}
|
|
|
|
public int c() {
|
|
return this.a.size();
|
|
}
|
|
|
|
public fo a(int i, List list, wj wjVar) {
|
|
if (!list.isEmpty()) {
|
|
this.i = wjVar;
|
|
for (int i2 = i; i2 < list.size() + i; i2++) {
|
|
c cVar = (c) list.get(i2 - i);
|
|
if (i2 > 0) {
|
|
c cVar2 = (c) this.a.get(i2 - 1);
|
|
cVar.a(cVar2.d + cVar2.a.i().b());
|
|
} else {
|
|
cVar.a(0);
|
|
}
|
|
a(i2, cVar.a.i().b());
|
|
this.a.add(i2, cVar);
|
|
this.c.put(cVar.b, cVar);
|
|
if (this.j) {
|
|
d(cVar);
|
|
if (this.b.isEmpty()) {
|
|
this.h.add(cVar);
|
|
} else {
|
|
a(cVar);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return a();
|
|
}
|
|
|
|
public void e() {
|
|
for (b bVar : this.g.values()) {
|
|
try {
|
|
bVar.a.c(bVar.b);
|
|
} catch (RuntimeException e) {
|
|
pc.a("MediaSourceList", "Failed to release child source.", e);
|
|
}
|
|
bVar.a.a((ce) bVar.c);
|
|
bVar.a.a((a7) bVar.c);
|
|
}
|
|
this.g.clear();
|
|
this.h.clear();
|
|
this.j = false;
|
|
}
|
|
|
|
private void b() {
|
|
Iterator it = this.h.iterator();
|
|
while (it.hasNext()) {
|
|
c cVar = (c) it.next();
|
|
if (cVar.c.isEmpty()) {
|
|
a(cVar);
|
|
it.remove();
|
|
}
|
|
}
|
|
}
|
|
|
|
public static final class c implements ee {
|
|
public final xc a;
|
|
public int d;
|
|
public boolean e;
|
|
public final List c = new ArrayList();
|
|
public final Object b = new Object();
|
|
|
|
@Override // com.applovin.impl.ee
|
|
public Object a() {
|
|
return this.b;
|
|
}
|
|
|
|
public c(be beVar, boolean z) {
|
|
this.a = new xc(beVar, z);
|
|
}
|
|
|
|
@Override // com.applovin.impl.ee
|
|
public fo b() {
|
|
return this.a.i();
|
|
}
|
|
|
|
public void a(int i) {
|
|
this.d = i;
|
|
this.e = false;
|
|
this.c.clear();
|
|
}
|
|
}
|
|
|
|
public static final class b {
|
|
public final be a;
|
|
public final be.b b;
|
|
public final a c;
|
|
|
|
public b(be beVar, be.b bVar, a aVar) {
|
|
this.a = beVar;
|
|
this.b = bVar;
|
|
this.c = aVar;
|
|
}
|
|
}
|
|
|
|
public final class a implements ce, a7 {
|
|
private final c a;
|
|
private ce.a b;
|
|
private a7.a c;
|
|
|
|
public a(c cVar) {
|
|
this.b = fe.this.e;
|
|
this.c = fe.this.f;
|
|
this.a = cVar;
|
|
}
|
|
|
|
@Override // com.applovin.impl.ce
|
|
public void a(int i, be.a aVar, ud udVar) {
|
|
if (f(i, aVar)) {
|
|
this.b.a(udVar);
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.a7
|
|
public void d(int i, be.a aVar) {
|
|
if (f(i, aVar)) {
|
|
this.c.a();
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.a7
|
|
public void c(int i, be.a aVar) {
|
|
if (f(i, aVar)) {
|
|
this.c.c();
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.a7
|
|
public void b(int i, be.a aVar) {
|
|
if (f(i, aVar)) {
|
|
this.c.d();
|
|
}
|
|
}
|
|
|
|
private boolean f(int i, be.a aVar) {
|
|
be.a aVar2;
|
|
if (aVar != null) {
|
|
aVar2 = fe.b(this.a, aVar);
|
|
if (aVar2 == null) {
|
|
return false;
|
|
}
|
|
} else {
|
|
aVar2 = null;
|
|
}
|
|
int b = fe.b(this.a, i);
|
|
ce.a aVar3 = this.b;
|
|
if (aVar3.a != b || !xp.a(aVar3.b, aVar2)) {
|
|
this.b = fe.this.e.a(b, aVar2, 0L);
|
|
}
|
|
a7.a aVar4 = this.c;
|
|
if (aVar4.a == b && xp.a(aVar4.b, aVar2)) {
|
|
return true;
|
|
}
|
|
this.c = fe.this.f.a(b, aVar2);
|
|
return true;
|
|
}
|
|
|
|
@Override // com.applovin.impl.ce
|
|
public void c(int i, be.a aVar, nc ncVar, ud udVar) {
|
|
if (f(i, aVar)) {
|
|
this.b.b(ncVar, udVar);
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.ce
|
|
public void b(int i, be.a aVar, nc ncVar, ud udVar) {
|
|
if (f(i, aVar)) {
|
|
this.b.c(ncVar, udVar);
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.a7
|
|
public void a(int i, be.a aVar) {
|
|
if (f(i, aVar)) {
|
|
this.c.b();
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.a7
|
|
public void a(int i, be.a aVar, int i2) {
|
|
if (f(i, aVar)) {
|
|
this.c.a(i2);
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.a7
|
|
public void a(int i, be.a aVar, Exception exc) {
|
|
if (f(i, aVar)) {
|
|
this.c.a(exc);
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.ce
|
|
public void a(int i, be.a aVar, nc ncVar, ud udVar) {
|
|
if (f(i, aVar)) {
|
|
this.b.a(ncVar, udVar);
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.ce
|
|
public void a(int i, be.a aVar, nc ncVar, ud udVar, IOException iOException, boolean z) {
|
|
if (f(i, aVar)) {
|
|
this.b.a(ncVar, udVar, iOException, z);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void d(c cVar) {
|
|
xc xcVar = cVar.a;
|
|
be.b bVar = new be.b() { // from class: com.applovin.impl.fe$$ExternalSyntheticLambda0
|
|
@Override // com.applovin.impl.be.b
|
|
public final void a(be beVar, fo foVar) {
|
|
fe.this.a(beVar, foVar);
|
|
}
|
|
};
|
|
a aVar = new a(cVar);
|
|
this.g.put(cVar, new b(xcVar, bVar, aVar));
|
|
xcVar.a(xp.b(), (ce) aVar);
|
|
xcVar.a(xp.b(), (a7) aVar);
|
|
xcVar.a(bVar, this.k);
|
|
}
|
|
|
|
private void c(c cVar) {
|
|
if (cVar.e && cVar.c.isEmpty()) {
|
|
b bVar = (b) b1.a((b) this.g.remove(cVar));
|
|
bVar.a.c(bVar.b);
|
|
bVar.a.a((ce) bVar.c);
|
|
bVar.a.a((a7) bVar.c);
|
|
this.h.remove(cVar);
|
|
}
|
|
}
|
|
|
|
private void a(int i, int i2) {
|
|
while (i < this.a.size()) {
|
|
((c) this.a.get(i)).d += i2;
|
|
i++;
|
|
}
|
|
}
|
|
|
|
private void b(c cVar) {
|
|
this.h.add(cVar);
|
|
b bVar = (b) this.g.get(cVar);
|
|
if (bVar != null) {
|
|
bVar.a.b(bVar.b);
|
|
}
|
|
}
|
|
|
|
public wd a(be.a aVar, n0 n0Var, long j) {
|
|
Object b2 = b(aVar.a);
|
|
be.a b3 = aVar.b(a(aVar.a));
|
|
c cVar = (c) b1.a((c) this.c.get(b2));
|
|
b(cVar);
|
|
cVar.c.add(b3);
|
|
wc a2 = cVar.a.a(b3, n0Var, j);
|
|
this.b.put(a2, cVar);
|
|
b();
|
|
return a2;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static be.a b(c cVar, be.a aVar) {
|
|
for (int i = 0; i < cVar.c.size(); i++) {
|
|
if (((be.a) cVar.c.get(i)).d == aVar.d) {
|
|
return aVar.b(a(cVar, aVar.a));
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public fo a() {
|
|
if (this.a.isEmpty()) {
|
|
return fo.a;
|
|
}
|
|
int i = 0;
|
|
for (int i2 = 0; i2 < this.a.size(); i2++) {
|
|
c cVar = (c) this.a.get(i2);
|
|
cVar.d = i;
|
|
i += cVar.a.i().b();
|
|
}
|
|
return new sh(this.a, this.i);
|
|
}
|
|
|
|
private static Object b(Object obj) {
|
|
return com.applovin.impl.b.d(obj);
|
|
}
|
|
|
|
private void a(c cVar) {
|
|
b bVar = (b) this.g.get(cVar);
|
|
if (bVar != null) {
|
|
bVar.a.a(bVar.b);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static int b(c cVar, int i) {
|
|
return i + cVar.d;
|
|
}
|
|
|
|
private static Object a(Object obj) {
|
|
return com.applovin.impl.b.c(obj);
|
|
}
|
|
|
|
private void b(int i, int i2) {
|
|
for (int i3 = i2 - 1; i3 >= i; i3--) {
|
|
c cVar = (c) this.a.remove(i3);
|
|
this.c.remove(cVar.b);
|
|
a(i3, -cVar.a.i().b());
|
|
cVar.e = true;
|
|
if (this.j) {
|
|
c(cVar);
|
|
}
|
|
}
|
|
}
|
|
|
|
private static Object a(c cVar, Object obj) {
|
|
return com.applovin.impl.b.a(cVar.b, obj);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void a(be beVar, fo foVar) {
|
|
this.d.a();
|
|
}
|
|
|
|
public void a(xo xoVar) {
|
|
b1.b(!this.j);
|
|
this.k = xoVar;
|
|
for (int i = 0; i < this.a.size(); i++) {
|
|
c cVar = (c) this.a.get(i);
|
|
d(cVar);
|
|
this.h.add(cVar);
|
|
}
|
|
this.j = true;
|
|
}
|
|
|
|
public void a(wd wdVar) {
|
|
c cVar = (c) b1.a((c) this.b.remove(wdVar));
|
|
cVar.a.a(wdVar);
|
|
cVar.c.remove(((wc) wdVar).a);
|
|
if (!this.b.isEmpty()) {
|
|
b();
|
|
}
|
|
c(cVar);
|
|
}
|
|
|
|
public fo a(int i, int i2, wj wjVar) {
|
|
b1.a(i >= 0 && i <= i2 && i2 <= c());
|
|
this.i = wjVar;
|
|
b(i, i2);
|
|
return a();
|
|
}
|
|
|
|
public fo a(List list, wj wjVar) {
|
|
b(0, this.a.size());
|
|
return a(this.a.size(), list, wjVar);
|
|
}
|
|
|
|
public fo a(wj wjVar) {
|
|
int c2 = c();
|
|
if (wjVar.a() != c2) {
|
|
wjVar = wjVar.d().b(0, c2);
|
|
}
|
|
this.i = wjVar;
|
|
return a();
|
|
}
|
|
}
|