discord-jadx/app/src/main/java/c/f/d/i/a.java

66 lines
1.8 KiB
Java

package c.f.d.i;
import android.os.Environment;
import android.os.StatFs;
import android.os.SystemClock;
import c.f.d.d.m;
import java.io.File;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/* compiled from: StatFsHelper */
public class a {
public static a a;
public static final long b = TimeUnit.MINUTES.toMillis(2);
/* renamed from: c reason: collision with root package name */
public volatile StatFs f367c = null;
public volatile File d;
public volatile StatFs e = null;
public volatile File f;
public long g;
public final Lock h = new ReentrantLock();
public volatile boolean i = false;
public final void a() {
if (!this.i) {
this.h.lock();
try {
if (!this.i) {
this.d = Environment.getDataDirectory();
this.f = Environment.getExternalStorageDirectory();
b();
this.i = true;
}
} finally {
this.h.unlock();
}
}
}
public final void b() {
this.f367c = c(this.f367c, this.d);
this.e = c(this.e, this.f);
this.g = SystemClock.uptimeMillis();
}
public final StatFs c(StatFs statFs, File file) {
if (file == null || !file.exists()) {
return null;
}
if (statFs == null) {
try {
statFs = new StatFs(file.getAbsolutePath());
} catch (IllegalArgumentException unused) {
return null;
} catch (Throwable th) {
m.a(th);
throw new RuntimeException(th);
}
} else {
statFs.restat(file.getAbsolutePath());
}
return statFs;
}
}