APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:JioFiberPartner
版本号:5.2.0
包名称:com.jfp.prod

MD5 校验值:7cd346351ab05a28e42aff65173e0141

反编译源代码说明

a.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package h0;

import android.content.res.AssetManager;
import android.util.Log;
import androidx.exifinterface.media.ExifInterface;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TimeZone;
import java.util.regex.Pattern;
import jxl.SheetSettings;
import net.sourceforge.zbar.Config;

public class a {
    private static final c[] A;
    private static final c[] B;
    private static final c C;
    private static final c[] D;
    private static final c[] E;
    private static final c[] F;
    private static final c[] G;
    static final c[][] H;
    private static final c[] I;
    private static final HashMap<Integer, ExifInterface.ExifTag>[] J;
    private static final HashMap<String, ExifInterface.ExifTag>[] K;
    private static final HashSet<String> L;
    private static final HashMap<Integer, Integer> M;
    static final Charset N;
    static final byte[] O;

    private static SimpleDateFormat f8816t;

    private static final c[] f8820x;

    private static final c[] f8821y;

    private static final c[] f8822z;

    private final String f8823a;

    private final AssetManager.AssetInputStream f8824b;

    private int f8825c;

    private final HashMap<String, ExifInterface.ExifAttribute>[] f8826d;

    private Set<Integer> f8827e;

    private ByteOrder f8828f;

    private int f8829g;

    private int f8830h;

    private int f8831i;

    private int f8832j;

    private int f8833k;

    private int f8834l;

    private static final List<Integer> f8809m = Arrays.asList(1, 6, 3, 8);

    private static final List<Integer> f8810n = Arrays.asList(2, 7, 4, 5);

    public static final int[] f8811o = {8, 8, 8};

    public static final int[] f8812p = {8};

    static final byte[] f8813q = {-1, -40, -1};

    private static final byte[] f8814r = {79, 76, 89, 77, 80, 0};

    private static final byte[] f8815s = {79, 76, 89, 77, 80, 85, 83, 0, 73, 73};

    static final String[] f8817u = {"", "BYTE", "STRING", "USHORT", "ULONG", "URATIONAL", "SBYTE", "UNDEFINED", "SSHORT", "SLONG", "SRATIONAL", "SINGLE", "DOUBLE"};

