Rabbit-R1/android (non root)/java/sources/com/google/android/exoplayer2/util/LibraryLoader.java
2024-05-21 17:08:36 -04:00

38 lines
1.1 KiB
Java

package com.google.android.exoplayer2.util;
import java.util.Arrays;
/* loaded from: classes2.dex */
public abstract class LibraryLoader {
private static final String TAG = "LibraryLoader";
private boolean isAvailable;
private boolean loadAttempted;
private String[] nativeLibraries;
protected abstract void loadLibrary(String str);
public LibraryLoader(String... strArr) {
this.nativeLibraries = strArr;
}
public synchronized void setLibraries(String... strArr) {
Assertions.checkState(!this.loadAttempted, "Cannot set libraries after loading");
this.nativeLibraries = strArr;
}
public synchronized boolean isAvailable() {
if (this.loadAttempted) {
return this.isAvailable;
}
this.loadAttempted = true;
try {
for (String str : this.nativeLibraries) {
loadLibrary(str);
}
this.isAvailable = true;
} catch (UnsatisfiedLinkError unused) {
Log.w(TAG, "Failed to load " + Arrays.toString(this.nativeLibraries));
}
return this.isAvailable;
}
}