package c.e.b;

import a.a.a.a.c.c0;
import a.b.b.l.c.a0;
import a.b.b.l.c.h;
import a.b.b.l.c.i;
import a.b.b.l.c.l;
import a.b.b.l.c.m;
import a.b.b.l.c.n;
import a.b.b.l.c.r;
import a.b.b.l.c.x;
import a.b.b.l.c.y;
import a.b.b.l.c.z;
import a.e.a.j;
import a.e.a.k;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Paint;
import android.net.Uri;
import android.os.Build;
import android.os.CancellationSignal;
import android.os.ParcelFileDescriptor;
import android.os.Process;
import android.os.StrictMode;
import android.os.Trace;
import android.util.Base64;
import android.util.Log;
import android.util.Xml;
import android.view.ActionMode;
import android.view.View;
import android.view.ViewParent;
import android.widget.TextView;
import c.e.g.a;
import com.cvte.vman.instance.InvokeCmd;
import com.google.gson.internal.bind.TypeAdapters;
import com.seewo.libmcuservice.constant.IMcuConstants;
import com.seewo.vcommons.executor.ButtonActionExecutor;
import com.seewo.vcommons.mstar.MKeyEvent;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

/* JADX INFO: loaded from: classes.dex */
public final class a {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static long f5162a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static Method f5163b;

    public static /* synthetic */ void A(c0 c0Var, String str, String str2, String str3, int i2, Object obj) {
        int i3 = i2 & 4;
        c0Var.d(str, str2, null);
    }

    public static void B(TextView textView, int i2) {
        d(i2);
        if (Build.VERSION.SDK_INT >= 28) {
            textView.setFirstBaselineToTopHeight(i2);
            return;
        }
        Paint.FontMetricsInt fontMetricsInt = textView.getPaint().getFontMetricsInt();
        int i3 = textView.getIncludeFontPadding() ? fontMetricsInt.top : fontMetricsInt.ascent;
        if (i2 > Math.abs(i3)) {
            textView.setPadding(textView.getPaddingLeft(), i2 + i3, textView.getPaddingRight(), textView.getPaddingBottom());
        }
    }

    public static void C(TextView textView, int i2) {
        d(i2);
        Paint.FontMetricsInt fontMetricsInt = textView.getPaint().getFontMetricsInt();
        int i3 = textView.getIncludeFontPadding() ? fontMetricsInt.bottom : fontMetricsInt.descent;
        if (i2 > Math.abs(i3)) {
            textView.setPadding(textView.getPaddingLeft(), textView.getPaddingTop(), textView.getPaddingRight(), i2 - i3);
        }
    }

    public static void D(TextView textView, int i2) {
        d(i2);
        if (i2 != textView.getPaint().getFontMetricsInt(null)) {
            textView.setLineSpacing(i2 - r0, 1.0f);
        }
    }

    public static void E(TextView textView, c.e.g.a aVar) {
        if (Build.VERSION.SDK_INT >= 29) {
            Objects.requireNonNull(aVar);
            textView.setText((CharSequence) null);
        } else {
            a.C0067a c0067aK = k(textView);
            Objects.requireNonNull(aVar);
            c0067aK.a(null);
            throw null;
        }
    }

    public static void F(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        int i2 = 1;
        while (i2 > 0) {
            int next = xmlPullParser.next();
            if (next == 2) {
                i2++;
            } else if (next == 3) {
                i2--;
            }
        }
    }

    public static List<byte[]> G(String[] strArr) {
        ArrayList arrayList = new ArrayList();
        for (String str : strArr) {
            arrayList.add(Base64.decode(str, 0));
        }
        return arrayList;
    }

    public static String H(int i2) {
        char[] cArr = new char[2];
        for (int i3 = 0; i3 < 2; i3++) {
            cArr[1 - i3] = Character.forDigit(i2 & 15, 16);
            i2 >>= 4;
        }
        return new String(cArr);
    }

    public static String I(int i2) {
        char[] cArr = new char[4];
        for (int i3 = 0; i3 < 4; i3++) {
            cArr[3 - i3] = Character.forDigit(i2 & 15, 16);
            i2 >>= 4;
        }
        return new String(cArr);
    }

