package o; import android.graphics.Bitmap; import android.os.Handler; import android.os.Looper; import com.google.common.primitives.UnsignedBytes; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Queue; /* loaded from: classes.dex */ public final class FKd { private static volatile Handler b; private static final char[] d = "0123456789abcdef".toCharArray(); private static final char[] e = new char[64]; public static int c(boolean z, int i) { return (i * 31) + (z ? 1 : 0); } public static boolean c(int i, int i2) { return (i > 0 || i == Integer.MIN_VALUE) && (i2 > 0 || i2 == Integer.MIN_VALUE); } public static int d(int i, int i2) { return (i2 * 31) + i; } private FKd() { } public static String a(byte[] bArr) { String str; char[] cArr = e; synchronized (cArr) { for (int i = 0; i < bArr.length; i++) { byte b2 = bArr[i]; int i2 = i << 1; char[] cArr2 = d; cArr[i2] = cArr2[(b2 & UnsignedBytes.MAX_VALUE) >>> 4]; cArr[i2 + 1] = cArr2[b2 & 15]; } str = new String(cArr); } return str; } public static int FX_(Bitmap bitmap) { if (bitmap.isRecycled()) { StringBuilder sb = new StringBuilder("Cannot obtain size for recycled Bitmap: "); sb.append(bitmap); sb.append("["); sb.append(bitmap.getWidth()); sb.append("x"); sb.append(bitmap.getHeight()); sb.append("] "); sb.append(bitmap.getConfig()); throw new IllegalStateException(sb.toString()); } try { return bitmap.getAllocationByteCount(); } catch (NullPointerException unused) { return bitmap.getHeight() * bitmap.getRowBytes(); } } public static int FW_(int i, int i2, Bitmap.Config config) { return i * i2 * FY_(config); } public static int FY_(Bitmap.Config config) { if (config == null) { config = Bitmap.Config.ARGB_8888; } int i = AnonymousClass5.b[config.ordinal()]; if (i == 1) { return 1; } if (i == 2 || i == 3) { return 2; } return i == 4 ? 8 : 4; } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.FKd$5, reason: invalid class name */ /* loaded from: classes.dex */ public static /* synthetic */ class AnonymousClass5 { static final int[] b; static { int[] iArr = new int[Bitmap.Config.values().length]; b = iArr; try { iArr[Bitmap.Config.ALPHA_8.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { b[Bitmap.Config.RGB_565.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { b[Bitmap.Config.ARGB_4444.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } try { b[Bitmap.Config.RGBA_F16.ordinal()] = 4; } catch (NoSuchFieldError unused4) { } try { b[Bitmap.Config.ARGB_8888.ordinal()] = 5; } catch (NoSuchFieldError unused5) { } } } public static void e(Runnable runnable) { FZ_().post(runnable); } public static void a(Runnable runnable) { FZ_().removeCallbacks(runnable); } private static Handler FZ_() { if (b == null) { synchronized (FKd.class) { if (b == null) { b = new Handler(Looper.getMainLooper()); } } } return b; } public static boolean e() { return Looper.myLooper() == Looper.getMainLooper(); } public static Queue e(int i) { return new ArrayDeque(i); } public static List b(Collection collection) { ArrayList arrayList = new ArrayList(collection.size()); for (T t : collection) { if (t != null) { arrayList.add(t); } } return arrayList; } public static boolean c(Object obj, Object obj2) { if (obj == null) { return obj2 == null; } return obj.equals(obj2); } public static boolean d(Object obj, Object obj2) { if (obj == null) { return obj2 == null; } if (obj instanceof InterfaceC0934Rvs) { return ((InterfaceC0934Rvs) obj).c(); } return obj.equals(obj2); } public static int e(Object obj, int i) { return (i * 31) + (obj == null ? 0 : obj.hashCode()); } public static void c() { if (!(!(Looper.myLooper() == Looper.getMainLooper()))) { throw new IllegalArgumentException("You must call this method on a background thread"); } } public static void d() { if (Looper.myLooper() != Looper.getMainLooper()) { throw new IllegalArgumentException("You must call this method on the main thread"); } } public static int d(float f) { return Float.floatToIntBits(f) + 527; } public static boolean a() { return !(Looper.myLooper() == Looper.getMainLooper()); } }