jimu-decompiled/sources/com/bumptech/glide/load/resource/bitmap/HardwareConfigState.java
2025-05-13 19:24:51 +02:00

60 lines
1.9 KiB
Java

package com.bumptech.glide.load.resource.bitmap;
import android.annotation.TargetApi;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Build;
import android.util.Log;
import com.baidu.cloud.media.player.IMediaPlayer;
import com.bumptech.glide.load.DecodeFormat;
import java.io.File;
/* loaded from: classes.dex */
final class HardwareConfigState {
private static final File c = new File("/proc/self/fd");
private static volatile HardwareConfigState d;
private volatile int a;
private volatile boolean b = true;
private HardwareConfigState() {
}
static HardwareConfigState a() {
if (d == null) {
synchronized (HardwareConfigState.class) {
if (d == null) {
d = new HardwareConfigState();
}
}
}
return d;
}
private synchronized boolean b() {
int i = this.a + 1;
this.a = i;
if (i >= 50) {
this.a = 0;
int length = c.list().length;
this.b = length < 700;
if (!this.b && Log.isLoggable("Downsampler", 5)) {
Log.w("Downsampler", "Excluding HARDWARE bitmap config because we're over the file descriptor limit, file descriptors " + length + ", limit " + IMediaPlayer.MEDIA_INFO_VIDEO_TRACK_LAGGING);
}
}
return this.b;
}
@TargetApi(26)
boolean a(int i, int i2, BitmapFactory.Options options, DecodeFormat decodeFormat, boolean z, boolean z2) {
if (!z || Build.VERSION.SDK_INT < 26 || decodeFormat == DecodeFormat.PREFER_ARGB_8888_DISALLOW_HARDWARE || z2) {
return false;
}
boolean z3 = i >= 128 && i2 >= 128 && b();
if (z3) {
options.inPreferredConfig = Bitmap.Config.HARDWARE;
options.inMutable = false;
}
return z3;
}
}