    public static String J(int i2) {
        return i2 == ((char) i2) ? I(i2) : K(i2);
    }

    public static String K(int i2) {
        char[] cArr = new char[8];
        for (int i3 = 0; i3 < 8; i3++) {
            cArr[7 - i3] = Character.forDigit(i2 & 15, 16);
            i2 >>= 4;
        }
        return new String(cArr);
    }

    public static String L(long j2) {
        char[] cArr = new char[16];
        for (int i2 = 0; i2 < 16; i2++) {
            cArr[15 - i2] = Character.forDigit(((int) j2) & 15, 16);
            j2 >>= 4;
        }
        return new String(cArr);
    }

    public static String M(int i2) {
        return new String(new char[]{Character.forDigit(i2 & 15, 16)});
    }

    public static int N(int i2) {
        int i3 = i2 >> 7;
        int i4 = 0;
        while (i3 != 0) {
            i3 >>= 7;
            i4++;
        }
        return i4 + 1;
    }

    public static ActionMode.Callback O(TextView textView, ActionMode.Callback callback) {
        return (Build.VERSION.SDK_INT > 27 || (callback instanceof c.e.j.d) || callback == null) ? callback : new c.e.j.d(callback, textView);
    }

    public static void P(a.b.a.c.a aVar, int i2, long j2) {
        int iNumberOfTrailingZeros = 64 - Long.numberOfTrailingZeros(j2);
        if (iNumberOfTrailingZeros == 0) {
            iNumberOfTrailingZeros = 1;
        }
        int i3 = (iNumberOfTrailingZeros + 7) >> 3;
        long j3 = j2 >> (64 - (i3 * 8));
        a.b.b.n.c cVar = (a.b.b.n.c) aVar;
        cVar.j(i2 | ((i3 - 1) << 5));
        while (i3 > 0) {
            cVar.j((byte) j3);
            j3 >>= 8;
            i3--;
        }
    }

    public static void Q(a.b.a.c.a aVar, int i2, long j2) {
        int iNumberOfLeadingZeros = 64 - Long.numberOfLeadingZeros(j2);
        if (iNumberOfLeadingZeros == 0) {
            iNumberOfLeadingZeros = 1;
        }
        int i3 = (iNumberOfLeadingZeros + 7) >> 3;
        a.b.b.n.c cVar = (a.b.b.n.c) aVar;
        cVar.j(i2 | ((i3 - 1) << 5));
        while (i3 > 0) {
            cVar.j((byte) j2);
            j2 >>= 8;
            i3--;
        }
    }

    public static String a(byte[] bArr) {
        StringBuilder sb = new StringBuilder();
        for (byte b2 : bArr) {
            String hexString = Integer.toHexString(b2 & IMcuConstants.DEFAULT_VALUE);
            sb.append("0x");
            if (hexString.length() == 1) {
                sb.append("0");
            }
            sb.append(hexString);
            sb.append(" ");
        }
        return sb.toString().toUpperCase();
    }

    public static String b(byte b2) {
        StringBuilder sb = new StringBuilder();
        String hexString = Integer.toHexString(b2 & IMcuConstants.DEFAULT_VALUE);
        sb.append("0x");
        if (hexString.length() == 1) {
            sb.append("0");
        }
        sb.append(hexString);
        sb.append(" ");
        return sb.toString().toUpperCase();
    }

    public static void c(boolean z) {
        if (!z) {
            throw new IllegalArgumentException();
        }
    }

    public static int d(int i2) {
        if (i2 >= 0) {
            return i2;
        }
        throw new IllegalArgumentException();
    }

    public static boolean e(File file, Resources resources, int i2) throws Throwable {
        InputStream inputStreamOpenRawResource;
        try {
            inputStreamOpenRawResource = resources.openRawResource(i2);
        } catch (Throwable th) {
            th = th;
            inputStreamOpenRawResource = null;
        }
        try {
            boolean zF = f(file, inputStreamOpenRawResource);
            if (inputStreamOpenRawResource != null) {
                try {
                    inputStreamOpenRawResource.close();
                } catch (IOException unused) {
                }
            }
            return zF;
        } catch (Throwable th2) {
            th = th2;
            if (inputStreamOpenRawResource != null) {
                try {
                    inputStreamOpenRawResource.close();
                } catch (IOException unused2) {
                }
            }
            throw th;
        }
    }

