package b7; import android.graphics.Bitmap; import android.os.Handler; import android.os.Looper; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Queue; /* loaded from: classes2.dex */ public abstract class k { /* renamed from: a, reason: collision with root package name */ private static final char[] f3329a = "0123456789abcdef".toCharArray(); /* renamed from: b, reason: collision with root package name */ private static final char[] f3330b = new char[64]; /* renamed from: c, reason: collision with root package name */ private static volatile Handler f3331c; static /* synthetic */ class a { /* renamed from: a, reason: collision with root package name */ static final /* synthetic */ int[] f3332a; static { Bitmap.Config config; int[] iArr = new int[Bitmap.Config.values().length]; f3332a = iArr; try { iArr[Bitmap.Config.ALPHA_8.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { f3332a[Bitmap.Config.RGB_565.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { f3332a[Bitmap.Config.ARGB_4444.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } try { int[] iArr2 = f3332a; config = Bitmap.Config.RGBA_F16; iArr2[config.ordinal()] = 4; } catch (NoSuchFieldError unused4) { } try { f3332a[Bitmap.Config.ARGB_8888.ordinal()] = 5; } catch (NoSuchFieldError unused5) { } } } private static int a(Bitmap.Config config) { if (config == null) { config = Bitmap.Config.ARGB_8888; } int i10 = a.f3332a[config.ordinal()]; if (i10 == 1) { return 1; } if (i10 == 2 || i10 == 3) { return 2; } return i10 != 4 ? 4 : 8; } private static Handler b() { if (f3331c == null) { synchronized (k.class) { if (f3331c == null) { f3331c = new Handler(Looper.getMainLooper()); } } } return f3331c; } private static String c(byte[] bArr, char[] cArr) { for (int i10 = 0; i10 < bArr.length; i10++) { int i11 = bArr[i10] & 255; int i12 = i10 * 2; char[] cArr2 = f3329a; cArr[i12] = cArr2[i11 >>> 4]; cArr[i12 + 1] = cArr2[i11 & 15]; } return new String(cArr); } private static boolean d(int i10) { return i10 > 0 || i10 == Integer.MIN_VALUE; } public static void e() { if (!r()) { throw new IllegalArgumentException("You must call this method on the main thread"); } } public static boolean f(Object obj, Object obj2) { return obj == null ? obj2 == null : obj.equals(obj2); } public static boolean g(Object obj, Object obj2) { return obj == null ? obj2 == null : obj.equals(obj2); } public static Queue h(int i10) { return new ArrayDeque(i10); } public static int i(int i10, int i11, Bitmap.Config config) { return i10 * i11 * a(config); } public static int j(Bitmap bitmap) { if (!bitmap.isRecycled()) { try { return bitmap.getAllocationByteCount(); } catch (NullPointerException unused) { return bitmap.getHeight() * bitmap.getRowBytes(); } } throw new IllegalStateException("Cannot obtain size for recycled Bitmap: " + bitmap + "[" + bitmap.getWidth() + "x" + bitmap.getHeight() + "] " + bitmap.getConfig()); } public static List k(Collection collection) { ArrayList arrayList = new ArrayList(collection.size()); for (Object obj : collection) { if (obj != null) { arrayList.add(obj); } } return arrayList; } public static int l(float f10) { return m(f10, 17); } public static int m(float f10, int i10) { return n(Float.floatToIntBits(f10), i10); } public static int n(int i10, int i11) { return (i11 * 31) + i10; } public static int o(Object obj, int i10) { return n(obj == null ? 0 : obj.hashCode(), i10); } public static int p(boolean z10, int i10) { return n(z10 ? 1 : 0, i10); } public static boolean q() { return !r(); } public static boolean r() { return Looper.myLooper() == Looper.getMainLooper(); } public static boolean s(int i10, int i11) { return d(i10) && d(i11); } public static void t(Runnable runnable) { b().post(runnable); } public static void u(Runnable runnable) { b().removeCallbacks(runnable); } public static String v(byte[] bArr) { String c10; char[] cArr = f3330b; synchronized (cArr) { c10 = c(bArr, cArr); } return c10; } }