- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
187 lines
5.9 KiB
Java
187 lines
5.9 KiB
Java
package com.mbridge.msdk.foundation.tools;
|
|
|
|
import android.content.Context;
|
|
import android.os.Environment;
|
|
import android.os.StatFs;
|
|
import java.io.File;
|
|
import java.util.UUID;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public final class ai {
|
|
public static char[] a = {'P', 'a', 'c', 'k', 'a', 'g', 'e', 'M', 'a', 'n', 'a', 'g', 'e', 'r'};
|
|
static String b = "";
|
|
static boolean c = false;
|
|
private static int d = -1;
|
|
private static int e = -1;
|
|
private static boolean f = false;
|
|
private static int g = -1;
|
|
private static int h = -1;
|
|
|
|
public static int a() {
|
|
Context c2;
|
|
long longValue;
|
|
long currentTimeMillis;
|
|
try {
|
|
c2 = com.mbridge.msdk.foundation.controller.c.m().c();
|
|
longValue = ((Long) an.a(c2, "freeExternalSize", 0L)).longValue();
|
|
currentTimeMillis = System.currentTimeMillis();
|
|
} catch (Throwable th) {
|
|
af.b("SameSDCardTool", th.getMessage(), th);
|
|
}
|
|
if (currentTimeMillis - longValue <= 1800000) {
|
|
if (e == -1) {
|
|
}
|
|
return e;
|
|
}
|
|
e = Long.valueOf((c() / 1000) / 1000).intValue();
|
|
an.b(c2, "freeExternalSize", Long.valueOf(currentTimeMillis));
|
|
return e;
|
|
}
|
|
|
|
private static long c() {
|
|
if (d()) {
|
|
try {
|
|
StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
|
|
return statFs.getAvailableBlocks() * statFs.getBlockSize();
|
|
} catch (Exception e2) {
|
|
e2.printStackTrace();
|
|
}
|
|
}
|
|
return 0L;
|
|
}
|
|
|
|
private static boolean d() {
|
|
try {
|
|
return "mounted".equals(Environment.getExternalStorageState());
|
|
} catch (Exception unused) {
|
|
af.b("", "hasSDCard is failed");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public static int b() {
|
|
if (h == -1) {
|
|
try {
|
|
h = new Long((e() / 1000) / 1000).intValue();
|
|
} catch (Throwable th) {
|
|
af.b("SameSDCardTool", th.getMessage(), th);
|
|
}
|
|
}
|
|
return h;
|
|
}
|
|
|
|
private static long e() {
|
|
if (d()) {
|
|
try {
|
|
StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
|
|
return statFs.getBlockCount() * statFs.getBlockSize();
|
|
} catch (Exception e2) {
|
|
e2.printStackTrace();
|
|
}
|
|
}
|
|
return 0L;
|
|
}
|
|
|
|
public static void a(Context context) {
|
|
if (context == null || f) {
|
|
return;
|
|
}
|
|
try {
|
|
try {
|
|
b = context.getFilesDir().getAbsolutePath() + File.separator;
|
|
c = false;
|
|
b(context);
|
|
} catch (Exception unused) {
|
|
b = context.getFilesDir().getAbsolutePath() + File.separator;
|
|
b(context);
|
|
}
|
|
} catch (Exception unused2) {
|
|
}
|
|
f = true;
|
|
}
|
|
|
|
private static void b(Context context) {
|
|
com.mbridge.msdk.foundation.same.b.e.a(new com.mbridge.msdk.foundation.same.b.d(c(context)));
|
|
com.mbridge.msdk.foundation.same.b.e.a().b();
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:11:0x005d, code lost:
|
|
|
|
if (c() > 31457280) goto L16;
|
|
*/
|
|
/* JADX WARN: Removed duplicated region for block: B:8:0x0019 */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
private static java.lang.String c(android.content.Context r6) {
|
|
/*
|
|
r0 = 0
|
|
java.io.File r1 = r6.getExternalFilesDir(r0) // Catch: java.lang.Throwable -> Lc
|
|
if (r1 == 0) goto L14
|
|
java.io.File r1 = a(r1) // Catch: java.lang.Throwable -> Lc
|
|
goto L15
|
|
Lc:
|
|
r1 = move-exception
|
|
java.lang.String r2 = "common-exception"
|
|
java.lang.String r3 = "hasSDCard is failed"
|
|
com.mbridge.msdk.foundation.tools.af.b(r2, r3, r1)
|
|
L14:
|
|
r1 = r0
|
|
L15:
|
|
boolean r2 = com.mbridge.msdk.foundation.tools.ai.c
|
|
if (r2 == 0) goto L5f
|
|
if (r1 != 0) goto L54
|
|
java.lang.StringBuilder r1 = new java.lang.StringBuilder
|
|
r1.<init>()
|
|
java.io.File r2 = android.os.Environment.getExternalStorageDirectory()
|
|
java.lang.String r2 = r2.getPath()
|
|
r1.append(r2)
|
|
java.lang.String r2 = java.io.File.separator
|
|
r1.append(r2)
|
|
java.lang.String r3 = "Android"
|
|
r1.append(r3)
|
|
r1.append(r2)
|
|
java.lang.String r3 = "data"
|
|
r1.append(r3)
|
|
r1.append(r2)
|
|
java.lang.String r2 = r6.getPackageName()
|
|
r1.append(r2)
|
|
java.lang.String r1 = r1.toString()
|
|
java.io.File r2 = new java.io.File
|
|
r2.<init>(r1)
|
|
java.io.File r1 = a(r2)
|
|
L54:
|
|
long r2 = c()
|
|
r4 = 31457280(0x1e00000, double:1.55419614E-316)
|
|
int r2 = (r2 > r4 ? 1 : (r2 == r4 ? 0 : -1))
|
|
if (r2 <= 0) goto L60
|
|
L5f:
|
|
r0 = r1
|
|
L60:
|
|
if (r0 == 0) goto L68
|
|
boolean r1 = r0.exists()
|
|
if (r1 != 0) goto L70
|
|
L68:
|
|
java.io.File r6 = r6.getFilesDir()
|
|
java.io.File r0 = r6.getAbsoluteFile()
|
|
L70:
|
|
java.lang.String r6 = r0.getAbsolutePath()
|
|
return r6
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.mbridge.msdk.foundation.tools.ai.c(android.content.Context):java.lang.String");
|
|
}
|
|
|
|
private static File a(File file) {
|
|
File file2 = new File(file, UUID.randomUUID() + "");
|
|
if (file2.exists()) {
|
|
file2.delete();
|
|
}
|
|
if (!file2.mkdirs()) {
|
|
return null;
|
|
}
|
|
file2.delete();
|
|
return file.getAbsoluteFile();
|
|
}
|
|
}
|