    public static boolean f(File file, InputStream inputStream) throws Throwable {
        FileOutputStream fileOutputStream;
        StrictMode.ThreadPolicy threadPolicyAllowThreadDiskWrites = StrictMode.allowThreadDiskWrites();
        FileOutputStream fileOutputStream2 = null;
        try {
            try {
                fileOutputStream = new FileOutputStream(file, false);
            } catch (IOException e2) {
                e = e2;
            }
        } catch (Throwable th) {
            th = th;
        }
        try {
            byte[] bArr = new byte[1024];
            while (true) {
                int i2 = inputStream.read(bArr);
                if (i2 == -1) {
                    break;
                }
                fileOutputStream.write(bArr, 0, i2);
            }
            try {
                fileOutputStream.close();
            } catch (IOException unused) {
            }
            StrictMode.setThreadPolicy(threadPolicyAllowThreadDiskWrites);
            return true;
        } catch (IOException e3) {
            e = e3;
            fileOutputStream2 = fileOutputStream;
            Log.e("TypefaceCompatUtil", "Error copying resource contents to temp file: " + e.getMessage());
            if (fileOutputStream2 != null) {
                try {
                    fileOutputStream2.close();
                } catch (IOException unused2) {
                }
            }
            StrictMode.setThreadPolicy(threadPolicyAllowThreadDiskWrites);
            return false;
        } catch (Throwable th2) {
            th = th2;
            fileOutputStream2 = fileOutputStream;
            if (fileOutputStream2 != null) {
                try {
                    fileOutputStream2.close();
                } catch (IOException unused3) {
                }
            }
            StrictMode.setThreadPolicy(threadPolicyAllowThreadDiskWrites);
            throw th;
        }
    }

    public static boolean g(int[] iArr, int i2) {
        return (iArr[i2 >> 5] & (1 << (i2 & 31))) != 0;
    }

    public static a0 i(Object obj) {
        if (obj == null) {
            return n.f4316b;
        }
        if (obj instanceof Boolean) {
            return ((Boolean) obj).booleanValue() ? a.b.b.l.c.e.f4308d : a.b.b.l.c.e.f4307c;
        }
        if (obj instanceof Byte) {
            return new a.b.b.l.c.f(((Byte) obj).byteValue());
        }
        if (obj instanceof Character) {
            return new h(((Character) obj).charValue());
        }
        if (obj instanceof Double) {
            return new i(Double.doubleToLongBits(((Double) obj).doubleValue()));
        }
        if (obj instanceof Float) {
            return new l(Float.floatToIntBits(((Float) obj).floatValue()));
        }
        if (obj instanceof Integer) {
            return m.i(((Integer) obj).intValue());
        }
        if (obj instanceof Long) {
            return new r(((Long) obj).longValue());
        }
        if (obj instanceof Short) {
            return new x(((Short) obj).shortValue());
        }
        if (obj instanceof String) {
            return new y((String) obj);
        }
        if (obj instanceof Class) {
            return new z(a.b.b.h.a((Class) obj).m);
        }
        if (obj instanceof a.b.b.h) {
            return new z(((a.b.b.h) obj).m);
        }
        throw new UnsupportedOperationException("Not a constant: " + obj);
    }

    public static File j(Context context) {
        File cacheDir = context.getCacheDir();
        if (cacheDir == null) {
            return null;
        }
        StringBuilder sbC = a.b.c.a.a.C(".font");
        sbC.append(Process.myPid());
        sbC.append("-");
        sbC.append(Process.myTid());
        sbC.append("-");
        String string = sbC.toString();
        for (int i2 = 0; i2 < 100; i2++) {
            File file = new File(cacheDir, a.b.c.a.a.o(string, i2));
            if (file.createNewFile()) {
                return file;
            }
        }
        return null;
    }