    static final int[] f8818v = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 1};

    static final byte[] f8819w = {65, 83, 67, 73, 73, 0, 0, 0};

    public static class b {

        public final int f8841a;

        public final int f8842b;

        public final byte[] f8843c;

        b(int i10, int i11, byte[] bArr) {
            this.f8841a = i10;
            this.f8842b = i11;
            this.f8843c = bArr;
        }

        public static b a(String str) {
            byte[] bytes = (str + (char) 0).getBytes(a.N);
            return new b(2, bytes.length, bytes);
        }

        public static b b(long j10, ByteOrder byteOrder) {
            return c(new long[]{j10}, byteOrder);
        }

        public static b c(long[] jArr, ByteOrder byteOrder) {
            ByteBuffer wrap = ByteBuffer.wrap(new byte[a.f8818v[4] * jArr.length]);
            wrap.order(byteOrder);
            for (long j10 : jArr) {
                wrap.putInt((int) j10);
            }
            return new b(4, jArr.length, wrap.array());
        }

        public static b d(d dVar, ByteOrder byteOrder) {
            return e(new d[]{dVar}, byteOrder);
        }

        public static b e(d[] dVarArr, ByteOrder byteOrder) {
            ByteBuffer wrap = ByteBuffer.wrap(new byte[a.f8818v[5] * dVarArr.length]);
            wrap.order(byteOrder);
            for (d dVar : dVarArr) {
                wrap.putInt((int) dVar.f8848a);
                wrap.putInt((int) dVar.f8849b);
            }
            return new b(5, dVarArr.length, wrap.array());
        }

        public static b f(int i10, ByteOrder byteOrder) {
            return g(new int[]{i10}, byteOrder);
        }

        public static b g(int[] iArr, ByteOrder byteOrder) {
            ByteBuffer wrap = ByteBuffer.wrap(new byte[a.f8818v[3] * iArr.length]);
            wrap.order(byteOrder);
            for (int i10 : iArr) {
                wrap.putShort((short) i10);
            }
            return new b(3, iArr.length, wrap.array());
        }

        public double h(ByteOrder byteOrder) {
            Object k10 = k(byteOrder);
            if (k10 != null) {
                if (k10 instanceof String) {
                    return Double.parseDouble((String) k10);
                }
                if (k10 instanceof long[]) {
                    if (((long[]) k10).length == 1) {
                        return r5[0];
                    }
                    throw new NumberFormatException("There are more than one component");
                }
                if (k10 instanceof int[]) {
                    if (((int[]) k10).length == 1) {
                        return r5[0];
                    }
                    throw new NumberFormatException("There are more than one component");
                }
                if (k10 instanceof double[]) {
                    double[] dArr = (double[]) k10;
                    if (dArr.length == 1) {
                        return dArr[0];
                    }
                    throw new NumberFormatException("There are more than one component");
                }
                if (k10 instanceof d[]) {
                    d[] dVarArr = (d[]) k10;
                    if (dVarArr.length == 1) {
                        return dVarArr[0].a();
                    }
                    throw new NumberFormatException("There are more than one component");
                }
                throw new NumberFormatException("Couldn't find a double value");
            }
            throw new NumberFormatException("NULL can't be converted to a double value");
        }

        public int i(ByteOrder byteOrder) {
            Object k10 = k(byteOrder);
            if (k10 != null) {
                if (k10 instanceof String) {
                    return Integer.parseInt((String) k10);
                }
                if (k10 instanceof long[]) {
                    long[] jArr = (long[]) k10;
                    if (jArr.length == 1) {
                        return (int) jArr[0];
                    }
                    throw new NumberFormatException("There are more than one component");
                }
                if (k10 instanceof int[]) {
                    int[] iArr = (int[]) k10;
                    if (iArr.length == 1) {
                        return iArr[0];
                    }
                    throw new NumberFormatException("There are more than one component");
                }
                throw new NumberFormatException("Couldn't find a integer value");
            }
            throw new NumberFormatException("NULL can't be converted to a integer value");
        }

        public String j(ByteOrder byteOrder) {
            Object k10 = k(byteOrder);
            if (k10 == null) {
                return null;
            }
            if (k10 instanceof String) {
                return (String) k10;
            }
            StringBuilder sb = new StringBuilder();
            int i10 = 0;
            if (k10 instanceof long[]) {
                long[] jArr = (long[]) k10;
                while (i10 < jArr.length) {
                    sb.append(jArr[i10]);
                    i10++;
                    if (i10 != jArr.length) {
                        sb.append(",");
                    }
                }
                return sb.toString();
            }
            if (k10 instanceof int[]) {
                int[] iArr = (int[]) k10;
                while (i10 < iArr.length) {
                    sb.append(iArr[i10]);
                    i10++;
                    if (i10 != iArr.length) {
                        sb.append(",");
                    }
                }
                return sb.toString();
            }
            if (k10 instanceof double[]) {
                double[] dArr = (double[]) k10;
                while (i10 < dArr.length) {
                    sb.append(dArr[i10]);
                    i10++;
                    if (i10 != dArr.length) {
                        sb.append(",");
                    }
                }
                return sb.toString();
            }
            if (!(k10 instanceof d[])) {
                return null;
            }
            d[] dVarArr = (d[]) k10;
            while (i10 < dVarArr.length) {
                sb.append(dVarArr[i10].f8848a);
                sb.append('/');
                sb.append(dVarArr[i10].f8849b);
                i10++;
                if (i10 != dVarArr.length) {
                    sb.append(",");
                }
            }
            return sb.toString();
        }

        Object k(ByteOrder byteOrder) {
            C0142a c0142a;
            InputStream inputStream;
            byte b10;
            byte[] bArr;
            InputStream inputStream2 = null;
            try {
                try {
                    c0142a = new C0142a(this.f8843c);
                    try {
                        c0142a.h(byteOrder);
                        boolean z9 = true;
                        int i10 = 0;
                        switch (this.f8841a) {
                            case 1:
                            case 6:
                                byte[] bArr2 = this.f8843c;
                                if (bArr2.length == 1 && bArr2[0] >= 0 && bArr2[0] <= 1) {
                                    String str = new String(new char[]{(char) (bArr2[0] + 48)});
                                    try {
                                        c0142a.close();
                                    } catch (IOException e10) {
                                        Log.e("ExifInterface", "IOException occurred while closing InputStream", e10);
                                    }
                                    return str;
                                }
                                String str2 = new String(bArr2, a.N);
                                try {
                                    c0142a.close();
                                } catch (IOException e11) {
                                    Log.e("ExifInterface", "IOException occurred while closing InputStream", e11);
                                }
                                return str2;
                            case 2:
                            case 7:
                                if (this.f8842b >= a.f8819w.length) {
                                    int i11 = 0;
                                    while (true) {
                                        bArr = a.f8819w;
                                        if (i11 < bArr.length) {
                                            if (this.f8843c[i11] != bArr[i11]) {
                                                z9 = false;
                                            } else {
                                                i11++;
                                            }
                                        }
                                    }
                                    if (z9) {
                                        i10 = bArr.length;
                                    }
                                }
                                StringBuilder sb = new StringBuilder();
                                while (i10 < this.f8842b && (b10 = this.f8843c[i10]) != 0) {
                                    if (b10 >= 32) {
                                        sb.append((char) b10);
                                    } else {
                                        sb.append('?');
                                    }
                                    i10++;
                                }
                                String sb2 = sb.toString();
                                try {
                                    c0142a.close();
                                } catch (IOException e12) {
                                    Log.e("ExifInterface", "IOException occurred while closing InputStream", e12);
                                }
                                return sb2;
                            case 3:
                                int[] iArr = new int[this.f8842b];
                                while (i10 < this.f8842b) {
                                    iArr[i10] = c0142a.readUnsignedShort();
                                    i10++;
                                }
                                try {
                                    c0142a.close();
                                } catch (IOException e13) {
                                    Log.e("ExifInterface", "IOException occurred while closing InputStream", e13);
                                }
                                return iArr;
                            case 4:
                                long[] jArr = new long[this.f8842b];
                                while (i10 < this.f8842b) {
                                    jArr[i10] = c0142a.d();
                                    i10++;
                                }
                                try {
                                    c0142a.close();
                                } catch (IOException e14) {
                                    Log.e("ExifInterface", "IOException occurred while closing InputStream", e14);
                                }
                                return jArr;
                            case 5:
                                d[] dVarArr = new d[this.f8842b];
                                while (i10 < this.f8842b) {
                                    dVarArr[i10] = new d(c0142a.d(), c0142a.d());
                                    i10++;
                                }
                                try {
                                    c0142a.close();
                                } catch (IOException e15) {
                                    Log.e("ExifInterface", "IOException occurred while closing InputStream", e15);
                                }
                                return dVarArr;
                            case 8:
                                int[] iArr2 = new int[this.f8842b];
                                while (i10 < this.f8842b) {
                                    iArr2[i10] = c0142a.readShort();
                                    i10++;
                                }
                                try {
                                    c0142a.close();
                                } catch (IOException e16) {
                                    Log.e("ExifInterface", "IOException occurred while closing InputStream", e16);
                                }
                                return iArr2;
                            case 9:
                                int[] iArr3 = new int[this.f8842b];
                                while (i10 < this.f8842b) {
                                    iArr3[i10] = c0142a.readInt();
                                    i10++;
                                }
                                try {
                                    c0142a.close();
                                } catch (IOException e17) {
                                    Log.e("ExifInterface", "IOException occurred while closing InputStream", e17);
                                }
                                return iArr3;
                            case 10:
                                d[] dVarArr2 = new d[this.f8842b];
                                while (i10 < this.f8842b) {
                                    dVarArr2[i10] = new d(c0142a.readInt(), c0142a.readInt());
                                    i10++;
                                }
                                try {
                                    c0142a.close();
                                } catch (IOException e18) {
                                    Log.e("ExifInterface", "IOException occurred while closing InputStream", e18);
                                }
                                return dVarArr2;
                            case 11:
                                double[] dArr = new double[this.f8842b];
                                while (i10 < this.f8842b) {
                                    dArr[i10] = c0142a.readFloat();
                                    i10++;
                                }
                                try {
                                    c0142a.close();
                                } catch (IOException e19) {
                                    Log.e("ExifInterface", "IOException occurred while closing InputStream", e19);
                                }
                                return dArr;
                            case 12:
                                double[] dArr2 = new double[this.f8842b];
                                while (i10 < this.f8842b) {
                                    dArr2[i10] = c0142a.readDouble();
                                    i10++;
                                }
                                try {
                                    c0142a.close();
                                } catch (IOException e20) {
                                    Log.e("ExifInterface", "IOException occurred while closing InputStream", e20);
                                }
                                return dArr2;
                            default:
                                try {
                                    c0142a.close();
                                } catch (IOException e21) {
                                    Log.e("ExifInterface", "IOException occurred while closing InputStream", e21);
                                }
                                return null;
                        }
                    } catch (IOException e22) {
                        e = e22;
                        Log.w("ExifInterface", "IOException occurred during reading a value", e);
                        if (c0142a != null) {
                            try {
                                c0142a.close();
                            } catch (IOException e23) {
                                Log.e("ExifInterface", "IOException occurred while closing InputStream", e23);
                            }
                        }
                        return null;
                    }
                } catch (Throwable th) {
                    th = th;
                    inputStream2 = inputStream;
                    if (inputStream2 != null) {
                        try {
                            inputStream2.close();
                        } catch (IOException e24) {
                            Log.e("ExifInterface", "IOException occurred while closing InputStream", e24);
                        }
                    }
                    throw th;
                }
            } catch (IOException e25) {
                e = e25;
                c0142a = null;
            } catch (Throwable th2) {
                th = th2;
                if (inputStream2 != null) {
                }
                throw th;
            }
        }

        public String toString() {
            return "(" + a.f8817u[this.f8841a] + ", data length:" + this.f8843c.length + ")";
        }
    }

    public static class d {

        public final long f8848a;

        public final long f8849b;

        d(long j10, long j11) {
            if (j11 == 0) {
                this.f8848a = 0L;
                this.f8849b = 1L;
            } else {
                this.f8848a = j10;
                this.f8849b = j11;
            }
        }

        public double a() {
            return this.f8848a / this.f8849b;
        }

        public String toString() {
            return this.f8848a + "/" + this.f8849b;
        }
    }

    static {
        c[] cVarArr = {new c("NewSubfileType", 254, 4), new c("SubfileType", SheetSettings.DEFAULT_DEFAULT_ROW_HEIGHT, 4), new c("ImageWidth", Config.X_DENSITY, 3, 4), new c("ImageLength", Config.Y_DENSITY, 3, 4), new c("BitsPerSample", 258, 3), new c("Compression", 259, 3), new c("PhotometricInterpretation", 262, 3), new c("ImageDescription", 270, 2), new c("Make", 271, 2), new c("Model", 272, 2), new c("StripOffsets", 273, 3, 4), new c("Orientation", 274, 3), new c("SamplesPerPixel", 277, 3), new c("RowsPerStrip", 278, 3, 4), new c("StripByteCounts", 279, 3, 4), new c("XResolution", 282, 5), new c("YResolution", 283, 5), new c("PlanarConfiguration", 284, 3), new c("ResolutionUnit", 296, 3), new c("TransferFunction", 301, 3), new c("Software", 305, 2), new c("DateTime", 306, 2), new c("Artist", 315, 2), new c("WhitePoint", 318, 5), new c("PrimaryChromaticities", 319, 5), new c("SubIFDPointer", 330, 4), new c("JPEGInterchangeFormat", 513, 4), new c("JPEGInterchangeFormatLength", 514, 4), new c("YCbCrCoefficients", 529, 5), new c("YCbCrSubSampling", 530, 3), new c("YCbCrPositioning", 531, 3), new c("ReferenceBlackWhite", 532, 5), new c("Copyright", 33432, 2), new c("ExifIFDPointer", 34665, 4), new c("GPSInfoIFDPointer", 34853, 4), new c("SensorTopBorder", 4, 4), new c("SensorLeftBorder", 5, 4), new c("SensorBottomBorder", 6, 4), new c("SensorRightBorder", 7, 4), new c("ISO", 23, 3), new c("JpgFromRaw", 46, 7)};
        f8820x = cVarArr;
        c[] cVarArr2 = {new c("ExposureTime", 33434, 5), new c("FNumber", 33437, 5), new c("ExposureProgram", 34850, 3), new c("SpectralSensitivity", 34852, 2), new c("PhotographicSensitivity", 34855, 3), new c("OECF", 34856, 7), new c("ExifVersion", 36864, 2), new c("DateTimeOriginal", 36867, 2), new c("DateTimeDigitized", 36868, 2), new c("ComponentsConfiguration", 37121, 7), new c("CompressedBitsPerPixel", 37122, 5), new c("ShutterSpeedValue", 37377, 10), new c("ApertureValue", 37378, 5), new c("BrightnessValue", 37379, 10), new c("ExposureBiasValue", 37380, 10), new c("MaxApertureValue", 37381, 5), new c("SubjectDistance", 37382, 5), new c("MeteringMode", 37383, 3), new c("LightSource", 37384, 3), new c("Flash", 37385, 3), new c("FocalLength", 37386, 5), new c("SubjectArea", 37396, 3), new c("MakerNote", 37500, 7), new c("UserComment", 37510, 7), new c("SubSecTime", 37520, 2), new c("SubSecTimeOriginal", 37521, 2), new c("SubSecTimeDigitized", 37522, 2), new c("FlashpixVersion", 40960, 7), new c("ColorSpace", 40961, 3), new c("PixelXDimension", 40962, 3, 4), new c("PixelYDimension", 40963, 3, 4), new c("RelatedSoundFile", 40964, 2), new c("InteroperabilityIFDPointer", 40965, 4), new c("FlashEnergy", 41483, 5), new c("SpatialFrequencyResponse", 41484, 7), new c("FocalPlaneXResolution", 41486, 5), new c("FocalPlaneYResolution", 41487, 5), new c("FocalPlaneResolutionUnit", 41488, 3), new c("SubjectLocation", 41492, 3), new c("ExposureIndex", 41493, 5), new c("SensingMethod", 41495, 3), new c("FileSource", 41728, 7), new c("SceneType", 41729, 7), new c("CFAPattern", 41730, 7), new c("CustomRendered", 41985, 3), new c("ExposureMode", 41986, 3), new c("WhiteBalance", 41987, 3), new c("DigitalZoomRatio", 41988, 5), new c("FocalLengthIn35mmFilm", 41989, 3), new c("SceneCaptureType", 41990, 3), new c("GainControl", 41991, 3), new c("Contrast", 41992, 3), new c("Saturation", 41993, 3), new c("Sharpness", 41994, 3), new c("DeviceSettingDescription", 41995, 7), new c("SubjectDistanceRange", 41996, 3), new c("ImageUniqueID", 42016, 2), new c("DNGVersion", 50706, 1), new c("DefaultCropSize", 50720, 3, 4)};
        f8821y = cVarArr2;
        c[] cVarArr3 = {new c("GPSVersionID", 0, 1), new c("GPSLatitudeRef", 1, 2), new c("GPSLatitude", 2, 5), new c("GPSLongitudeRef", 3, 2), new c("GPSLongitude", 4, 5), new c("GPSAltitudeRef", 5, 1), new c("GPSAltitude", 6, 5), new c("GPSTimeStamp", 7, 5), new c("GPSSatellites", 8, 2), new c("GPSStatus", 9, 2), new c("GPSMeasureMode", 10, 2), new c("GPSDOP", 11, 5), new c("GPSSpeedRef", 12, 2), new c("GPSSpeed", 13, 5), new c("GPSTrackRef", 14, 2), new c("GPSTrack", 15, 5), new c("GPSImgDirectionRef", 16, 2), new c("GPSImgDirection", 17, 5), new c("GPSMapDatum", 18, 2), new c("GPSDestLatitudeRef", 19, 2), new c("GPSDestLatitude", 20, 5), new c("GPSDestLongitudeRef", 21, 2), new c("GPSDestLongitude", 22, 5), new c("GPSDestBearingRef", 23, 2), new c("GPSDestBearing", 24, 5), new c("GPSDestDistanceRef", 25, 2), new c("GPSDestDistance", 26, 5), new c("GPSProcessingMethod", 27, 7), new c("GPSAreaInformation", 28, 7), new c("GPSDateStamp", 29, 2), new c("GPSDifferential", 30, 3)};
        f8822z = cVarArr3;
        c[] cVarArr4 = {new c("InteroperabilityIndex", 1, 2)};
        A = cVarArr4;
        c[] cVarArr5 = {new c("NewSubfileType", 254, 4), new c("SubfileType", SheetSettings.DEFAULT_DEFAULT_ROW_HEIGHT, 4), new c("ThumbnailImageWidth", Config.X_DENSITY, 3, 4), new c("ThumbnailImageLength", Config.Y_DENSITY, 3, 4), new c("BitsPerSample", 258, 3), new c("Compression", 259, 3), new c("PhotometricInterpretation", 262, 3), new c("ImageDescription", 270, 2), new c("Make", 271, 2), new c("Model", 272, 2), new c("StripOffsets", 273, 3, 4), new c("Orientation", 274, 3), new c("SamplesPerPixel", 277, 3), new c("RowsPerStrip", 278, 3, 4), new c("StripByteCounts", 279, 3, 4), new c("XResolution", 282, 5), new c("YResolution", 283, 5), new c("PlanarConfiguration", 284, 3), new c("ResolutionUnit", 296, 3), new c("TransferFunction", 301, 3), new c("Software", 305, 2), new c("DateTime", 306, 2), new c("Artist", 315, 2), new c("WhitePoint", 318, 5), new c("PrimaryChromaticities", 319, 5), new c("SubIFDPointer", 330, 4), new c("JPEGInterchangeFormat", 513, 4), new c("JPEGInterchangeFormatLength", 514, 4), new c("YCbCrCoefficients", 529, 5), new c("YCbCrSubSampling", 530, 3), new c("YCbCrPositioning", 531, 3), new c("ReferenceBlackWhite", 532, 5), new c("Copyright", 33432, 2), new c("ExifIFDPointer", 34665, 4), new c("GPSInfoIFDPointer", 34853, 4), new c("DNGVersion", 50706, 1), new c("DefaultCropSize", 50720, 3, 4)};
        B = cVarArr5;
        C = new c("StripOffsets", 273, 3);
        c[] cVarArr6 = {new c("ThumbnailImage", Config.X_DENSITY, 7), new c("CameraSettingsIFDPointer", 8224, 4), new c("ImageProcessingIFDPointer", 8256, 4)};
        D = cVarArr6;
        c[] cVarArr7 = {new c("PreviewImageStart", Config.Y_DENSITY, 4), new c("PreviewImageLength", 258, 4)};
        E = cVarArr7;
        c[] cVarArr8 = {new c("AspectFrame", 4371, 3)};
        F = cVarArr8;
        c[] cVarArr9 = {new c("ColorSpace", 55, 3)};
        G = cVarArr9;
        c[][] cVarArr10 = {cVarArr, cVarArr2, cVarArr3, cVarArr4, cVarArr5, cVarArr, cVarArr6, cVarArr7, cVarArr8, cVarArr9};
        H = cVarArr10;
        I = new c[]{new c("SubIFDPointer", 330, 4), new c("ExifIFDPointer", 34665, 4), new c("GPSInfoIFDPointer", 34853, 4), new c("InteroperabilityIFDPointer", 40965, 4), new c("CameraSettingsIFDPointer", 8224, 1), new c("ImageProcessingIFDPointer", 8256, 1)};
        new c("JPEGInterchangeFormat", 513, 4);
        new c("JPEGInterchangeFormatLength", 514, 4);
        J = new HashMap[cVarArr10.length];
        K = new HashMap[cVarArr10.length];
        L = new HashSet<>(Arrays.asList("FNumber", "DigitalZoomRatio", "ExposureTime", "SubjectDistance", "GPSTimeStamp"));
        M = new HashMap<>();
        Charset forName = Charset.forName("US-ASCII");
        N = forName;
        O = "Exif\u0000\u0000".getBytes(forName);
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss");
        f8816t = simpleDateFormat;
        simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
        int i10 = 0;
        while (true) {
            ExifInterface.ExifTag[][] exifTagArr = H;
            if (i10 < exifTagArr.length) {
                J[i10] = new HashMap<>();
                K[i10] = new HashMap<>();
                for (ExifInterface.ExifTag exifTag : exifTagArr[i10]) {
                    J[i10].put(Integer.valueOf(exifTag.f8844a), exifTag);
                    K[i10].put(exifTag.f8845b, exifTag);
                }
                i10++;
            } else {
                HashMap<Integer, Integer> hashMap = M;
                c[] cVarArr11 = I;
                hashMap.put(Integer.valueOf(cVarArr11[0].f8844a), 5);
                hashMap.put(Integer.valueOf(cVarArr11[1].f8844a), 1);
                hashMap.put(Integer.valueOf(cVarArr11[2].f8844a), 2);
                hashMap.put(Integer.valueOf(cVarArr11[3].f8844a), 3);
                hashMap.put(Integer.valueOf(cVarArr11[4].f8844a), 7);
                hashMap.put(Integer.valueOf(cVarArr11[5].f8844a), 8);
                Pattern.compile(".*[1-9].*");
                Pattern.compile("^([0-9][0-9]):([0-9][0-9]):([0-9][0-9])$");
                return;
            }
        }
    }

    public a(InputStream inputStream) {
        c[][] cVarArr = H;
        this.f8826d = new HashMap[cVarArr.length];
        this.f8827e = new HashSet(cVarArr.length);
        this.f8828f = ByteOrder.BIG_ENDIAN;
        if (inputStream != null) {
            this.f8823a = null;
            if (inputStream instanceof AssetManager.AssetInputStream) {
                this.f8824b = (AssetManager.AssetInputStream) inputStream;
            } else {
                this.f8824b = null;
            }
            t(inputStream);
            return;
        }
        throw new IllegalArgumentException("inputStream cannot be null");
    }

    private void A(int i10, int i11) {
        if (this.f8826d[i10].isEmpty() || this.f8826d[i11].isEmpty()) {
            return;
        }
        b bVar = this.f8826d[i10].get("ImageLength");
        b bVar2 = this.f8826d[i10].get("ImageWidth");
        b bVar3 = this.f8826d[i11].get("ImageLength");
        b bVar4 = this.f8826d[i11].get("ImageWidth");
        if (bVar == null || bVar2 == null || bVar3 == null || bVar4 == null) {
            return;
        }
        int i12 = bVar.i(this.f8828f);
        int i13 = bVar2.i(this.f8828f);
        int i14 = bVar3.i(this.f8828f);
        int i15 = bVar4.i(this.f8828f);
        if (i12 >= i14 || i13 >= i15) {
            return;
        }
        HashMap<String, ExifInterface.ExifAttribute>[] hashMapArr = this.f8826d;
        HashMap<String, ExifInterface.ExifAttribute> hashMap = hashMapArr[i10];
        hashMapArr[i10] = hashMapArr[i11];
        hashMapArr[i11] = hashMap;
    }

    private void B(C0142a c0142a, int i10) {
        b f10;
        b f11;
        b bVar = this.f8826d[i10].get("DefaultCropSize");
        b bVar2 = this.f8826d[i10].get("SensorTopBorder");
        b bVar3 = this.f8826d[i10].get("SensorLeftBorder");
        b bVar4 = this.f8826d[i10].get("SensorBottomBorder");
        b bVar5 = this.f8826d[i10].get("SensorRightBorder");
        if (bVar == null) {
            if (bVar2 != null && bVar3 != null && bVar4 != null && bVar5 != null) {
                int i11 = bVar2.i(this.f8828f);
                int i12 = bVar4.i(this.f8828f);
                int i13 = bVar5.i(this.f8828f);
                int i14 = bVar3.i(this.f8828f);
                if (i12 <= i11 || i13 <= i14) {
                    return;
                }
                ExifInterface.ExifAttribute f12 = b.f(i12 - i11, this.f8828f);
                ExifInterface.ExifAttribute f13 = b.f(i13 - i14, this.f8828f);
                this.f8826d[i10].put("ImageLength", f12);
                this.f8826d[i10].put("ImageWidth", f13);
                return;
            }
            y(c0142a, i10);
            return;
        }
        if (bVar.f8841a == 5) {
            d[] dVarArr = (d[]) bVar.k(this.f8828f);
            if (dVarArr != null && dVarArr.length == 2) {
                f10 = b.d(dVarArr[0], this.f8828f);
                f11 = b.d(dVarArr[1], this.f8828f);
            } else {
                Log.w("ExifInterface", "Invalid crop size values. cropSize=" + Arrays.toString(dVarArr));
                return;
            }
        } else {
            int[] iArr = (int[]) bVar.k(this.f8828f);
            if (iArr != null && iArr.length == 2) {
                f10 = b.f(iArr[0], this.f8828f);
                f11 = b.f(iArr[1], this.f8828f);
            } else {
                Log.w("ExifInterface", "Invalid crop size values. cropSize=" + Arrays.toString(iArr));
                return;
            }
        }
        this.f8826d[i10].put("ImageWidth", f10);
        this.f8826d[i10].put("ImageLength", f11);
    }

    private void C(InputStream inputStream) {
        A(0, 5);
        A(0, 4);
        A(5, 4);
        ExifInterface.ExifAttribute exifAttribute = (b) this.f8826d[1].get("PixelXDimension");
        ExifInterface.ExifAttribute exifAttribute2 = (b) this.f8826d[1].get("PixelYDimension");
        if (exifAttribute != null && exifAttribute2 != null) {
            this.f8826d[0].put("ImageWidth", exifAttribute);
            this.f8826d[0].put("ImageLength", exifAttribute2);
        }
        if (this.f8826d[4].isEmpty() && s(this.f8826d[5])) {
            HashMap<String, ExifInterface.ExifAttribute>[] hashMapArr = this.f8826d;
            hashMapArr[4] = hashMapArr[5];
            hashMapArr[5] = new HashMap<>();
        }
        if (s(this.f8826d[4])) {
            return;
        }
        Log.d("ExifInterface", "No image meets the size requirements of a thumbnail image.");
    }

    private void a() {
        String c10 = c("DateTimeOriginal");
        if (c10 != null && c("DateTime") == null) {
            this.f8826d[0].put("DateTime", b.a(c10));
        }
        if (c("ImageWidth") == null) {
            this.f8826d[0].put("ImageWidth", b.b(0L, this.f8828f));
        }
        if (c("ImageLength") == null) {
            this.f8826d[0].put("ImageLength", b.b(0L, this.f8828f));
        }
        if (c("Orientation") == null) {
            this.f8826d[0].put("Orientation", b.b(0L, this.f8828f));
        }
        if (c("LightSource") == null) {
            this.f8826d[1].put("LightSource", b.b(0L, this.f8828f));
        }
    }

    private static long[] b(Object obj) {
        if (obj instanceof int[]) {
            int[] iArr = (int[]) obj;
            long[] jArr = new long[iArr.length];
            for (int i10 = 0; i10 < iArr.length; i10++) {
                jArr[i10] = iArr[i10];
            }
            return jArr;
        }
        if (obj instanceof long[]) {
            return (long[]) obj;
        }
        return null;
    }

    private b e(String str) {
        if ("ISOSpeedRatings".equals(str)) {
            str = "PhotographicSensitivity";
        }
        for (int i10 = 0; i10 < H.length; i10++) {
            b bVar = this.f8826d[i10].get(str);
            if (bVar != null) {
                return bVar;
            }
        }
        return null;
    }

    private void f(C0142a c0142a, int i10, int i11) {
        c0142a.h(ByteOrder.BIG_ENDIAN);
        c0142a.g(i10);
        byte readByte = c0142a.readByte();
        if (readByte == -1) {
            int i12 = i10 + 1;
            if (c0142a.readByte() != -40) {
                throw new IOException("Invalid marker: " + Integer.toHexString(readByte & 255));
            }
            int i13 = i12 + 1;
            while (true) {
                byte readByte2 = c0142a.readByte();
                if (readByte2 == -1) {
                    byte readByte3 = c0142a.readByte();
                    int i14 = i13 + 1 + 1;
                    if (readByte3 != -39 && readByte3 != -38) {
                        int readUnsignedShort = c0142a.readUnsignedShort() - 2;
                        int i15 = i14 + 2;
                        if (readUnsignedShort < 0) {
                            throw new IOException("Invalid length");
                        }
                        if (readByte3 != -31) {
                            if (readByte3 != -2) {
                                switch (readByte3) {
                                    default:
                                        switch (readByte3) {
                                            default:
                                                switch (readByte3) {
                                                    default:
                                                        switch (readByte3) {
                                                        }
                                                    case -55:
                                                    case -54:
                                                    case -53:
                                                        if (c0142a.skipBytes(1) == 1) {
                                                            this.f8826d[i11].put("ImageLength", b.b(c0142a.readUnsignedShort(), this.f8828f));
                                                            this.f8826d[i11].put("ImageWidth", b.b(c0142a.readUnsignedShort(), this.f8828f));
                                                            readUnsignedShort -= 5;
                                                            break;
                                                        } else {
                                                            throw new IOException("Invalid SOFx");
                                                        }
                                                }
                                            case -59:
                                            case -58:
                                            case -57:
                                                break;
                                        }
                                    case -64:
                                    case -63:
                                    case -62:
                                    case -61:
                                        break;
                                }
                            } else {
                                byte[] bArr = new byte[readUnsignedShort];
                                if (c0142a.read(bArr) == readUnsignedShort) {
                                    if (c("UserComment") == null) {
                                        this.f8826d[1].put("UserComment", b.a(new String(bArr, N)));
                                    }
                                    readUnsignedShort = 0;
                                } else {
                                    throw new IOException("Invalid exif");
                                }
                            }
                        } else if (readUnsignedShort >= 6) {
                            byte[] bArr2 = new byte[6];
                            if (c0142a.read(bArr2) == 6) {
                                i15 += 6;
                                readUnsignedShort -= 6;
                                if (Arrays.equals(bArr2, O)) {
                                    if (readUnsignedShort > 0) {
                                        this.f8830h = i15;
                                        byte[] bArr3 = new byte[readUnsignedShort];
                                        if (c0142a.read(bArr3) == readUnsignedShort) {
                                            i15 += readUnsignedShort;
                                            w(bArr3, i11);
                                            readUnsignedShort = 0;
                                        } else {
                                            throw new IOException("Invalid exif");
                                        }
                                    } else {
                                        throw new IOException("Invalid exif");
                                    }
                                }
                            } else {
                                throw new IOException("Invalid exif");
                            }
                        }
                        if (readUnsignedShort >= 0) {
                            if (c0142a.skipBytes(readUnsignedShort) != readUnsignedShort) {
                                throw new IOException("Invalid JPEG segment");
                            }
                            i13 = i15 + readUnsignedShort;
                        } else {
                            throw new IOException("Invalid length");
                        }
                    }
                } else {
                    throw new IOException("Invalid marker:" + Integer.toHexString(readByte2 & 255));
                }
            }
        } else {
            throw new IOException("Invalid marker: " + Integer.toHexString(readByte & 255));
        }
    }

    private int g(BufferedInputStream bufferedInputStream) {
        bufferedInputStream.mark(5000);
        byte[] bArr = new byte[5000];
        bufferedInputStream.read(bArr);
        bufferedInputStream.reset();
        if (n(bArr)) {
            return 4;
        }
        if (p(bArr)) {
            return 9;
        }
        if (o(bArr)) {
            return 7;
        }
        return q(bArr) ? 10 : 0;
    }

    private void h(C0142a c0142a) {
        j(c0142a);
        b bVar = this.f8826d[1].get("MakerNote");
        if (bVar != null) {
            C0142a c0142a2 = new C0142a(bVar.f8843c);
            c0142a2.h(this.f8828f);
            byte[] bArr = f8814r;
            byte[] bArr2 = new byte[bArr.length];
            c0142a2.readFully(bArr2);
            c0142a2.g(0L);
            byte[] bArr3 = f8815s;
            byte[] bArr4 = new byte[bArr3.length];
            c0142a2.readFully(bArr4);
            if (Arrays.equals(bArr2, bArr)) {
                c0142a2.g(8L);
            } else if (Arrays.equals(bArr4, bArr3)) {
                c0142a2.g(12L);
            }
            x(c0142a2, 6);
            ExifInterface.ExifAttribute exifAttribute = (b) this.f8826d[7].get("PreviewImageStart");
            ExifInterface.ExifAttribute exifAttribute2 = (b) this.f8826d[7].get("PreviewImageLength");
            if (exifAttribute != null && exifAttribute2 != null) {
                this.f8826d[5].put("JPEGInterchangeFormat", exifAttribute);
                this.f8826d[5].put("JPEGInterchangeFormatLength", exifAttribute2);
            }
            b bVar2 = this.f8826d[8].get("AspectFrame");
            if (bVar2 != null) {
                int[] iArr = (int[]) bVar2.k(this.f8828f);
                if (iArr != null && iArr.length == 4) {
                    if (iArr[2] <= iArr[0] || iArr[3] <= iArr[1]) {
                        return;
                    }
                    int i10 = (iArr[2] - iArr[0]) + 1;
                    int i11 = (iArr[3] - iArr[1]) + 1;
                    if (i10 < i11) {
                        int i12 = i10 + i11;
                        i11 = i12 - i11;
                        i10 = i12 - i11;
                    }
                    ExifInterface.ExifAttribute f10 = b.f(i10, this.f8828f);
                    ExifInterface.ExifAttribute f11 = b.f(i11, this.f8828f);
                    this.f8826d[0].put("ImageWidth", f10);
                    this.f8826d[0].put("ImageLength", f11);
                    return;
                }
                Log.w("ExifInterface", "Invalid aspect frame values. frame=" + Arrays.toString(iArr));
            }
        }
    }

    private void i(C0142a c0142a) {
        c0142a.skipBytes(84);
        byte[] bArr = new byte[4];
        byte[] bArr2 = new byte[4];
        c0142a.read(bArr);
        c0142a.skipBytes(4);
        c0142a.read(bArr2);
        int i10 = ByteBuffer.wrap(bArr).getInt();
        int i11 = ByteBuffer.wrap(bArr2).getInt();
        f(c0142a, i10, 5);
        c0142a.g(i11);
        c0142a.h(ByteOrder.BIG_ENDIAN);
        int readInt = c0142a.readInt();
        for (int i12 = 0; i12 < readInt; i12++) {
            int readUnsignedShort = c0142a.readUnsignedShort();
            int readUnsignedShort2 = c0142a.readUnsignedShort();
            if (readUnsignedShort == C.f8844a) {
                short readShort = c0142a.readShort();
                short readShort2 = c0142a.readShort();
                ExifInterface.ExifAttribute f10 = b.f(readShort, this.f8828f);
                ExifInterface.ExifAttribute f11 = b.f(readShort2, this.f8828f);
                this.f8826d[0].put("ImageLength", f10);
                this.f8826d[0].put("ImageWidth", f11);
                return;
            }
            c0142a.skipBytes(readUnsignedShort2);
        }
    }

    private void j(C0142a c0142a) {
        b bVar;
        u(c0142a, c0142a.available());
        x(c0142a, 0);
        B(c0142a, 0);
        B(c0142a, 5);
        B(c0142a, 4);
        C(c0142a);
        if (this.f8825c != 8 || (bVar = this.f8826d[1].get("MakerNote")) == null) {
            return;
        }
        C0142a c0142a2 = new C0142a(bVar.f8843c);
        c0142a2.h(this.f8828f);
        c0142a2.g(6L);
        x(c0142a2, 9);
        ExifInterface.ExifAttribute exifAttribute = (b) this.f8826d[9].get("ColorSpace");
        if (exifAttribute != null) {
            this.f8826d[1].put("ColorSpace", exifAttribute);
        }
    }

    private void k(C0142a c0142a) {
        j(c0142a);
        if (this.f8826d[0].get("JpgFromRaw") != null) {
            f(c0142a, this.f8834l, 5);
        }
        ExifInterface.ExifAttribute exifAttribute = (b) this.f8826d[0].get("ISO");
        b bVar = this.f8826d[1].get("PhotographicSensitivity");
        if (exifAttribute == null || bVar != null) {
            return;
        }
        this.f8826d[1].put("PhotographicSensitivity", exifAttribute);
    }

    private void l(C0142a c0142a, HashMap hashMap) {
        int i10;
        b bVar = (b) hashMap.get("JPEGInterchangeFormat");
        b bVar2 = (b) hashMap.get("JPEGInterchangeFormatLength");
        if (bVar == null || bVar2 == null) {
            return;
        }
        int i11 = bVar.i(this.f8828f);
        int min = Math.min(bVar2.i(this.f8828f), c0142a.available() - i11);
        int i12 = this.f8825c;
        if (i12 == 4 || i12 == 9 || i12 == 10) {
            i10 = this.f8830h;
        } else {
            if (i12 == 7) {
                i10 = this.f8831i;
            }
            if (i11 > 0 || min <= 0 || this.f8823a != null || this.f8824b != null) {
                return;
            }
            c0142a.g(i11);
            c0142a.readFully(new byte[min]);
            return;
        }
        i11 += i10;
        if (i11 > 0) {
        }
    }

    private void m(C0142a c0142a, HashMap hashMap) {
        b bVar = (b) hashMap.get("StripOffsets");
        b bVar2 = (b) hashMap.get("StripByteCounts");
        if (bVar == null || bVar2 == null) {
            return;
        }
        long[] b10 = b(bVar.k(this.f8828f));
        long[] b11 = b(bVar2.k(this.f8828f));
        if (b10 == null) {
            Log.w("ExifInterface", "stripOffsets should not be null.");
            return;
        }
        if (b11 == null) {
            Log.w("ExifInterface", "stripByteCounts should not be null.");
            return;
        }
        long j10 = 0;
        for (long j11 : b11) {
            j10 += j11;
        }
        byte[] bArr = new byte[(int) j10];
        int i10 = 0;
        int i11 = 0;
        for (int i12 = 0; i12 < b10.length; i12++) {
            int i13 = (int) b10[i12];
            int i14 = (int) b11[i12];
            int i15 = i13 - i10;
            if (i15 < 0) {
                Log.d("ExifInterface", "Invalid strip offset value");
            }
            c0142a.g(i15);
            int i16 = i10 + i15;
            byte[] bArr2 = new byte[i14];
            c0142a.read(bArr2);
            i10 = i16 + i14;
            System.arraycopy(bArr2, 0, bArr, i11, i14);
            i11 += i14;
        }
    }

    private static boolean n(byte[] bArr) {
        int i10 = 0;
        while (true) {
            byte[] bArr2 = f8813q;
            if (i10 >= bArr2.length) {
                return true;
            }
            if (bArr[i10] != bArr2[i10]) {
                return false;
            }
            i10++;
        }
    }

    private boolean o(byte[] bArr) {
        C0142a c0142a = new C0142a(bArr);
        ByteOrder v9 = v(c0142a);
        this.f8828f = v9;
        c0142a.h(v9);
        short readShort = c0142a.readShort();
        c0142a.close();
        return readShort == 20306 || readShort == 21330;
    }

    private boolean p(byte[] bArr) {
        byte[] bytes = "FUJIFILMCCD-RAW".getBytes(Charset.defaultCharset());
        for (int i10 = 0; i10 < bytes.length; i10++) {
            if (bArr[i10] != bytes[i10]) {
                return false;
            }
        }
        return true;
    }

    private boolean q(byte[] bArr) {
        C0142a c0142a = new C0142a(bArr);
        ByteOrder v9 = v(c0142a);
        this.f8828f = v9;
        c0142a.h(v9);
        short readShort = c0142a.readShort();
        c0142a.close();
        return readShort == 85;
    }

    private boolean r(HashMap hashMap) {
        b bVar;
        b bVar2 = (b) hashMap.get("BitsPerSample");
        if (bVar2 == null) {
            return false;
        }
        int[] iArr = (int[]) bVar2.k(this.f8828f);
        int[] iArr2 = f8811o;
        if (Arrays.equals(iArr2, iArr)) {
            return true;
        }
        if (this.f8825c != 3 || (bVar = (b) hashMap.get("PhotometricInterpretation")) == null) {
            return false;
        }
        int i10 = bVar.i(this.f8828f);
        return (i10 == 1 && Arrays.equals(iArr, f8812p)) || (i10 == 6 && Arrays.equals(iArr, iArr2));
    }

    private boolean s(HashMap hashMap) {
        b bVar = (b) hashMap.get("ImageLength");
        b bVar2 = (b) hashMap.get("ImageWidth");
        if (bVar == null || bVar2 == null) {
            return false;
        }
        return bVar.i(this.f8828f) <= 512 && bVar2.i(this.f8828f) <= 512;
    }

    private void t(InputStream inputStream) {
        for (int i10 = 0; i10 < H.length; i10++) {
            try {
                this.f8826d[i10] = new HashMap<>();
            } catch (IOException unused) {
            } catch (Throwable th) {
                a();
                throw th;
            }
        }
        BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream, 5000);
        this.f8825c = g(bufferedInputStream);
        C0142a c0142a = new C0142a(bufferedInputStream);
        switch (this.f8825c) {
            case 0:
            case 1:
            case 2:
            case 3:
            case 5:
            case 6:
            case 8:
            case 11:
                j(c0142a);
                break;
            case 4:
                f(c0142a, 0, 0);
                break;
            case 7:
                h(c0142a);
                break;
            case 9:
                i(c0142a);
                break;
            case 10:
                k(c0142a);
                break;
        }
        z(c0142a);
        a();
    }

    private void u(C0142a c0142a, int i10) {
        ByteOrder v9 = v(c0142a);
        this.f8828f = v9;
        c0142a.h(v9);
        int readUnsignedShort = c0142a.readUnsignedShort();
        int i11 = this.f8825c;
        if (i11 != 7 && i11 != 10 && readUnsignedShort != 42) {
            throw new IOException("Invalid start code: " + Integer.toHexString(readUnsignedShort));
        }
        int readInt = c0142a.readInt();
        if (readInt >= 8 && readInt < i10) {
            int i12 = readInt - 8;
            if (i12 <= 0 || c0142a.skipBytes(i12) == i12) {
                return;
            }
            throw new IOException("Couldn't jump to first Ifd: " + i12);
        }
        throw new IOException("Invalid first Ifd offset: " + readInt);
    }

    private ByteOrder v(C0142a c0142a) {
        short readShort = c0142a.readShort();
        if (readShort == 18761) {
            return ByteOrder.LITTLE_ENDIAN;
        }
        if (readShort == 19789) {
            return ByteOrder.BIG_ENDIAN;
        }
        throw new IOException("Invalid byte order: " + Integer.toHexString(readShort));
    }

    private void w(byte[] bArr, int i10) {
        C0142a c0142a = new C0142a(bArr);
        u(c0142a, bArr.length);
        x(c0142a, i10);
    }

    private void x(C0142a c0142a, int i10) {
        short s9;
        String str;
        long j10;
        boolean z9;
        short s10;
        c cVar;
        int i11;
        int i12;
        int readUnsignedShort;
        long j11;
        this.f8827e.add(Integer.valueOf(c0142a.f8840e));
        if (c0142a.f8840e + 2 > c0142a.f8839d) {
            return;
        }
        short readShort = c0142a.readShort();
        if (c0142a.f8840e + (readShort * 12) > c0142a.f8839d || readShort <= 0) {
            return;
        }
        short s11 = 0;
        while (s11 < readShort) {
            int readUnsignedShort2 = c0142a.readUnsignedShort();
            int readUnsignedShort3 = c0142a.readUnsignedShort();
            int readInt = c0142a.readInt();
            long b10 = c0142a.b() + 4;
            c cVar2 = J[i10].get(Integer.valueOf(readUnsignedShort2));
            if (cVar2 == null) {
                Log.w("ExifInterface", "Skip the tag entry since tag number is not defined: " + readUnsignedShort2);
            } else {
                if (readUnsignedShort3 > 0) {
                    if (readUnsignedShort3 < f8818v.length) {
                        if (!cVar2.a(readUnsignedShort3)) {
                            Log.w("ExifInterface", "Skip the tag entry since data format (" + f8817u[readUnsignedShort3] + ") is unexpected for tag: " + cVar2.f8845b);
                        } else {
                            if (readUnsignedShort3 == 7) {
                                readUnsignedShort3 = cVar2.f8846c;
                            }
                            str = "ExifInterface";
                            s9 = s11;
                            j10 = r6[readUnsignedShort3] * readInt;
                            if (j10 < 0 || j10 > 2147483647L) {
                                Log.w(str, "Skip the tag entry since the number of components is invalid: " + readInt);
                                z9 = false;
                                if (z9) {
                                    c0142a.g(b10);
                                    s10 = readShort;
                                } else {
                                    if (j10 > 4) {
                                        int readInt2 = c0142a.readInt();
                                        int i13 = this.f8825c;
                                        s10 = readShort;
                                        if (i13 == 7) {
                                            if ("MakerNote".equals(cVar2.f8845b)) {
                                                this.f8831i = readInt2;
                                            } else if (i10 == 6 && "ThumbnailImage".equals(cVar2.f8845b)) {
                                                this.f8832j = readInt2;
                                                this.f8833k = readInt;
                                                ExifInterface.ExifAttribute f10 = b.f(6, this.f8828f);
                                                i11 = readUnsignedShort3;
                                                i12 = readInt;
                                                ExifInterface.ExifAttribute b11 = b.b(this.f8832j, this.f8828f);
                                                j11 = b10;
                                                ExifInterface.ExifAttribute b12 = b.b(this.f8833k, this.f8828f);
                                                this.f8826d[4].put("Compression", f10);
                                                this.f8826d[4].put("JPEGInterchangeFormat", b11);
                                                this.f8826d[4].put("JPEGInterchangeFormatLength", b12);
                                            }
                                            i11 = readUnsignedShort3;
                                            i12 = readInt;
                                            j11 = b10;
                                        } else {
                                            i11 = readUnsignedShort3;
                                            i12 = readInt;
                                            j11 = b10;
                                            if (i13 == 10 && "JpgFromRaw".equals(cVar2.f8845b)) {
                                                this.f8834l = readInt2;
                                            }
                                        }
                                        long j12 = readInt2;
                                        cVar = cVar2;
                                        if (j12 + j10 <= c0142a.f8839d) {
                                            c0142a.g(j12);
                                            b10 = j11;
                                        } else {
                                            Log.w(str, "Skip the tag entry since data offset is invalid: " + readInt2);
                                            c0142a.g(j11);
                                        }
                                    } else {
                                        s10 = readShort;
                                        cVar = cVar2;
                                        i11 = readUnsignedShort3;
                                        i12 = readInt;
                                    }
                                    Integer num = M.get(Integer.valueOf(readUnsignedShort2));
                                    if (num != null) {
                                        long j13 = -1;
                                        int i14 = i11;
                                        if (i14 == 3) {
                                            readUnsignedShort = c0142a.readUnsignedShort();
                                        } else {
                                            if (i14 == 4) {
                                                j13 = c0142a.d();
                                            } else if (i14 == 8) {
                                                readUnsignedShort = c0142a.readShort();
                                            } else if (i14 == 9 || i14 == 13) {
                                                readUnsignedShort = c0142a.readInt();
                                            }
                                            if (j13 <= 0 && j13 < c0142a.f8839d) {
                                                if (!this.f8827e.contains(Integer.valueOf((int) j13))) {
                                                    c0142a.g(j13);
                                                    x(c0142a, num.intValue());
                                                } else {
                                                    Log.w(str, "Skip jump into the IFD since it has already been read: IfdType " + num + " (at " + j13 + ")");
                                                }
                                            } else {
                                                Log.w(str, "Skip jump into the IFD since its offset is invalid: " + j13);
                                            }
                                            c0142a.g(b10);
                                        }
                                        j13 = readUnsignedShort;
                                        if (j13 <= 0) {
                                        }
                                        Log.w(str, "Skip jump into the IFD since its offset is invalid: " + j13);
                                        c0142a.g(b10);
                                    } else {
                                        byte[] bArr = new byte[(int) j10];
                                        c0142a.readFully(bArr);
                                        ExifInterface.ExifAttribute bVar = new b(i11, i12, bArr);
                                        c cVar3 = cVar;
                                        this.f8826d[i10].put(cVar3.f8845b, bVar);
                                        if ("DNGVersion".equals(cVar3.f8845b)) {
                                            this.f8825c = 3;
                                        }
                                        if ((("Make".equals(cVar3.f8845b) || "Model".equals(cVar3.f8845b)) && bVar.j(this.f8828f).contains("PENTAX")) || ("Compression".equals(cVar3.f8845b) && bVar.i(this.f8828f) == 65535)) {
                                            this.f8825c = 8;
                                        }
                                        if (c0142a.b() != b10) {
                                            c0142a.g(b10);
                                        }
                                    }
                                }
                                s11 = (short) (s9 + 1);
                                readShort = s10;
                            } else {
                                z9 = true;
                                if (z9) {
                                }
                                s11 = (short) (s9 + 1);
                                readShort = s10;
                            }
                        }
                    }
                }
                s9 = s11;
                str = "ExifInterface";
                Log.w(str, "Skip the tag entry since data format is invalid: " + readUnsignedShort3);
                j10 = 0;
                z9 = false;
                if (z9) {
                }
                s11 = (short) (s9 + 1);
                readShort = s10;
            }
            s9 = s11;
            str = "ExifInterface";
            j10 = 0;
            z9 = false;
            if (z9) {
            }
            s11 = (short) (s9 + 1);
            readShort = s10;
        }
        if (c0142a.b() + 4 <= c0142a.f8839d) {
            int readInt3 = c0142a.readInt();
            long j14 = readInt3;
            if (j14 > 0 && readInt3 < c0142a.f8839d) {
                if (!this.f8827e.contains(Integer.valueOf(readInt3))) {
                    c0142a.g(j14);
                    if (this.f8826d[4].isEmpty()) {
                        x(c0142a, 4);
                        return;
                    } else {
                        if (this.f8826d[5].isEmpty()) {
                            x(c0142a, 5);
                            return;
                        }
                        return;
                    }
                }
                Log.w("ExifInterface", "Stop reading file since re-reading an IFD may cause an infinite loop: " + readInt3);
                return;
            }
            Log.w("ExifInterface", "Stop reading file since a wrong offset may cause an infinite loop: " + readInt3);
        }
    }

    private void y(C0142a c0142a, int i10) {
        b bVar;
        b bVar2 = this.f8826d[i10].get("ImageLength");
        b bVar3 = this.f8826d[i10].get("ImageWidth");
        if ((bVar2 == null || bVar3 == null) && (bVar = this.f8826d[i10].get("JPEGInterchangeFormat")) != null) {
            f(c0142a, bVar.i(this.f8828f), i10);
        }
    }

    private void z(C0142a c0142a) {
        HashMap<String, ExifInterface.ExifAttribute> hashMap = this.f8826d[4];
        b bVar = hashMap.get("Compression");
        if (bVar != null) {
            int i10 = bVar.i(this.f8828f);
            this.f8829g = i10;
            if (i10 != 1) {
                if (i10 == 6) {
                    l(c0142a, hashMap);
                    return;
                } else if (i10 != 7) {
                    return;
                }
            }
            if (r(hashMap)) {
                m(c0142a, hashMap);
                return;
            }
            return;
        }
        this.f8829g = 6;
        l(c0142a, hashMap);
    }

    public String c(String str) {
        b e10 = e(str);
        if (e10 != null) {
            if (!L.contains(str)) {
                return e10.j(this.f8828f);
            }
            if (str.equals("GPSTimeStamp")) {
                int i10 = e10.f8841a;
                if (i10 != 5 && i10 != 10) {
                    Log.w("ExifInterface", "GPS Timestamp format is not rational. format=" + e10.f8841a);
                    return null;
                }
                d[] dVarArr = (d[]) e10.k(this.f8828f);
                if (dVarArr != null && dVarArr.length == 3) {
                    return String.format("%02d:%02d:%02d", Integer.valueOf((int) (((float) dVarArr[0].f8848a) / ((float) dVarArr[0].f8849b))), Integer.valueOf((int) (((float) dVarArr[1].f8848a) / ((float) dVarArr[1].f8849b))), Integer.valueOf((int) (((float) dVarArr[2].f8848a) / ((float) dVarArr[2].f8849b))));
                }
                Log.w("ExifInterface", "Invalid GPS Timestamp array. array=" + Arrays.toString(dVarArr));
                return null;
            }
            try {
                return Double.toString(e10.h(this.f8828f));
            } catch (NumberFormatException unused) {
            }
        }
        return null;
    }

    public int d(String str, int i10) {
        b e10 = e(str);
        if (e10 == null) {
            return i10;
        }
        try {
            return e10.i(this.f8828f);
        } catch (NumberFormatException unused) {
            return i10;
        }
    }

    public static class C0142a extends InputStream implements DataInput {

        private static final ByteOrder f8835f = ByteOrder.LITTLE_ENDIAN;

        private static final ByteOrder f8836g = ByteOrder.BIG_ENDIAN;

        private DataInputStream f8837b;

        private ByteOrder f8838c;

        final int f8839d;

        int f8840e;

        public C0142a(InputStream inputStream) {
            this.f8838c = ByteOrder.BIG_ENDIAN;
            DataInputStream dataInputStream = new DataInputStream(inputStream);
            this.f8837b = dataInputStream;
            int available = dataInputStream.available();
            this.f8839d = available;
            this.f8840e = 0;
            this.f8837b.mark(available);
        }

        @Override
        public int available() {
            return this.f8837b.available();
        }

        public int b() {
            return this.f8840e;
        }

        public long d() {
            return readInt() & 4294967295L;
        }

        public void g(long j10) {
            int i10 = this.f8840e;
            if (i10 > j10) {
                this.f8840e = 0;
                this.f8837b.reset();
                this.f8837b.mark(this.f8839d);
            } else {
                j10 -= i10;
            }
            int i11 = (int) j10;
            if (skipBytes(i11) != i11) {
                throw new IOException("Couldn't seek up to the byteCount");
            }
        }

        public void h(ByteOrder byteOrder) {
            this.f8838c = byteOrder;
        }

        @Override
        public int read() {
            this.f8840e++;
            return this.f8837b.read();
        }

        @Override
        public boolean readBoolean() {
            this.f8840e++;
            return this.f8837b.readBoolean();
        }

        @Override
        public byte readByte() {
            int i10 = this.f8840e + 1;
            this.f8840e = i10;
            if (i10 <= this.f8839d) {
                int read = this.f8837b.read();
                if (read >= 0) {
                    return (byte) read;
                }
                throw new EOFException();
            }
            throw new EOFException();
        }

        @Override
        public char readChar() {
            this.f8840e += 2;
            return this.f8837b.readChar();
        }

        @Override
        public double readDouble() {
            return Double.longBitsToDouble(readLong());
        }

        @Override
        public float readFloat() {
            return Float.intBitsToFloat(readInt());
        }

        @Override
        public void readFully(byte[] bArr, int i10, int i11) {
            int i12 = this.f8840e + i11;
            this.f8840e = i12;
            if (i12 <= this.f8839d) {
                if (this.f8837b.read(bArr, i10, i11) != i11) {
                    throw new IOException("Couldn't read up to the length of buffer");
                }
                return;
            }
            throw new EOFException();
        }

        @Override
        public int readInt() {
            int i10 = this.f8840e + 4;
            this.f8840e = i10;
            if (i10 <= this.f8839d) {
                int read = this.f8837b.read();
                int read2 = this.f8837b.read();
                int read3 = this.f8837b.read();
                int read4 = this.f8837b.read();
                if ((read | read2 | read3 | read4) >= 0) {
                    ByteOrder byteOrder = this.f8838c;
                    if (byteOrder == f8835f) {
                        return (read4 << 24) + (read3 << 16) + (read2 << 8) + read;
                    }
                    if (byteOrder == f8836g) {
                        return (read << 24) + (read2 << 16) + (read3 << 8) + read4;
                    }
                    throw new IOException("Invalid byte order: " + this.f8838c);
                }
                throw new EOFException();
            }
            throw new EOFException();
        }

        @Override
        public String readLine() {
            Log.d("ExifInterface", "Currently unsupported");
            return null;
        }

        @Override
        public long readLong() {
            int i10 = this.f8840e + 8;
            this.f8840e = i10;
            if (i10 <= this.f8839d) {
                int read = this.f8837b.read();
                int read2 = this.f8837b.read();
                int read3 = this.f8837b.read();
                int read4 = this.f8837b.read();
                int read5 = this.f8837b.read();
                int read6 = this.f8837b.read();
                int read7 = this.f8837b.read();
                int read8 = this.f8837b.read();
                if ((read | read2 | read3 | read4 | read5 | read6 | read7 | read8) >= 0) {
                    ByteOrder byteOrder = this.f8838c;
                    if (byteOrder == f8835f) {
                        return (read8 << 56) + (read7 << 48) + (read6 << 40) + (read5 << 32) + (read4 << 24) + (read3 << 16) + (read2 << 8) + read;
                    }
                    if (byteOrder == f8836g) {
                        return (read << 56) + (read2 << 48) + (read3 << 40) + (read4 << 32) + (read5 << 24) + (read6 << 16) + (read7 << 8) + read8;
                    }
                    throw new IOException("Invalid byte order: " + this.f8838c);
                }
                throw new EOFException();
            }
            throw new EOFException();
        }

        @Override
        public short readShort() {
            int i10 = this.f8840e + 2;
            this.f8840e = i10;
            if (i10 <= this.f8839d) {
                int read = this.f8837b.read();
                int read2 = this.f8837b.read();
                if ((read | read2) >= 0) {
                    ByteOrder byteOrder = this.f8838c;
                    if (byteOrder == f8835f) {
                        return (short) ((read2 << 8) + read);
                    }
                    if (byteOrder == f8836g) {
                        return (short) ((read << 8) + read2);
                    }
                    throw new IOException("Invalid byte order: " + this.f8838c);
                }
                throw new EOFException();
            }
            throw new EOFException();
        }

        @Override
        public String readUTF() {
            this.f8840e += 2;
            return this.f8837b.readUTF();
        }

        @Override
        public int readUnsignedByte() {
            this.f8840e++;
            return this.f8837b.readUnsignedByte();
        }

        @Override
        public int readUnsignedShort() {
            int i10 = this.f8840e + 2;
            this.f8840e = i10;
            if (i10 <= this.f8839d) {
                int read = this.f8837b.read();
                int read2 = this.f8837b.read();
                if ((read | read2) >= 0) {
                    ByteOrder byteOrder = this.f8838c;
                    if (byteOrder == f8835f) {
                        return (read2 << 8) + read;
                    }
                    if (byteOrder == f8836g) {
                        return (read << 8) + read2;
                    }
                    throw new IOException("Invalid byte order: " + this.f8838c);
                }
                throw new EOFException();
            }
            throw new EOFException();
        }

        @Override
        public int skipBytes(int i10) {
            int min = Math.min(i10, this.f8839d - this.f8840e);
            int i11 = 0;
            while (i11 < min) {
                i11 += this.f8837b.skipBytes(min - i11);
            }
            this.f8840e += i11;
            return i11;
        }

        @Override
        public int read(byte[] bArr, int i10, int i11) {
            int read = this.f8837b.read(bArr, i10, i11);
            this.f8840e += read;
            return read;
        }

        @Override
        public void readFully(byte[] bArr) {
            int length = this.f8840e + bArr.length;
            this.f8840e = length;
            if (length <= this.f8839d) {
                if (this.f8837b.read(bArr, 0, bArr.length) != bArr.length) {
                    throw new IOException("Couldn't read up to the length of buffer");
                }
                return;
            }
            throw new EOFException();
        }

        public C0142a(byte[] bArr) {
            this(new ByteArrayInputStream(bArr));
        }
    }

    public static class c {

        public final int f8844a;

        public final String f8845b;

        public final int f8846c;

        public final int f8847d;

        c(String str, int i10, int i11) {
            this.f8845b = str;
            this.f8844a = i10;
            this.f8846c = i11;
            this.f8847d = -1;
        }

        boolean a(int i10) {
            int i11;
            int i12 = this.f8846c;
            if (i12 == 7 || i10 == 7 || i12 == i10 || (i11 = this.f8847d) == i10) {
                return true;
            }
            if ((i12 == 4 || i11 == 4) && i10 == 3) {
                return true;
            }
            if ((i12 == 9 || i11 == 9) && i10 == 8) {
                return true;
            }
            return (i12 == 12 || i11 == 12) && i10 == 11;
        }

        c(String str, int i10, int i11, int i12) {
            this.f8845b = str;
            this.f8844a = i10;
            this.f8846c = i11;
            this.f8847d = i12;
        }
    }
}