- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
125 lines
3.7 KiB
Java
125 lines
3.7 KiB
Java
package com.ironsource;
|
|
|
|
import android.content.Context;
|
|
import android.os.Message;
|
|
import android.text.TextUtils;
|
|
import com.ironsource.fc;
|
|
import com.ironsource.mediationsdk.logger.IronLog;
|
|
import com.ironsource.sdk.utils.IronSourceStorageUtils;
|
|
import java.util.ArrayList;
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class hc {
|
|
private final Context a;
|
|
private final ra b;
|
|
private final gc c;
|
|
private final hl d;
|
|
private final ce e = el.N().f();
|
|
|
|
public class a implements hn {
|
|
final /* synthetic */ hn a;
|
|
|
|
/* renamed from: com.ironsource.hc$a$a, reason: collision with other inner class name */
|
|
public class C0171a extends JSONObject {
|
|
public C0171a() throws JSONException {
|
|
put("lastReferencedTime", System.currentTimeMillis());
|
|
}
|
|
}
|
|
|
|
public a(hn hnVar) {
|
|
this.a = hnVar;
|
|
}
|
|
|
|
@Override // com.ironsource.hn
|
|
public void a(zf zfVar) {
|
|
this.a.a(zfVar);
|
|
try {
|
|
hc.this.d.a(zfVar.getName(), new C0171a());
|
|
} catch (Exception e) {
|
|
i9.d().a(e);
|
|
IronLog.INTERNAL.error(e.toString());
|
|
}
|
|
}
|
|
|
|
@Override // com.ironsource.hn
|
|
public void a(zf zfVar, rf rfVar) {
|
|
this.a.a(zfVar, rfVar);
|
|
}
|
|
}
|
|
|
|
public hc(Context context, ra raVar, gc gcVar, hl hlVar) {
|
|
this.a = context;
|
|
this.b = raVar;
|
|
this.c = gcVar;
|
|
this.d = hlVar;
|
|
}
|
|
|
|
public void a(zf zfVar) throws Exception {
|
|
if (zfVar.exists()) {
|
|
if (!zfVar.delete()) {
|
|
throw new Exception("Failed to delete file");
|
|
}
|
|
this.d.a(zfVar.getName());
|
|
}
|
|
}
|
|
|
|
public void a(zf zfVar, String str, int i, int i2, hn hnVar) throws Exception {
|
|
if (TextUtils.isEmpty(str)) {
|
|
throw new Exception(fc.a.a);
|
|
}
|
|
if (this.e.a(this.b.a()) <= 0) {
|
|
throw new Exception(x8.A);
|
|
}
|
|
if (!r8.h(this.a)) {
|
|
throw new Exception(x8.C);
|
|
}
|
|
this.c.a(zfVar.getPath(), new a(hnVar));
|
|
if (!zfVar.exists()) {
|
|
this.b.a(zfVar, str, i, i2, this.c);
|
|
return;
|
|
}
|
|
Message message = new Message();
|
|
message.obj = zfVar;
|
|
message.what = 1015;
|
|
this.c.sendMessage(message);
|
|
}
|
|
|
|
public void a(zf zfVar, JSONObject jSONObject) throws Exception {
|
|
if (jSONObject == null) {
|
|
throw new Exception("Missing attributes to update");
|
|
}
|
|
if (!zfVar.exists()) {
|
|
throw new Exception("File does not exist");
|
|
}
|
|
if (!this.d.b(zfVar.getName(), jSONObject)) {
|
|
throw new Exception("Failed to update attribute");
|
|
}
|
|
}
|
|
|
|
public void b(zf zfVar) throws Exception {
|
|
if (zfVar.exists()) {
|
|
ArrayList<zf> filesInFolderRecursive = IronSourceStorageUtils.getFilesInFolderRecursive(zfVar);
|
|
if (!IronSourceStorageUtils.deleteFolderContentRecursive(zfVar) || !zfVar.delete()) {
|
|
throw new Exception("Failed to delete folder");
|
|
}
|
|
this.d.a(filesInFolderRecursive);
|
|
}
|
|
}
|
|
|
|
public JSONObject c(zf zfVar) throws Exception {
|
|
if (zfVar.exists()) {
|
|
return IronSourceStorageUtils.buildFilesMapOfDirectory(zfVar, this.d.b());
|
|
}
|
|
throw new Exception("Folder does not exist");
|
|
}
|
|
|
|
public long d(zf zfVar) throws Exception {
|
|
if (zfVar.exists()) {
|
|
return IronSourceStorageUtils.getTotalSizeOfDir(zfVar);
|
|
}
|
|
throw new Exception("Folder does not exist");
|
|
}
|
|
}
|