- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
158 lines
5.7 KiB
Java
158 lines
5.7 KiB
Java
package com.facebook.appevents.internal;
|
|
|
|
import android.os.AsyncTask;
|
|
import androidx.annotation.VisibleForTesting;
|
|
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
|
|
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
|
|
import java.io.DataInputStream;
|
|
import java.io.DataOutputStream;
|
|
import java.io.File;
|
|
import java.io.FileOutputStream;
|
|
import java.net.URL;
|
|
import java.net.URLConnection;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class FileDownloadTask extends AsyncTask<String, Void, Boolean> {
|
|
private final File destFile;
|
|
private final Callback onSuccess;
|
|
private final String uriStr;
|
|
|
|
public interface Callback {
|
|
void onComplete(File file);
|
|
}
|
|
|
|
@Override // android.os.AsyncTask
|
|
public /* bridge */ /* synthetic */ Boolean doInBackground(String[] strArr) {
|
|
if (CrashShieldHandler.isObjectCrashing(this)) {
|
|
return null;
|
|
}
|
|
try {
|
|
if (CrashShieldHandler.isObjectCrashing(this)) {
|
|
return null;
|
|
}
|
|
try {
|
|
if (CrashShieldHandler.isObjectCrashing(this)) {
|
|
return null;
|
|
}
|
|
try {
|
|
return doInBackground2(strArr);
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, this);
|
|
return null;
|
|
}
|
|
} catch (Throwable th2) {
|
|
CrashShieldHandler.handleThrowable(th2, this);
|
|
return null;
|
|
}
|
|
} catch (Throwable th3) {
|
|
CrashShieldHandler.handleThrowable(th3, this);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
@Override // android.os.AsyncTask
|
|
public /* bridge */ /* synthetic */ void onPostExecute(Boolean bool) {
|
|
if (CrashShieldHandler.isObjectCrashing(this)) {
|
|
return;
|
|
}
|
|
try {
|
|
if (CrashShieldHandler.isObjectCrashing(this)) {
|
|
return;
|
|
}
|
|
try {
|
|
if (CrashShieldHandler.isObjectCrashing(this)) {
|
|
return;
|
|
}
|
|
try {
|
|
onPostExecute(bool.booleanValue());
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, this);
|
|
}
|
|
} catch (Throwable th2) {
|
|
CrashShieldHandler.handleThrowable(th2, this);
|
|
}
|
|
} catch (Throwable th3) {
|
|
CrashShieldHandler.handleThrowable(th3, this);
|
|
}
|
|
}
|
|
|
|
public FileDownloadTask(String uriStr, File destFile, Callback onSuccess) {
|
|
Intrinsics.checkNotNullParameter(uriStr, "uriStr");
|
|
Intrinsics.checkNotNullParameter(destFile, "destFile");
|
|
Intrinsics.checkNotNullParameter(onSuccess, "onSuccess");
|
|
this.uriStr = uriStr;
|
|
this.destFile = destFile;
|
|
this.onSuccess = onSuccess;
|
|
}
|
|
|
|
@VisibleForTesting(otherwise = 4)
|
|
/* renamed from: doInBackground, reason: avoid collision after fix types in other method */
|
|
public Boolean doInBackground2(String... args) {
|
|
if (CrashShieldHandler.isObjectCrashing(this)) {
|
|
return null;
|
|
}
|
|
try {
|
|
if (CrashShieldHandler.isObjectCrashing(this)) {
|
|
return null;
|
|
}
|
|
try {
|
|
if (CrashShieldHandler.isObjectCrashing(this)) {
|
|
return null;
|
|
}
|
|
try {
|
|
Intrinsics.checkNotNullParameter(args, "args");
|
|
try {
|
|
URL url = new URL(this.uriStr);
|
|
int contentLength = ((URLConnection) FirebasePerfUrlConnection.instrument(url.openConnection())).getContentLength();
|
|
DataInputStream dataInputStream = new DataInputStream(FirebasePerfUrlConnection.openStream(url));
|
|
byte[] bArr = new byte[contentLength];
|
|
dataInputStream.readFully(bArr);
|
|
dataInputStream.close();
|
|
DataOutputStream dataOutputStream = new DataOutputStream(new FileOutputStream(this.destFile));
|
|
dataOutputStream.write(bArr);
|
|
dataOutputStream.flush();
|
|
dataOutputStream.close();
|
|
return Boolean.TRUE;
|
|
} catch (Exception unused) {
|
|
return Boolean.FALSE;
|
|
}
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, this);
|
|
return null;
|
|
}
|
|
} catch (Throwable th2) {
|
|
CrashShieldHandler.handleThrowable(th2, this);
|
|
return null;
|
|
}
|
|
} catch (Throwable th3) {
|
|
CrashShieldHandler.handleThrowable(th3, this);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public void onPostExecute(boolean z) {
|
|
if (CrashShieldHandler.isObjectCrashing(this)) {
|
|
return;
|
|
}
|
|
try {
|
|
if (CrashShieldHandler.isObjectCrashing(this)) {
|
|
return;
|
|
}
|
|
try {
|
|
if (!CrashShieldHandler.isObjectCrashing(this) && z) {
|
|
try {
|
|
this.onSuccess.onComplete(this.destFile);
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, this);
|
|
}
|
|
}
|
|
} catch (Throwable th2) {
|
|
CrashShieldHandler.handleThrowable(th2, this);
|
|
}
|
|
} catch (Throwable th3) {
|
|
CrashShieldHandler.handleThrowable(th3, this);
|
|
}
|
|
}
|
|
}
|