    /* JADX WARN: Removed duplicated region for block: B:24:0x0067  */
    /* JADX WARN: Removed duplicated region for block: B:26:0x006d  */
    /* JADX WARN: Removed duplicated region for block: B:28:0x0073  */
    /* JADX WARN: Removed duplicated region for block: B:8:0x002b  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public static c.e.g.a.C0067a k(android.widget.TextView r7) {
        /*
            int r0 = android.os.Build.VERSION.SDK_INT
            r1 = 28
            if (r0 < r1) goto L10
            c.e.g.a$a r0 = new c.e.g.a$a
            android.text.PrecomputedText$Params r7 = r7.getTextMetricsParams()
            r0.<init>(r7)
            return r0
        L10:
            android.text.TextPaint r2 = new android.text.TextPaint
            android.text.TextPaint r3 = r7.getPaint()
            r2.<init>(r3)
            android.text.TextDirectionHeuristic r3 = android.text.TextDirectionHeuristics.FIRSTSTRONG_LTR
            int r3 = r7.getBreakStrategy()
            int r4 = r7.getHyphenationFrequency()
            android.text.method.TransformationMethod r5 = r7.getTransformationMethod()
            boolean r5 = r5 instanceof android.text.method.PasswordTransformationMethod
            if (r5 == 0) goto L2e
        L2b:
            android.text.TextDirectionHeuristic r7 = android.text.TextDirectionHeuristics.LTR
            goto L75
        L2e:
            r5 = 0
            r6 = 1
            if (r0 < r1) goto L57
            int r0 = r7.getInputType()
            r0 = r0 & 15
            r1 = 3
            if (r0 != r1) goto L57
            java.util.Locale r7 = r7.getTextLocale()
            android.icu.text.DecimalFormatSymbols r7 = android.icu.text.DecimalFormatSymbols.getInstance(r7)
            java.lang.String[] r7 = r7.getDigitStrings()
            r7 = r7[r5]
            int r7 = r7.codePointAt(r5)
            byte r7 = java.lang.Character.getDirectionality(r7)
            if (r7 == r6) goto L6d
            r0 = 2
            if (r7 != r0) goto L2b
            goto L6d
        L57:
            int r0 = r7.getLayoutDirection()
            if (r0 != r6) goto L5e
            r5 = r6
        L5e:
            int r7 = r7.getTextDirection()
            switch(r7) {
                case 2: goto L70;
                case 3: goto L2b;
                case 4: goto L6d;
                case 5: goto L6a;
                case 6: goto L73;
                case 7: goto L67;
                default: goto L65;
            }
        L65:
            if (r5 == 0) goto L73
        L67:
            android.text.TextDirectionHeuristic r7 = android.text.TextDirectionHeuristics.FIRSTSTRONG_RTL
            goto L75
        L6a:
            android.text.TextDirectionHeuristic r7 = android.text.TextDirectionHeuristics.LOCALE
            goto L75
        L6d:
            android.text.TextDirectionHeuristic r7 = android.text.TextDirectionHeuristics.RTL
            goto L75
        L70:
            android.text.TextDirectionHeuristic r7 = android.text.TextDirectionHeuristics.ANYRTL_LTR
            goto L75
        L73:
            android.text.TextDirectionHeuristic r7 = android.text.TextDirectionHeuristics.FIRSTSTRONG_LTR
        L75:
            c.e.g.a$a r0 = new c.e.g.a$a
            r0.<init>(r2, r7, r3, r4)
            return r0
        */
        throw new UnsupportedOperationException("Method not decompiled: c.e.b.a.k(android.widget.TextView):c.e.g.a$a");
    }

    public static DateFormat l(int i2, int i3) {
        String str;
        String str2;
        StringBuilder sb = new StringBuilder();
        if (i2 == 0) {
            str = "EEEE, MMMM d, yyyy";
        } else if (i2 == 1) {
            str = "MMMM d, yyyy";
        } else if (i2 == 2) {
            str = "MMM d, yyyy";
        } else {
            if (i2 != 3) {
                throw new IllegalArgumentException(a.b.c.a.a.o("Unknown DateFormat style: ", i2));
            }
            str = "M/d/yy";
        }
        sb.append(str);
        sb.append(" ");
        if (i3 == 0 || i3 == 1) {
            str2 = "h:mm:ss a z";
        } else if (i3 == 2) {
            str2 = "h:mm:ss a";
        } else {
            if (i3 != 3) {
                throw new IllegalArgumentException(a.b.c.a.a.o("Unknown DateFormat style: ", i3));
            }
            str2 = "h:mm a";
        }
        sb.append(str2);
        return new SimpleDateFormat(sb.toString(), Locale.US);
    }

    public static String m(int i2, int i3, int i4) {
        StringBuilder sb = new StringBuilder(80);
        int i5 = (~i3) & i2;
        int i6 = i2 & i3;
        if ((i6 & 1) != 0) {
            sb.append("|public");
        }
        if ((i6 & 2) != 0) {
            sb.append("|private");
        }
        if ((i6 & 4) != 0) {
            sb.append("|protected");
        }
        if ((i6 & 8) != 0) {
            sb.append("|static");
        }
        if ((i6 & 16) != 0) {
            sb.append("|final");
        }
        if ((i6 & 32) != 0) {
            sb.append(i4 == 1 ? "|super" : "|synchronized");
        }
        if ((i6 & 64) != 0) {
            sb.append(i4 == 3 ? "|bridge" : "|volatile");
        }
        if ((i6 & 128) != 0) {
            sb.append(i4 == 3 ? "|varargs" : "|transient");
        }
        if ((i6 & MKeyEvent.KEYCODE_EPG) != 0) {
            sb.append("|native");
        }
        if ((i6 & 512) != 0) {
            sb.append("|interface");
        }
        if ((i6 & 1024) != 0) {
            sb.append("|abstract");
        }
        if ((i6 & 2048) != 0) {
            sb.append("|strictfp");
        }
        if ((i6 & 4096) != 0) {
            sb.append("|synthetic");
        }
        if ((i6 & InvokeCmd.CMD_TOUCH_CTRL_START) != 0) {
            sb.append("|annotation");
        }
        if ((i6 & 16384) != 0) {
            sb.append("|enum");
        }
        if ((65536 & i6) != 0) {
            sb.append("|constructor");
        }
        if ((i6 & 131072) != 0) {
            sb.append("|declared_synchronized");
        }
        if (i5 != 0 || sb.length() == 0) {
            sb.append('|');
            sb.append(I(i5));
        }
        return sb.substring(1);
    }

    public static boolean n() {
        String str;
        if (Build.VERSION.SDK_INT >= 33) {
            try {
                str = (String) Class.forName("android.os.SystemProperties").getMethod("get", String.class, String.class).invoke(null, "ro.boot.selinux", "permissive");
            } catch (Exception unused) {
                Log.e("SelinuxProUtil", "get prop error");
                str = "";
            }
            if ("enforcing".equals(str)) {
                return true;
            }
        }
        return false;
    }

    @SuppressLint({"NewApi"})
    public static boolean o() {
        try {
            if (f5163b == null) {
                return Trace.isEnabled();
            }
        } catch (NoClassDefFoundError | NoSuchMethodError unused) {
        }
        try {
            if (f5163b == null) {
                f5162a = Trace.class.getField("TRACE_TAG_APP").getLong(null);
                f5163b = Trace.class.getMethod("isTagEnabled", Long.TYPE);
            }
            return ((Boolean) f5163b.invoke(null, Long.valueOf(f5162a))).booleanValue();
        } catch (Exception e2) {
            if (!(e2 instanceof InvocationTargetException)) {
                Log.v("Trace", "Unable to call isTagEnabled via reflection", e2);
                return false;
            }
            Throwable cause = e2.getCause();
            if (cause instanceof RuntimeException) {
                throw ((RuntimeException) cause);
            }
            throw new RuntimeException(cause);
        }
    }

    public static boolean p(int i2) {
        int i3;
        if (i2 < -1) {
            return false;
        }
        return i2 == -1 || (i3 = i2 & MKeyEvent.KEYCODE_SLEEP) == 0 || i3 == 255 || (i2 & 65280) == 0;
    }

    public static ByteBuffer q(Context context, CancellationSignal cancellationSignal, Uri uri) {
        try {
            ParcelFileDescriptor parcelFileDescriptorOpenFileDescriptor = context.getContentResolver().openFileDescriptor(uri, "r", cancellationSignal);
            if (parcelFileDescriptorOpenFileDescriptor == null) {
                if (parcelFileDescriptorOpenFileDescriptor != null) {
                    parcelFileDescriptorOpenFileDescriptor.close();
                }
                return null;
            }
            try {
                FileInputStream fileInputStream = new FileInputStream(parcelFileDescriptorOpenFileDescriptor.getFileDescriptor());
                try {
                    FileChannel channel = fileInputStream.getChannel();
                    MappedByteBuffer map = channel.map(FileChannel.MapMode.READ_ONLY, 0L, channel.size());
                    fileInputStream.close();
                    parcelFileDescriptorOpenFileDescriptor.close();
                    return map;
                } finally {
                }
            } finally {
            }
        } catch (IOException unused) {
            return null;
        }
    }

    public static boolean r(ViewParent viewParent, View view, float f2, float f3, boolean z) {
        try {
            return viewParent.onNestedFling(view, f2, f3, z);
        } catch (AbstractMethodError e2) {
            Log.e("ViewParentCompat", "ViewParent " + viewParent + " does not implement interface method onNestedFling", e2);
            return false;
        }
    }

    public static boolean s(ViewParent viewParent, View view, float f2, float f3) {
        try {
            return viewParent.onNestedPreFling(view, f2, f3);
        } catch (AbstractMethodError e2) {
            Log.e("ViewParentCompat", "ViewParent " + viewParent + " does not implement interface method onNestedPreFling", e2);
            return false;
        }
    }

    public static void t(ViewParent viewParent, View view, int i2, int i3, int[] iArr, int i4) {
        if (viewParent instanceof c.e.i.g) {
            ((c.e.i.g) viewParent).c(view, i2, i3, iArr, i4);
            return;
        }
        if (i4 == 0) {
            try {
                viewParent.onNestedPreScroll(view, i2, i3, iArr);
            } catch (AbstractMethodError e2) {
                Log.e("ViewParentCompat", "ViewParent " + viewParent + " does not implement interface method onNestedPreScroll", e2);
            }
        }
    }

    public static void u(ViewParent viewParent, View view, int i2, int i3, int i4, int i5, int i6, int[] iArr) {
        if (viewParent instanceof c.e.i.h) {
            ((c.e.i.h) viewParent).e(view, i2, i3, i4, i5, i6, iArr);
            return;
        }
        iArr[0] = iArr[0] + i4;
        iArr[1] = iArr[1] + i5;
        if (viewParent instanceof c.e.i.g) {
            ((c.e.i.g) viewParent).f(view, i2, i3, i4, i5, i6);
            return;
        }
        if (i6 == 0) {
            try {
                viewParent.onNestedScroll(view, i2, i3, i4, i5);
            } catch (AbstractMethodError e2) {
                Log.e("ViewParentCompat", "ViewParent " + viewParent + " does not implement interface method onNestedScroll", e2);
            }
        }
    }

    public static c.e.c.b.a v(XmlPullParser xmlPullParser, Resources resources) throws XmlPullParserException, IOException {
        int next;
        do {
            next = xmlPullParser.next();
            if (next == 2) {
                break;
            }
        } while (next != 1);
        if (next != 2) {
            throw new XmlPullParserException("No start tag found");
        }
        xmlPullParser.require(2, null, "font-family");
        if (xmlPullParser.getName().equals("font-family")) {
            TypedArray typedArrayObtainAttributes = resources.obtainAttributes(Xml.asAttributeSet(xmlPullParser), c.e.a.f5158b);
            String string = typedArrayObtainAttributes.getString(0);
            String string2 = typedArrayObtainAttributes.getString(4);
            String string3 = typedArrayObtainAttributes.getString(5);
            int resourceId = typedArrayObtainAttributes.getResourceId(1, 0);
            int integer = typedArrayObtainAttributes.getInteger(2, 1);
            int integer2 = typedArrayObtainAttributes.getInteger(3, 500);
            String string4 = typedArrayObtainAttributes.getString(6);
            typedArrayObtainAttributes.recycle();
            if (string != null && string2 != null && string3 != null) {
                while (xmlPullParser.next() != 3) {
                    F(xmlPullParser);
                }
                return new c.e.c.b.d(new c.e.f.e(string, string2, string3, y(resources, resourceId)), integer, integer2, string4);
            }
            ArrayList arrayList = new ArrayList();
            while (xmlPullParser.next() != 3) {
                if (xmlPullParser.getEventType() == 2) {
                    if (xmlPullParser.getName().equals("font")) {
                        TypedArray typedArrayObtainAttributes2 = resources.obtainAttributes(Xml.asAttributeSet(xmlPullParser), c.e.a.f5159c);
                        int i2 = typedArrayObtainAttributes2.getInt(typedArrayObtainAttributes2.hasValue(8) ? 8 : 1, ButtonActionExecutor.TIME_PAGE_CHANGED_DLEAYED);
                        boolean z = 1 == typedArrayObtainAttributes2.getInt(typedArrayObtainAttributes2.hasValue(6) ? 6 : 2, 0);
                        int i3 = typedArrayObtainAttributes2.hasValue(9) ? 9 : 3;
                        String string5 = typedArrayObtainAttributes2.getString(typedArrayObtainAttributes2.hasValue(7) ? 7 : 4);
                        int i4 = typedArrayObtainAttributes2.getInt(i3, 0);
                        int i5 = typedArrayObtainAttributes2.hasValue(5) ? 5 : 0;
                        int resourceId2 = typedArrayObtainAttributes2.getResourceId(i5, 0);
                        String string6 = typedArrayObtainAttributes2.getString(i5);
                        typedArrayObtainAttributes2.recycle();
                        while (xmlPullParser.next() != 3) {
                            F(xmlPullParser);
                        }
                        arrayList.add(new c.e.c.b.c(string6, i2, z, string5, i4, resourceId2));
                    } else {
                        F(xmlPullParser);
                    }
                }
            }
            if (!arrayList.isEmpty()) {
                return new c.e.c.b.b((c.e.c.b.c[]) arrayList.toArray(new c.e.c.b.c[arrayList.size()]));
            }
        } else {
            F(xmlPullParser);
        }
        return null;
    }

    public static a.e.a.i w(a.e.a.y.a aVar) {
        boolean z;
        try {
            try {
                aVar.Z();
                z = false;
            } catch (EOFException e2) {
                e = e2;
                z = true;
            }
            try {
                return TypeAdapters.X.a(aVar);
            } catch (EOFException e3) {
                e = e3;
                if (z) {
                    return k.f4436a;
                }
                throw new a.e.a.r(e);
            }
        } catch (a.e.a.y.d e4) {
            throw new a.e.a.r(e4);
        } catch (IOException e5) {
            throw new j(e5);
        } catch (NumberFormatException e6) {
            throw new a.e.a.r(e6);
        }
    }

    public static List<List<byte[]>> y(Resources resources, int i2) {
        if (i2 == 0) {
            return Collections.emptyList();
        }
        TypedArray typedArrayObtainTypedArray = resources.obtainTypedArray(i2);
        try {
            if (typedArrayObtainTypedArray.length() == 0) {
                return Collections.emptyList();
            }
            ArrayList arrayList = new ArrayList();
            if (typedArrayObtainTypedArray.getType(0) == 1) {
                for (int i3 = 0; i3 < typedArrayObtainTypedArray.length(); i3++) {
                    int resourceId = typedArrayObtainTypedArray.getResourceId(i3, 0);
                    if (resourceId != 0) {
                        arrayList.add(G(resources.getStringArray(resourceId)));
                    }
                }
            } else {
                arrayList.add(G(resources.getStringArray(i2)));
            }
            return arrayList;
        } finally {
            typedArrayObtainTypedArray.recycle();
        }
    }

    public static String z(int i2) {
        char[] cArr = new char[9];
        if (i2 < 0) {
            cArr[0] = '-';
            i2 = -i2;
        } else {
            cArr[0] = '+';
        }
        for (int i3 = 0; i3 < 8; i3++) {
            cArr[8 - i3] = Character.forDigit(i2 & 15, 16);
            i2 >>= 4;
        }
        return new String(cArr);
    }
}
