Rabbit-R1/original r1/java/sources/androidx/media3/common/util/LibraryLoader.java
2024-05-21 17:08:36 -04:00

38 lines
1.1 KiB
Java

package androidx.media3.common.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;
}
}