- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
127 lines
3.9 KiB
Java
127 lines
3.9 KiB
Java
package com.vungle.ads.internal.util;
|
|
|
|
import android.content.Context;
|
|
import android.os.StatFs;
|
|
import java.io.File;
|
|
import java.util.List;
|
|
import kotlin.collections.CollectionsKt__CollectionsKt;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public final class PathProvider {
|
|
private static final String CLEVER_CACHE_FOLDER = "clever_cache";
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final String DOWNLOADS_FOLDER = "downloads";
|
|
private static final String JS_FOLDER = "js";
|
|
private static final long UNKNOWN_SIZE = -1;
|
|
private static final String VUNGLE_FOLDER = "vungle_cache";
|
|
private final File cleverCacheDir;
|
|
private final Context context;
|
|
private final File downloadsDir;
|
|
private final File jsDir;
|
|
private final File vungleDir;
|
|
|
|
public final Context getContext() {
|
|
return this.context;
|
|
}
|
|
|
|
public PathProvider(Context context) {
|
|
List<File> listOf;
|
|
Intrinsics.checkNotNullParameter(context, "context");
|
|
this.context = context;
|
|
File file = new File(context.getNoBackupFilesDir(), VUNGLE_FOLDER);
|
|
this.vungleDir = file;
|
|
File file2 = new File(file, DOWNLOADS_FOLDER);
|
|
this.downloadsDir = file2;
|
|
File file3 = new File(file, JS_FOLDER);
|
|
this.jsDir = file3;
|
|
File file4 = new File(file, CLEVER_CACHE_FOLDER);
|
|
this.cleverCacheDir = file4;
|
|
listOf = CollectionsKt__CollectionsKt.listOf((Object[]) new File[]{file, file2, file3, file4});
|
|
for (File file5 : listOf) {
|
|
if (!file5.exists()) {
|
|
file5.mkdirs();
|
|
}
|
|
}
|
|
}
|
|
|
|
public static final class Companion {
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
private Companion() {
|
|
}
|
|
}
|
|
|
|
public final File getVungleDir() {
|
|
if (!this.vungleDir.exists()) {
|
|
this.vungleDir.mkdirs();
|
|
}
|
|
return this.vungleDir;
|
|
}
|
|
|
|
public final File getCleverCacheDir() {
|
|
if (!this.cleverCacheDir.exists()) {
|
|
this.cleverCacheDir.mkdirs();
|
|
}
|
|
return this.cleverCacheDir;
|
|
}
|
|
|
|
public final File getJsDir() {
|
|
if (!this.jsDir.exists()) {
|
|
this.jsDir.mkdirs();
|
|
}
|
|
return this.jsDir;
|
|
}
|
|
|
|
public final File getDownloadDir() {
|
|
if (!this.downloadsDir.exists()) {
|
|
this.downloadsDir.mkdirs();
|
|
}
|
|
return this.downloadsDir;
|
|
}
|
|
|
|
public final File getJsAssetDir(String jsVersion) {
|
|
Intrinsics.checkNotNullParameter(jsVersion, "jsVersion");
|
|
File file = new File(getJsDir(), jsVersion);
|
|
if (!file.exists()) {
|
|
file.mkdirs();
|
|
}
|
|
return file;
|
|
}
|
|
|
|
public final File getDownloadsDirForAd(String str) {
|
|
if (str == null || str.length() == 0) {
|
|
return null;
|
|
}
|
|
File file = new File(getDownloadDir().getPath() + File.separator + str);
|
|
if (!file.exists()) {
|
|
file.mkdirs();
|
|
}
|
|
return file;
|
|
}
|
|
|
|
public final File getSharedPrefsDir() {
|
|
File noBackupFilesDir = this.context.getNoBackupFilesDir();
|
|
Intrinsics.checkNotNullExpressionValue(noBackupFilesDir, "{\n context.noBackupFilesDir\n }");
|
|
return noBackupFilesDir;
|
|
}
|
|
|
|
public final File getUnclosedAdFile(String name) {
|
|
Intrinsics.checkNotNullParameter(name, "name");
|
|
return new File(getSharedPrefsDir(), name);
|
|
}
|
|
|
|
public final long getAvailableBytes(String path) {
|
|
Intrinsics.checkNotNullParameter(path, "path");
|
|
try {
|
|
return new StatFs(path).getAvailableBytes();
|
|
} catch (IllegalArgumentException e) {
|
|
Logger.Companion.w("PathProvider", "Failed to get available bytes " + e.getMessage());
|
|
return -1L;
|
|
}
|
|
}
|
|
}
|