- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
291 lines
10 KiB
Java
291 lines
10 KiB
Java
package com.fyber.inneractive.sdk.player.cache;
|
|
|
|
import android.os.HandlerThread;
|
|
import android.os.Message;
|
|
import android.webkit.MimeTypeMap;
|
|
import com.fyber.inneractive.sdk.config.global.features.r;
|
|
import com.fyber.inneractive.sdk.config.global.s;
|
|
import com.fyber.inneractive.sdk.player.cache.b;
|
|
import com.fyber.inneractive.sdk.player.cache.c;
|
|
import com.fyber.inneractive.sdk.util.IAlog;
|
|
import com.fyber.inneractive.sdk.util.n0;
|
|
import com.fyber.inneractive.sdk.util.o0;
|
|
import com.mbridge.msdk.foundation.tools.SameMD5;
|
|
import com.unity3d.ads.core.data.datasource.AndroidStaticDeviceInfoDataSource;
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.security.MessageDigest;
|
|
import java.security.NoSuchAlgorithmException;
|
|
import java.util.Locale;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class j implements o0 {
|
|
public final com.fyber.inneractive.sdk.player.cache.c b;
|
|
public c.f c;
|
|
public final com.fyber.inneractive.sdk.player.cache.b d;
|
|
public final String e;
|
|
public com.fyber.inneractive.sdk.player.cache.a f;
|
|
public g g;
|
|
public d h;
|
|
public n0 j;
|
|
public final String l;
|
|
public f q;
|
|
public final s r;
|
|
public final String a = "MediaDownloader-" + hashCode();
|
|
public final Object k = new Object();
|
|
public volatile boolean m = false;
|
|
public boolean n = false;
|
|
public boolean o = false;
|
|
public String p = null;
|
|
public final HandlerThread i = new HandlerThread(String.format("MediaDownloader-%s-A", a()));
|
|
|
|
public class a implements Runnable {
|
|
public a() {
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
j.this.a(false);
|
|
}
|
|
}
|
|
|
|
public static /* synthetic */ class b {
|
|
public static final /* synthetic */ int[] a;
|
|
|
|
static {
|
|
int[] iArr = new int[r.d.values().length];
|
|
a = iArr;
|
|
try {
|
|
iArr[r.d.NONE.ordinal()] = 1;
|
|
} catch (NoSuchFieldError unused) {
|
|
}
|
|
try {
|
|
a[r.d.EXTRACTOR.ordinal()] = 2;
|
|
} catch (NoSuchFieldError unused2) {
|
|
}
|
|
try {
|
|
a[r.d.LEGACY.ordinal()] = 3;
|
|
} catch (NoSuchFieldError unused3) {
|
|
}
|
|
}
|
|
}
|
|
|
|
public static class c extends Exception {
|
|
public c(String str) {
|
|
super(str);
|
|
}
|
|
}
|
|
|
|
public class d extends Thread {
|
|
public final AtomicBoolean a;
|
|
public InputStream b;
|
|
public boolean c;
|
|
public boolean d;
|
|
public long e;
|
|
public long f;
|
|
public c.C0081c g;
|
|
public final int h;
|
|
public final int i;
|
|
public final int j;
|
|
public final int k;
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:45:0x0133 */
|
|
/* JADX WARN: Removed duplicated region for block: B:79:0x01d9 A[EDGE_INSN: B:79:0x01d9->B:78:0x01d9 BREAK A[LOOP:0: B:43:0x012a->B:66:0x01d5], SYNTHETIC] */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public final java.net.HttpURLConnection a(java.io.OutputStream r18, java.net.URL r19, java.nio.ByteBuffer r20, long r21, int r23) throws java.io.IOException, com.fyber.inneractive.sdk.player.cache.j.c {
|
|
/*
|
|
Method dump skipped, instructions count: 506
|
|
To view this dump add '--comments-level debug' option
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.fyber.inneractive.sdk.player.cache.j.d.a(java.io.OutputStream, java.net.URL, java.nio.ByteBuffer, long, int):java.net.HttpURLConnection");
|
|
}
|
|
|
|
public d(String str, int i) {
|
|
super(str);
|
|
this.a = new AtomicBoolean(false);
|
|
this.c = false;
|
|
this.d = false;
|
|
this.e = -1L;
|
|
this.f = 0L;
|
|
this.h = i;
|
|
this.i = j.this.r != null ? ((r) j.this.r.a(r.class)).e() : 10;
|
|
this.j = j.this.r != null ? ((r) j.this.r.a(r.class)).f() : 500;
|
|
this.k = j.this.r != null ? ((r) j.this.r.a(r.class)).i() : 25;
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:109:0x020f, code lost:
|
|
|
|
if (r15 == null) goto L96;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:75:0x01d6, code lost:
|
|
|
|
if (r15 != null) goto L114;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:79:0x0211, code lost:
|
|
|
|
r15.disconnect();
|
|
*/
|
|
/* JADX WARN: Finally extract failed */
|
|
@Override // java.lang.Thread, java.lang.Runnable
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public final void run() {
|
|
/*
|
|
Method dump skipped, instructions count: 556
|
|
To view this dump add '--comments-level debug' option
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.fyber.inneractive.sdk.player.cache.j.d.run():void");
|
|
}
|
|
}
|
|
|
|
public static class e extends c {
|
|
public e(String str) {
|
|
super(str);
|
|
}
|
|
}
|
|
|
|
public interface f {
|
|
}
|
|
|
|
public interface g {
|
|
}
|
|
|
|
public j(com.fyber.inneractive.sdk.player.cache.c cVar, String str, com.fyber.inneractive.sdk.player.cache.b bVar, int i, s sVar) {
|
|
this.b = cVar;
|
|
this.e = str;
|
|
this.l = MimeTypeMap.getSingleton().getMimeTypeFromExtension(MimeTypeMap.getFileExtensionFromUrl(str).toLowerCase(Locale.US));
|
|
this.d = bVar;
|
|
this.r = sVar;
|
|
this.h = new d(String.format("MediaDownloader-%s-A", a()), i);
|
|
}
|
|
|
|
@Override // com.fyber.inneractive.sdk.util.o0
|
|
public final void handleMessage(Message message) {
|
|
if (message.what == 4 && !this.f.f) {
|
|
synchronized (this.k) {
|
|
try {
|
|
IAlog.e("%s | reading from cache 1 - %s", this.a, a());
|
|
b.a a2 = this.d.a(this.f);
|
|
if (a2 == b.a.INVALID) {
|
|
com.fyber.inneractive.sdk.util.p.b.post(new i(this, new c("Failed cache validation")));
|
|
a(true);
|
|
} else if (a2 == b.a.PARTIAL_CANNOT_VALIDATE) {
|
|
this.m = true;
|
|
} else {
|
|
this.f.f = true;
|
|
a(this.f);
|
|
this.f.e.putAll(this.d.a);
|
|
com.fyber.inneractive.sdk.util.p.b.post(new h(this));
|
|
}
|
|
} finally {
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
int i = message.what;
|
|
if (i == 1) {
|
|
Object obj = message.obj;
|
|
if (obj instanceof Exception) {
|
|
com.fyber.inneractive.sdk.util.p.b.post(new i(this, (Exception) obj));
|
|
} else {
|
|
com.fyber.inneractive.sdk.util.p.b.post(new i(this, new c("download failed")));
|
|
}
|
|
a(false);
|
|
return;
|
|
}
|
|
if (i == 2) {
|
|
if (this.m) {
|
|
synchronized (this.k) {
|
|
try {
|
|
IAlog.e("%s | reading from cache 2 - %s", this.a, a());
|
|
if (this.d.a(this.f) == b.a.INVALID) {
|
|
com.fyber.inneractive.sdk.util.p.b.post(new i(this, new c("Failed cache validation after downloading complete file")));
|
|
a(true);
|
|
} else {
|
|
a(this.f);
|
|
this.f.e.putAll(this.d.a);
|
|
com.fyber.inneractive.sdk.util.p.b.post(new h(this));
|
|
}
|
|
} finally {
|
|
}
|
|
}
|
|
} else {
|
|
com.fyber.inneractive.sdk.util.p.b.post(new a());
|
|
}
|
|
IAlog.e("%s | Download success for cache key %s", this.a, a());
|
|
}
|
|
}
|
|
|
|
public final void a(boolean z) {
|
|
d dVar = this.h;
|
|
if (dVar != null) {
|
|
dVar.a.compareAndSet(false, true);
|
|
this.h = null;
|
|
}
|
|
HandlerThread handlerThread = this.i;
|
|
if (handlerThread != null) {
|
|
handlerThread.quit();
|
|
}
|
|
this.j = null;
|
|
if (z) {
|
|
try {
|
|
this.b.d(a());
|
|
} catch (IOException e2) {
|
|
IAlog.a("failed to remove cache key", e2, new Object[0]);
|
|
}
|
|
}
|
|
}
|
|
|
|
public final String a() {
|
|
String str = "";
|
|
if (this.p == null) {
|
|
String str2 = this.e;
|
|
try {
|
|
try {
|
|
MessageDigest messageDigest = MessageDigest.getInstance(AndroidStaticDeviceInfoDataSource.ALGORITHM_SHA1);
|
|
messageDigest.update(str2.getBytes());
|
|
byte[] digest = messageDigest.digest();
|
|
StringBuffer stringBuffer = new StringBuffer();
|
|
for (byte b2 : digest) {
|
|
stringBuffer.append(Integer.toHexString((b2 & 255) | 256).substring(1));
|
|
}
|
|
str = stringBuffer.toString();
|
|
} catch (NoSuchAlgorithmException unused) {
|
|
str = str2.replaceAll("\\W+", "");
|
|
}
|
|
} catch (NullPointerException unused2) {
|
|
} catch (NoSuchAlgorithmException unused3) {
|
|
MessageDigest messageDigest2 = MessageDigest.getInstance(SameMD5.TAG);
|
|
messageDigest2.update(str2.getBytes());
|
|
byte[] digest2 = messageDigest2.digest();
|
|
StringBuffer stringBuffer2 = new StringBuffer();
|
|
for (byte b3 : digest2) {
|
|
stringBuffer2.append(Integer.toHexString((b3 & 255) | 256).substring(1));
|
|
}
|
|
str = stringBuffer2.toString();
|
|
}
|
|
this.p = str;
|
|
}
|
|
return this.p;
|
|
}
|
|
|
|
public final void a(com.fyber.inneractive.sdk.player.cache.a aVar) {
|
|
f fVar;
|
|
if (aVar == null || (fVar = this.q) == null) {
|
|
return;
|
|
}
|
|
File a2 = aVar.a();
|
|
File file = ((com.fyber.inneractive.sdk.util.i) fVar).a;
|
|
if (file == null || a2 == null || !file.getAbsolutePath().equals(a2.getAbsolutePath())) {
|
|
((com.fyber.inneractive.sdk.util.i) this.q).a(aVar.a());
|
|
}
|
|
}
|
|
}
|