Roblox v2.616.655版本的 MD5 值为:0bc7d8a921fe7f043454ac7c31685936
以下内容为反编译后的 a.java 源代码,内容仅作参考
package a1;
import android.content.res.AssetManager;
import android.media.MediaDataSource;
import android.media.MediaMetadataRetriever;
import android.os.Build;
import android.system.Os;
import android.system.OsConstants;
import android.util.Log;
import com.appsflyer.oaid.BuildConfig;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.FileDescriptor;
import java.io.FileInputStream;
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.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TimeZone;
import java.util.regex.Pattern;
import java.util.zip.CRC32;
public class a {
private static SimpleDateFormat T;
private static SimpleDateFormat U;
private static final d[] Y;
private static final d[] Z;
private static final d[] f7a0;
private static final d[] f8b0;
private static final d[] f9c0;
private static final d f10d0;
private static final d[] f11e0;
private static final d[] f12f0;
private static final d[] f13g0;
private static final d[] f14h0;
static final d[][] f15i0;
private static final d[] f16j0;
private static final d f17k0;
private static final d f18l0;
private static final HashMap<Integer, d>[] f19m0;
private static final HashMap<String, d>[] f20n0;
private static final HashSet<String> f21o0;
private static final HashMap<Integer, Integer> f22p0;
static final Charset f23q0;
static final byte[] f24r0;
private static final byte[] f25s0;
private static final Pattern f26t0;
private static final Pattern f28u0;
private static final Pattern f30v0;
private static final Pattern f32w0;
private String f36a;
private FileDescriptor f37b;
private AssetManager.AssetInputStream f38c;
private int f39d;
private boolean f40e;
private final HashMap<String, c>[] f41f;
private Set<Integer> f42g;
private ByteOrder f43h;
private boolean f44i;
private boolean f45j;
private boolean f46k;
private int f47l;
private int f48m;
private byte[] f49n;
private int f50o;
private int f51p;
private int f52q;
private int f53r;
private int f54s;
private boolean f55t;
private static final boolean f27u = Log.isLoggable("ExifInterface", 3);
private static final List<Integer> f29v = Arrays.asList(1, 6, 3, 8);
private static final List<Integer> f31w = Arrays.asList(2, 7, 4, 5);
public static final int[] f33x = {8, 8, 8};
public static final int[] f34y = {4};
public static final int[] f35z = {8};
static final byte[] A = {-1, -40, -1};
private static final byte[] B = {102, 116, 121, 112};
private static final byte[] C = {109, 105, 102, 49};
private static final byte[] D = {104, 101, 105, 99};
private static final byte[] E = {79, 76, 89, 77, 80, 0};
private static final byte[] F = {79, 76, 89, 77, 80, 85, 83, 0, 73, 73};
private static final byte[] G = {-119, 80, 78, 71, 13, 10, 26, 10};
private static final byte[] H = {101, 88, 73, 102};
private static final byte[] I = {73, 72, 68, 82};
private static final byte[] J = {73, 69, 78, 68};
private static final byte[] K = {82, 73, 70, 70};
private static final byte[] L = {87, 69, 66, 80};
private static final byte[] M = {69, 88, 73, 70};
private static final byte[] N = {-99, 1, 42};
private static final byte[] O = "VP8X".getBytes(Charset.defaultCharset());
private static final byte[] P = "VP8L".getBytes(Charset.defaultCharset());
private static final byte[] Q = "VP8 ".getBytes(Charset.defaultCharset());
private static final byte[] R = "ANIM".getBytes(Charset.defaultCharset());
private static final byte[] S = "ANMF".getBytes(Charset.defaultCharset());
static final String[] V = {BuildConfig.FLAVOR, "BYTE", "STRING", "USHORT", "ULONG", "URATIONAL", "SBYTE", "UNDEFINED", "SSHORT", "SLONG", "SRATIONAL", "SINGLE", "DOUBLE", "IFD"};
static final int[] W = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 1};
static final byte[] X = {65, 83, 67, 73, 73, 0, 0, 0};
public class C0002a extends MediaDataSource {
long f56n;
final b f57o;
C0002a(b bVar) {
this.f57o = bVar;
}
@Override
public void close() throws IOException {
}
@Override
public long getSize() throws IOException {
return -1L;
}
@Override
public int readAt(long j10, byte[] bArr, int i10, int i11) throws IOException {
if (i11 == 0) {
return 0;
}
if (j10 < 0) {
return -1;
}
try {
long j11 = this.f56n;
if (j11 != j10) {
if (j11 >= 0 && j10 >= j11 + this.f57o.available()) {
return -1;
}
this.f57o.i(j10);
this.f56n = j10;
}
if (i11 > this.f57o.available()) {
i11 = this.f57o.available();
}
int read = this.f57o.read(bArr, i10, i11);
if (read >= 0) {
this.f56n += read;
return read;
}
} catch (IOException unused) {
}
this.f56n = -1L;
return -1;
}
}
public static class b extends InputStream implements DataInput {
private static final ByteOrder f59r = ByteOrder.LITTLE_ENDIAN;
private static final ByteOrder f60s = ByteOrder.BIG_ENDIAN;
private DataInputStream f61n;
private ByteOrder f62o;
final int f63p;
int f64q;
public b(InputStream inputStream) throws IOException {
this(inputStream, ByteOrder.BIG_ENDIAN);
}
@Override
public int available() throws IOException {
return this.f61n.available();
}
public int b() {
return this.f63p;
}
public int c() {
return this.f64q;
}
public long e() throws IOException {
return readInt() & 4294967295L;
}
public void i(long j10) throws IOException {
int i10 = this.f64q;
if (i10 > j10) {
this.f64q = 0;
this.f61n.reset();
this.f61n.mark(this.f63p);
} else {
j10 -= i10;
}
int i11 = (int) j10;
if (skipBytes(i11) != i11) {
throw new IOException("Couldn't seek up to the byteCount");
}
}
public void l(ByteOrder byteOrder) {
this.f62o = byteOrder;
}
@Override
public synchronized void mark(int i10) {
this.f61n.mark(i10);
}
@Override
public int read() throws IOException {
this.f64q++;
return this.f61n.read();
}
@Override
public boolean readBoolean() throws IOException {
this.f64q++;
return this.f61n.readBoolean();
}
@Override
public byte readByte() throws IOException {
int i10 = this.f64q + 1;
this.f64q = i10;
if (i10 <= this.f63p) {
int read = this.f61n.read();
if (read >= 0) {
return (byte) read;
}
throw new EOFException();
}
throw new EOFException();
}
@Override
public char readChar() throws IOException {
this.f64q += 2;
return this.f61n.readChar();
}
@Override
public double readDouble() throws IOException {
return Double.longBitsToDouble(readLong());
}
@Override
public float readFloat() throws IOException {
return Float.intBitsToFloat(readInt());
}
@Override
public void readFully(byte[] bArr, int i10, int i11) throws IOException {
int i12 = this.f64q + i11;
this.f64q = i12;
if (i12 <= this.f63p) {
if (this.f61n.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() throws IOException {
int i10 = this.f64q + 4;
this.f64q = i10;
if (i10 <= this.f63p) {
int read = this.f61n.read();
int read2 = this.f61n.read();
int read3 = this.f61n.read();
int read4 = this.f61n.read();
if ((read | read2 | read3 | read4) >= 0) {
ByteOrder byteOrder = this.f62o;
if (byteOrder == f59r) {
return (read4 << 24) + (read3 << 16) + (read2 << 8) + read;
}
if (byteOrder == f60s) {
return (read << 24) + (read2 << 16) + (read3 << 8) + read4;
}
throw new IOException("Invalid byte order: " + this.f62o);
}
throw new EOFException();
}
throw new EOFException();
}
@Override
public String readLine() throws IOException {
Log.d("ExifInterface", "Currently unsupported");
return null;
}
@Override
public long readLong() throws IOException {
int i10 = this.f64q + 8;
this.f64q = i10;
if (i10 <= this.f63p) {
int read = this.f61n.read();
int read2 = this.f61n.read();
int read3 = this.f61n.read();
int read4 = this.f61n.read();
int read5 = this.f61n.read();
int read6 = this.f61n.read();
int read7 = this.f61n.read();
int read8 = this.f61n.read();
if ((read | read2 | read3 | read4 | read5 | read6 | read7 | read8) >= 0) {
ByteOrder byteOrder = this.f62o;
if (byteOrder == f59r) {
return (read8 << 56) + (read7 << 48) + (read6 << 40) + (read5 << 32) + (read4 << 24) + (read3 << 16) + (read2 << 8) + read;
}
if (byteOrder == f60s) {
return (read << 56) + (read2 << 48) + (read3 << 40) + (read4 << 32) + (read5 << 24) + (read6 << 16) + (read7 << 8) + read8;
}
throw new IOException("Invalid byte order: " + this.f62o);
}
throw new EOFException();
}
throw new EOFException();
}
@Override
public short readShort() throws IOException {
int i10 = this.f64q + 2;
this.f64q = i10;
if (i10 <= this.f63p) {
int read = this.f61n.read();
int read2 = this.f61n.read();
if ((read | read2) >= 0) {
ByteOrder byteOrder = this.f62o;
if (byteOrder == f59r) {
return (short) ((read2 << 8) + read);
}
if (byteOrder == f60s) {
return (short) ((read << 8) + read2);
}
throw new IOException("Invalid byte order: " + this.f62o);
}
throw new EOFException();
}
throw new EOFException();
}
@Override
public String readUTF() throws IOException {
this.f64q += 2;
return this.f61n.readUTF();
}
@Override
public int readUnsignedByte() throws IOException {
this.f64q++;
return this.f61n.readUnsignedByte();
}
@Override
public int readUnsignedShort() throws IOException {
int i10 = this.f64q + 2;
this.f64q = i10;
if (i10 <= this.f63p) {
int read = this.f61n.read();
int read2 = this.f61n.read();
if ((read | read2) >= 0) {
ByteOrder byteOrder = this.f62o;
if (byteOrder == f59r) {
return (read2 << 8) + read;
}
if (byteOrder == f60s) {
return (read << 8) + read2;
}
throw new IOException("Invalid byte order: " + this.f62o);
}
throw new EOFException();
}
throw new EOFException();
}
@Override
public int skipBytes(int i10) throws IOException {
int min = Math.min(i10, this.f63p - this.f64q);
int i11 = 0;
while (i11 < min) {
i11 += this.f61n.skipBytes(min - i11);
}
this.f64q += i11;
return i11;
}
b(InputStream inputStream, ByteOrder byteOrder) throws IOException {
this.f62o = ByteOrder.BIG_ENDIAN;
DataInputStream dataInputStream = new DataInputStream(inputStream);
this.f61n = dataInputStream;
int available = dataInputStream.available();
this.f63p = available;
this.f64q = 0;
this.f61n.mark(available);
this.f62o = byteOrder;
}
@Override
public int read(byte[] bArr, int i10, int i11) throws IOException {
int read = this.f61n.read(bArr, i10, i11);
this.f64q += read;
return read;
}
@Override
public void readFully(byte[] bArr) throws IOException {
int length = this.f64q + bArr.length;
this.f64q = length;
if (length <= this.f63p) {
if (this.f61n.read(bArr, 0, bArr.length) != bArr.length) {
throw new IOException("Couldn't read up to the length of buffer");
}
return;
}
throw new EOFException();
}
public b(byte[] bArr) throws IOException {
this(new ByteArrayInputStream(bArr));
}
}
public static class c {
public final int f65a;
public final int f66b;
public final long f67c;
public final byte[] f68d;
c(int i10, int i11, byte[] bArr) {
this(i10, i11, -1L, bArr);
}
public static c a(String str) {
byte[] bytes = (str + (char) 0).getBytes(a.f23q0);
return new c(2, bytes.length, bytes);
}
public static c b(long j10, ByteOrder byteOrder) {
return c(new long[]{j10}, byteOrder);
}
public static c c(long[] jArr, ByteOrder byteOrder) {
ByteBuffer wrap = ByteBuffer.wrap(new byte[a.W[4] * jArr.length]);
wrap.order(byteOrder);
for (long j10 : jArr) {
wrap.putInt((int) j10);
}
return new c(4, jArr.length, wrap.array());
}
public static c d(e eVar, ByteOrder byteOrder) {
return e(new e[]{eVar}, byteOrder);
}
public static c e(e[] eVarArr, ByteOrder byteOrder) {
ByteBuffer wrap = ByteBuffer.wrap(new byte[a.W[5] * eVarArr.length]);
wrap.order(byteOrder);
for (e eVar : eVarArr) {
wrap.putInt((int) eVar.f73a);
wrap.putInt((int) eVar.f74b);
}
return new c(5, eVarArr.length, wrap.array());
}
public static c f(int i10, ByteOrder byteOrder) {
return g(new int[]{i10}, byteOrder);
}
public static c g(int[] iArr, ByteOrder byteOrder) {
ByteBuffer wrap = ByteBuffer.wrap(new byte[a.W[3] * iArr.length]);
wrap.order(byteOrder);
for (int i10 : iArr) {
wrap.putShort((short) i10);
}
return new c(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[]) {
long[] jArr = (long[]) k10;
if (jArr.length == 1) {
return jArr[0];
}
throw new NumberFormatException("There are more than one component");
} else if (k10 instanceof int[]) {
int[] iArr = (int[]) k10;
if (iArr.length == 1) {
return iArr[0];
}
throw new NumberFormatException("There are more than one component");
} else if (k10 instanceof double[]) {
double[] dArr = (double[]) k10;
if (dArr.length == 1) {
return dArr[0];
}
throw new NumberFormatException("There are more than one component");
} else if (k10 instanceof e[]) {
e[] eVarArr = (e[]) k10;
if (eVarArr.length == 1) {
return eVarArr[0].a();
}
throw new NumberFormatException("There are more than one component");
} else {
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");
} else if (k10 instanceof int[]) {
int[] iArr = (int[]) k10;
if (iArr.length == 1) {
return iArr[0];
}
throw new NumberFormatException("There are more than one component");
} else {
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 sb2 = new StringBuilder();
int i10 = 0;
if (k10 instanceof long[]) {
long[] jArr = (long[]) k10;
while (i10 < jArr.length) {
sb2.append(jArr[i10]);
i10++;
if (i10 != jArr.length) {
sb2.append(",");
}
}
return sb2.toString();
} else if (k10 instanceof int[]) {
int[] iArr = (int[]) k10;
while (i10 < iArr.length) {
sb2.append(iArr[i10]);
i10++;
if (i10 != iArr.length) {
sb2.append(",");
}
}
return sb2.toString();
} else if (k10 instanceof double[]) {
double[] dArr = (double[]) k10;
while (i10 < dArr.length) {
sb2.append(dArr[i10]);
i10++;
if (i10 != dArr.length) {
sb2.append(",");
}
}
return sb2.toString();
} else if (k10 instanceof e[]) {
e[] eVarArr = (e[]) k10;
while (i10 < eVarArr.length) {
sb2.append(eVarArr[i10].f73a);
sb2.append('/');
sb2.append(eVarArr[i10].f74b);
i10++;
if (i10 != eVarArr.length) {
sb2.append(",");
}
}
return sb2.toString();
} else {
return null;
}
}
Object k(ByteOrder byteOrder) {
b bVar;
InputStream inputStream;
byte b10;
byte[] bArr;
InputStream inputStream2 = null;
try {
try {
bVar = new b(this.f68d);
try {
bVar.l(byteOrder);
boolean z10 = true;
int i10 = 0;
switch (this.f65a) {
case 1:
case 6:
byte[] bArr2 = this.f68d;
if (bArr2.length == 1 && bArr2[0] >= 0 && bArr2[0] <= 1) {
String str = new String(new char[]{(char) (bArr2[0] + 48)});
try {
bVar.close();
} catch (IOException e10) {
Log.e("ExifInterface", "IOException occurred while closing InputStream", e10);
}
return str;
}
String str2 = new String(bArr2, a.f23q0);
try {
bVar.close();
} catch (IOException e11) {
Log.e("ExifInterface", "IOException occurred while closing InputStream", e11);
}
return str2;
case 2:
case 7:
if (this.f66b >= a.X.length) {
int i11 = 0;
while (true) {
bArr = a.X;
if (i11 < bArr.length) {
if (this.f68d[i11] != bArr[i11]) {
z10 = false;
} else {
i11++;
}
}
}
if (z10) {
i10 = bArr.length;
}
}
StringBuilder sb2 = new StringBuilder();
while (i10 < this.f66b && (b10 = this.f68d[i10]) != 0) {
if (b10 >= 32) {
sb2.append((char) b10);
} else {
sb2.append('?');
}
i10++;
}
String sb3 = sb2.toString();
try {
bVar.close();
} catch (IOException e12) {
Log.e("ExifInterface", "IOException occurred while closing InputStream", e12);
}
return sb3;
case 3:
int[] iArr = new int[this.f66b];
while (i10 < this.f66b) {
iArr[i10] = bVar.readUnsignedShort();
i10++;
}
try {
bVar.close();
} catch (IOException e13) {
Log.e("ExifInterface", "IOException occurred while closing InputStream", e13);
}
return iArr;
case 4:
long[] jArr = new long[this.f66b];
while (i10 < this.f66b) {
jArr[i10] = bVar.e();
i10++;
}
try {
bVar.close();
} catch (IOException e14) {
Log.e("ExifInterface", "IOException occurred while closing InputStream", e14);
}
return jArr;
case 5:
e[] eVarArr = new e[this.f66b];
while (i10 < this.f66b) {
eVarArr[i10] = new e(bVar.e(), bVar.e());
i10++;
}
try {
bVar.close();
} catch (IOException e15) {
Log.e("ExifInterface", "IOException occurred while closing InputStream", e15);
}
return eVarArr;
case 8:
int[] iArr2 = new int[this.f66b];
while (i10 < this.f66b) {
iArr2[i10] = bVar.readShort();
i10++;
}
try {
bVar.close();
} catch (IOException e16) {
Log.e("ExifInterface", "IOException occurred while closing InputStream", e16);
}
return iArr2;
case 9:
int[] iArr3 = new int[this.f66b];
while (i10 < this.f66b) {
iArr3[i10] = bVar.readInt();
i10++;
}
try {
bVar.close();
} catch (IOException e17) {
Log.e("ExifInterface", "IOException occurred while closing InputStream", e17);
}
return iArr3;
case 10:
e[] eVarArr2 = new e[this.f66b];
while (i10 < this.f66b) {
eVarArr2[i10] = new e(bVar.readInt(), bVar.readInt());
i10++;
}
try {
bVar.close();
} catch (IOException e18) {
Log.e("ExifInterface", "IOException occurred while closing InputStream", e18);
}
return eVarArr2;
case 11:
double[] dArr = new double[this.f66b];
while (i10 < this.f66b) {
dArr[i10] = bVar.readFloat();
i10++;
}
try {
bVar.close();
} catch (IOException e19) {
Log.e("ExifInterface", "IOException occurred while closing InputStream", e19);
}
return dArr;
case 12:
double[] dArr2 = new double[this.f66b];
while (i10 < this.f66b) {
dArr2[i10] = bVar.readDouble();
i10++;
}
try {
bVar.close();
} catch (IOException e20) {
Log.e("ExifInterface", "IOException occurred while closing InputStream", e20);
}
return dArr2;
default:
try {
bVar.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 (bVar != null) {
try {
bVar.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;
bVar = null;
} catch (Throwable th2) {
th = th2;
if (inputStream2 != null) {
}
throw th;
}
}
public String toString() {
return "(" + a.V[this.f65a] + ", data length:" + this.f68d.length + ")";
}
c(int i10, int i11, long j10, byte[] bArr) {
this.f65a = i10;
this.f66b = i11;
this.f67c = j10;
this.f68d = bArr;
}
}
public static class e {
public final long f73a;
public final long f74b;
e(long j10, long j11) {
if (j11 == 0) {
this.f73a = 0L;
this.f74b = 1L;
return;
}
this.f73a = j10;
this.f74b = j11;
}
public double a() {
return this.f73a / this.f74b;
}
public String toString() {
return this.f73a + "/" + this.f74b;
}
}
static {
d[] dVarArr;
d[] dVarArr2 = {new d("NewSubfileType", 254, 4), new d("SubfileType", 255, 4), new d("ImageWidth", 256, 3, 4), new d("ImageLength", 257, 3, 4), new d("BitsPerSample", 258, 3), new d("Compression", 259, 3), new d("PhotometricInterpretation", 262, 3), new d("ImageDescription", 270, 2), new d("Make", 271, 2), new d("Model", 272, 2), new d("StripOffsets", 273, 3, 4), new d("Orientation", 274, 3), new d("SamplesPerPixel", 277, 3), new d("RowsPerStrip", 278, 3, 4), new d("StripByteCounts", 279, 3, 4), new d("XResolution", 282, 5), new d("YResolution", 283, 5), new d("PlanarConfiguration", 284, 3), new d("ResolutionUnit", 296, 3), new d("TransferFunction", 301, 3), new d("Software", 305, 2), new d("DateTime", 306, 2), new d("Artist", 315, 2), new d("WhitePoint", 318, 5), new d("PrimaryChromaticities", 319, 5), new d("SubIFDPointer", 330, 4), new d("JPEGInterchangeFormat", 513, 4), new d("JPEGInterchangeFormatLength", 514, 4), new d("YCbCrCoefficients", 529, 5), new d("YCbCrSubSampling", 530, 3), new d("YCbCrPositioning", 531, 3), new d("ReferenceBlackWhite", 532, 5), new d("Copyright", 33432, 2), new d("ExifIFDPointer", 34665, 4), new d("GPSInfoIFDPointer", 34853, 4), new d("SensorTopBorder", 4, 4), new d("SensorLeftBorder", 5, 4), new d("SensorBottomBorder", 6, 4), new d("SensorRightBorder", 7, 4), new d("ISO", 23, 3), new d("JpgFromRaw", 46, 7), new d("Xmp", 700, 1)};
Y = dVarArr2;
d[] dVarArr3 = {new d("ExposureTime", 33434, 5), new d("FNumber", 33437, 5), new d("ExposureProgram", 34850, 3), new d("SpectralSensitivity", 34852, 2), new d("PhotographicSensitivity", 34855, 3), new d("OECF", 34856, 7), new d("SensitivityType", 34864, 3), new d("StandardOutputSensitivity", 34865, 4), new d("RecommendedExposureIndex", 34866, 4), new d("ISOSpeed", 34867, 4), new d("ISOSpeedLatitudeyyy", 34868, 4), new d("ISOSpeedLatitudezzz", 34869, 4), new d("ExifVersion", 36864, 2), new d("DateTimeOriginal", 36867, 2), new d("DateTimeDigitized", 36868, 2), new d("OffsetTime", 36880, 2), new d("OffsetTimeOriginal", 36881, 2), new d("OffsetTimeDigitized", 36882, 2), new d("ComponentsConfiguration", 37121, 7), new d("CompressedBitsPerPixel", 37122, 5), new d("ShutterSpeedValue", 37377, 10), new d("ApertureValue", 37378, 5), new d("BrightnessValue", 37379, 10), new d("ExposureBiasValue", 37380, 10), new d("MaxApertureValue", 37381, 5), new d("SubjectDistance", 37382, 5), new d("MeteringMode", 37383, 3), new d("LightSource", 37384, 3), new d("Flash", 37385, 3), new d("FocalLength", 37386, 5), new d("SubjectArea", 37396, 3), new d("MakerNote", 37500, 7), new d("UserComment", 37510, 7), new d("SubSecTime", 37520, 2), new d("SubSecTimeOriginal", 37521, 2), new d("SubSecTimeDigitized", 37522, 2), new d("FlashpixVersion", 40960, 7), new d("ColorSpace", 40961, 3), new d("PixelXDimension", 40962, 3, 4), new d("PixelYDimension", 40963, 3, 4), new d("RelatedSoundFile", 40964, 2), new d("InteroperabilityIFDPointer", 40965, 4), new d("FlashEnergy", 41483, 5), new d("SpatialFrequencyResponse", 41484, 7), new d("FocalPlaneXResolution", 41486, 5), new d("FocalPlaneYResolution", 41487, 5), new d("FocalPlaneResolutionUnit", 41488, 3), new d("SubjectLocation", 41492, 3), new d("ExposureIndex", 41493, 5), new d("SensingMethod", 41495, 3), new d("FileSource", 41728, 7), new d("SceneType", 41729, 7), new d("CFAPattern", 41730, 7), new d("CustomRendered", 41985, 3), new d("ExposureMode", 41986, 3), new d("WhiteBalance", 41987, 3), new d("DigitalZoomRatio", 41988, 5), new d("FocalLengthIn35mmFilm", 41989, 3), new d("SceneCaptureType", 41990, 3), new d("GainControl", 41991, 3), new d("Contrast", 41992, 3), new d("Saturation", 41993, 3), new d("Sharpness", 41994, 3), new d("DeviceSettingDescription", 41995, 7), new d("SubjectDistanceRange", 41996, 3), new d("ImageUniqueID", 42016, 2), new d("CameraOwnerName", 42032, 2), new d("BodySerialNumber", 42033, 2), new d("LensSpecification", 42034, 5), new d("LensMake", 42035, 2), new d("LensModel", 42036, 2), new d("Gamma", 42240, 5), new d("DNGVersion", 50706, 1), new d("DefaultCropSize", 50720, 3, 4)};
Z = dVarArr3;
d[] dVarArr4 = {new d("GPSVersionID", 0, 1), new d("GPSLatitudeRef", 1, 2), new d("GPSLatitude", 2, 5, 10), new d("GPSLongitudeRef", 3, 2), new d("GPSLongitude", 4, 5, 10), new d("GPSAltitudeRef", 5, 1), new d("GPSAltitude", 6, 5), new d("GPSTimeStamp", 7, 5), new d("GPSSatellites", 8, 2), new d("GPSStatus", 9, 2), new d("GPSMeasureMode", 10, 2), new d("GPSDOP", 11, 5), new d("GPSSpeedRef", 12, 2), new d("GPSSpeed", 13, 5), new d("GPSTrackRef", 14, 2), new d("GPSTrack", 15, 5), new d("GPSImgDirectionRef", 16, 2), new d("GPSImgDirection", 17, 5), new d("GPSMapDatum", 18, 2), new d("GPSDestLatitudeRef", 19, 2), new d("GPSDestLatitude", 20, 5), new d("GPSDestLongitudeRef", 21, 2), new d("GPSDestLongitude", 22, 5), new d("GPSDestBearingRef", 23, 2), new d("GPSDestBearing", 24, 5), new d("GPSDestDistanceRef", 25, 2), new d("GPSDestDistance", 26, 5), new d("GPSProcessingMethod", 27, 7), new d("GPSAreaInformation", 28, 7), new d("GPSDateStamp", 29, 2), new d("GPSDifferential", 30, 3), new d("GPSHPositioningError", 31, 5)};
f7a0 = dVarArr4;
d[] dVarArr5 = {new d("InteroperabilityIndex", 1, 2)};
f8b0 = dVarArr5;
d[] dVarArr6 = {new d("NewSubfileType", 254, 4), new d("SubfileType", 255, 4), new d("ThumbnailImageWidth", 256, 3, 4), new d("ThumbnailImageLength", 257, 3, 4), new d("BitsPerSample", 258, 3), new d("Compression", 259, 3), new d("PhotometricInterpretation", 262, 3), new d("ImageDescription", 270, 2), new d("Make", 271, 2), new d("Model", 272, 2), new d("StripOffsets", 273, 3, 4), new d("ThumbnailOrientation", 274, 3), new d("SamplesPerPixel", 277, 3), new d("RowsPerStrip", 278, 3, 4), new d("StripByteCounts", 279, 3, 4), new d("XResolution", 282, 5), new d("YResolution", 283, 5), new d("PlanarConfiguration", 284, 3), new d("ResolutionUnit", 296, 3), new d("TransferFunction", 301, 3), new d("Software", 305, 2), new d("DateTime", 306, 2), new d("Artist", 315, 2), new d("WhitePoint", 318, 5), new d("PrimaryChromaticities", 319, 5), new d("SubIFDPointer", 330, 4), new d("JPEGInterchangeFormat", 513, 4), new d("JPEGInterchangeFormatLength", 514, 4), new d("YCbCrCoefficients", 529, 5), new d("YCbCrSubSampling", 530, 3), new d("YCbCrPositioning", 531, 3), new d("ReferenceBlackWhite", 532, 5), new d("Copyright", 33432, 2), new d("ExifIFDPointer", 34665, 4), new d("GPSInfoIFDPointer", 34853, 4), new d("DNGVersion", 50706, 1), new d("DefaultCropSize", 50720, 3, 4)};
f9c0 = dVarArr6;
f10d0 = new d("StripOffsets", 273, 3);
d[] dVarArr7 = {new d("ThumbnailImage", 256, 7), new d("CameraSettingsIFDPointer", 8224, 4), new d("ImageProcessingIFDPointer", 8256, 4)};
f11e0 = dVarArr7;
d[] dVarArr8 = {new d("PreviewImageStart", 257, 4), new d("PreviewImageLength", 258, 4)};
f12f0 = dVarArr8;
d[] dVarArr9 = {new d("AspectFrame", 4371, 3)};
f13g0 = dVarArr9;
d[] dVarArr10 = {new d("ColorSpace", 55, 3)};
f14h0 = dVarArr10;
d[][] dVarArr11 = {dVarArr2, dVarArr3, dVarArr4, dVarArr5, dVarArr6, dVarArr2, dVarArr7, dVarArr8, dVarArr9, dVarArr10};
f15i0 = dVarArr11;
f16j0 = new d[]{new d("SubIFDPointer", 330, 4), new d("ExifIFDPointer", 34665, 4), new d("GPSInfoIFDPointer", 34853, 4), new d("InteroperabilityIFDPointer", 40965, 4), new d("CameraSettingsIFDPointer", 8224, 1), new d("ImageProcessingIFDPointer", 8256, 1)};
f17k0 = new d("JPEGInterchangeFormat", 513, 4);
f18l0 = new d("JPEGInterchangeFormatLength", 514, 4);
f19m0 = new HashMap[dVarArr11.length];
f20n0 = new HashMap[dVarArr11.length];
f21o0 = new HashSet<>(Arrays.asList("FNumber", "DigitalZoomRatio", "ExposureTime", "SubjectDistance", "GPSTimeStamp"));
f22p0 = new HashMap<>();
Charset forName = Charset.forName("US-ASCII");
f23q0 = forName;
f24r0 = "Exif\u0000\u0000".getBytes(forName);
f25s0 = "http://ns.adobe.com/xap/1.0/\u0000".getBytes(forName);
Locale locale = Locale.US;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss", locale);
T = simpleDateFormat;
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", locale);
U = simpleDateFormat2;
simpleDateFormat2.setTimeZone(TimeZone.getTimeZone("UTC"));
int i10 = 0;
while (true) {
d[][] dVarArr12 = f15i0;
if (i10 < dVarArr12.length) {
f19m0[i10] = new HashMap<>();
f20n0[i10] = new HashMap<>();
for (d dVar : dVarArr12[i10]) {
f19m0[i10].put(Integer.valueOf(dVar.f69a), dVar);
f20n0[i10].put(dVar.f70b, dVar);
}
i10++;
} else {
HashMap<Integer, Integer> hashMap = f22p0;
d[] dVarArr13 = f16j0;
hashMap.put(Integer.valueOf(dVarArr13[0].f69a), 5);
hashMap.put(Integer.valueOf(dVarArr13[1].f69a), 1);
hashMap.put(Integer.valueOf(dVarArr13[2].f69a), 2);
hashMap.put(Integer.valueOf(dVarArr13[3].f69a), 3);
hashMap.put(Integer.valueOf(dVarArr13[4].f69a), 7);
hashMap.put(Integer.valueOf(dVarArr13[5].f69a), 8);
f26t0 = Pattern.compile(".*[1-9].*");
f28u0 = Pattern.compile("^(\\d{2}):(\\d{2}):(\\d{2})$");
f30v0 = Pattern.compile("^(\\d{4}):(\\d{2}):(\\d{2})\\s(\\d{2}):(\\d{2}):(\\d{2})$");
f32w0 = Pattern.compile("^(\\d{4})-(\\d{2})-(\\d{2})\\s(\\d{2}):(\\d{2}):(\\d{2})$");
return;
}
}
}
public a(InputStream inputStream) throws IOException {
this(inputStream, 0);
}
private boolean A(byte[] bArr) throws IOException {
int i10 = 0;
while (true) {
byte[] bArr2 = G;
if (i10 >= bArr2.length) {
return true;
}
if (bArr[i10] != bArr2[i10]) {
return false;
}
i10++;
}
}
private boolean B(byte[] bArr) throws IOException {
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 C(byte[] bArr) throws IOException {
b bVar = null;
try {
b bVar2 = new b(bArr);
try {
ByteOrder K2 = K(bVar2);
this.f43h = K2;
bVar2.l(K2);
boolean z10 = bVar2.readShort() == 85;
bVar2.close();
return z10;
} catch (Exception unused) {
bVar = bVar2;
if (bVar != null) {
bVar.close();
}
return false;
} catch (Throwable th) {
th = th;
bVar = bVar2;
if (bVar != null) {
bVar.close();
}
throw th;
}
} catch (Exception unused2) {
} catch (Throwable th2) {
th = th2;
}
}
private static boolean D(FileDescriptor fileDescriptor) {
try {
Os.lseek(fileDescriptor, 0L, OsConstants.SEEK_CUR);
return true;
} catch (Exception unused) {
if (f27u) {
Log.d("ExifInterface", "The file descriptor for the given input is not seekable");
return false;
}
return false;
}
}
private boolean E(HashMap hashMap) throws IOException {
c cVar;
int i10;
c cVar2 = (c) hashMap.get("BitsPerSample");
if (cVar2 != null) {
int[] iArr = (int[]) cVar2.k(this.f43h);
int[] iArr2 = f33x;
if (Arrays.equals(iArr2, iArr)) {
return true;
}
if (this.f39d == 3 && (cVar = (c) hashMap.get("PhotometricInterpretation")) != null && (((i10 = cVar.i(this.f43h)) == 1 && Arrays.equals(iArr, f35z)) || (i10 == 6 && Arrays.equals(iArr, iArr2)))) {
return true;
}
}
if (f27u) {
Log.d("ExifInterface", "Unsupported data type value");
return false;
}
return false;
}
private boolean F(HashMap hashMap) throws IOException {
c cVar = (c) hashMap.get("ImageLength");
c cVar2 = (c) hashMap.get("ImageWidth");
if (cVar == null || cVar2 == null) {
return false;
}
return cVar.i(this.f43h) <= 512 && cVar2.i(this.f43h) <= 512;
}
private boolean G(byte[] bArr) throws IOException {
int i10 = 0;
while (true) {
byte[] bArr2 = K;
if (i10 >= bArr2.length) {
int i11 = 0;
while (true) {
byte[] bArr3 = L;
if (i11 >= bArr3.length) {
return true;
}
if (bArr[K.length + i11 + 4] != bArr3[i11]) {
return false;
}
i11++;
}
} else if (bArr[i10] != bArr2[i10]) {
return false;
} else {
i10++;
}
}
}
private void H(InputStream inputStream) {
Objects.requireNonNull(inputStream, "inputstream shouldn't be null");
for (int i10 = 0; i10 < f15i0.length; i10++) {
try {
try {
this.f41f[i10] = new HashMap<>();
} catch (IOException e10) {
boolean z10 = f27u;
if (z10) {
Log.w("ExifInterface", "Invalid image: ExifInterface got an unsupported image format file(ExifInterface supports JPEG and some RAW image formats only) or a corrupted JPEG file to ExifInterface.", e10);
}
a();
if (!z10) {
return;
}
}
} finally {
a();
if (f27u) {
J();
}
}
}
if (!this.f40e) {
BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream, 5000);
this.f39d = m(bufferedInputStream);
inputStream = bufferedInputStream;
}
b bVar = new b(inputStream);
if (!this.f40e) {
switch (this.f39d) {
case 0:
case 1:
case 2:
case 3:
case 5:
case 6:
case 8:
case 11:
q(bVar);
break;
case 4:
k(bVar, 0, 0);
a();
if (f27u) {
J();
return;
}
return;
case 7:
n(bVar);
break;
case 9:
p(bVar);
a();
if (f27u) {
J();
return;
}
return;
case 10:
r(bVar);
a();
if (f27u) {
J();
return;
}
return;
case 12:
j(bVar);
break;
case 13:
o(bVar);
a();
if (f27u) {
J();
return;
}
return;
case 14:
t(bVar);
a();
if (f27u) {
J();
return;
}
return;
}
} else {
s(bVar);
}
bVar.i(this.f51p);
O(bVar);
}
private void I(b bVar, int i10) throws IOException {
ByteOrder K2 = K(bVar);
this.f43h = K2;
bVar.l(K2);
int readUnsignedShort = bVar.readUnsignedShort();
int i11 = this.f39d;
if (i11 != 7 && i11 != 10 && readUnsignedShort != 42) {
throw new IOException("Invalid start code: " + Integer.toHexString(readUnsignedShort));
}
int readInt = bVar.readInt();
if (readInt >= 8 && readInt < i10) {
int i12 = readInt - 8;
if (i12 <= 0 || bVar.skipBytes(i12) == i12) {
return;
}
throw new IOException("Couldn't jump to first Ifd: " + i12);
}
throw new IOException("Invalid first Ifd offset: " + readInt);
}
private void J() {
for (int i10 = 0; i10 < this.f41f.length; i10++) {
Log.d("ExifInterface", "The size of tag group[" + i10 + "]: " + this.f41f[i10].size());
for (Map.Entry<String, c> entry : this.f41f[i10].entrySet()) {
c value = entry.getValue();
Log.d("ExifInterface", "tagName: " + entry.getKey() + ", tagType: " + value.toString() + ", tagValue: '" + value.j(this.f43h) + "'");
}
}
}
private ByteOrder K(b bVar) throws IOException {
short readShort = bVar.readShort();
if (readShort == 18761) {
if (f27u) {
Log.d("ExifInterface", "readExifSegment: Byte Align II");
}
return ByteOrder.LITTLE_ENDIAN;
} else if (readShort == 19789) {
if (f27u) {
Log.d("ExifInterface", "readExifSegment: Byte Align MM");
}
return ByteOrder.BIG_ENDIAN;
} else {
throw new IOException("Invalid byte order: " + Integer.toHexString(readShort));
}
}
private void L(byte[] bArr, int i10) throws IOException {
b bVar = new b(bArr);
I(bVar, bArr.length);
M(bVar, i10);
}
private void M(b bVar, int i10) throws IOException {
String str;
short s10;
int[] iArr;
long j10;
boolean z10;
short s11;
d dVar;
long j11;
int i11;
int i12;
long j12;
int readUnsignedShort;
long j13;
int i13 = i10;
this.f42g.add(Integer.valueOf(bVar.f64q));
if (bVar.f64q + 2 > bVar.f63p) {
return;
}
short readShort = bVar.readShort();
String str2 = "ExifInterface";
if (f27u) {
Log.d("ExifInterface", "numberOfDirectoryEntry: " + ((int) readShort));
}
if (bVar.f64q + (readShort * 12) > bVar.f63p || readShort <= 0) {
return;
}
char c10 = 0;
short s12 = 0;
while (s12 < readShort) {
int readUnsignedShort2 = bVar.readUnsignedShort();
int readUnsignedShort3 = bVar.readUnsignedShort();
int readInt = bVar.readInt();
long c11 = bVar.c() + 4;
d dVar2 = f19m0[i13].get(Integer.valueOf(readUnsignedShort2));
boolean z11 = f27u;
if (z11) {
Object[] objArr = new Object[5];
objArr[c10] = Integer.valueOf(i10);
objArr[1] = Integer.valueOf(readUnsignedShort2);
objArr[2] = dVar2 != null ? dVar2.f70b : null;
objArr[3] = Integer.valueOf(readUnsignedShort3);
objArr[4] = Integer.valueOf(readInt);
Log.d(str2, String.format("ifdType: %d, tagNumber: %d, tagName: %s, dataFormat: %d, numberOfComponents: %d", objArr));
}
if (dVar2 != null) {
if (readUnsignedShort3 > 0) {
if (readUnsignedShort3 < W.length) {
if (dVar2.a(readUnsignedShort3)) {
if (readUnsignedShort3 == 7) {
readUnsignedShort3 = dVar2.f71c;
}
str = str2;
s10 = s12;
j10 = readInt * iArr[readUnsignedShort3];
if (j10 < 0 || j10 > 2147483647L) {
if (z11) {
Log.d(str, "Skip the tag entry since the number of components is invalid: " + readInt);
}
z10 = false;
if (z10) {
bVar.i(c11);
s11 = readShort;
} else {
if (j10 > 4) {
int readInt2 = bVar.readInt();
s11 = readShort;
if (z11) {
StringBuilder sb2 = new StringBuilder();
i11 = readUnsignedShort3;
sb2.append("seek to data offset: ");
sb2.append(readInt2);
Log.d(str, sb2.toString());
} else {
i11 = readUnsignedShort3;
}
if (this.f39d == 7) {
if ("MakerNote".equals(dVar2.f70b)) {
this.f52q = readInt2;
} else if (i13 == 6 && "ThumbnailImage".equals(dVar2.f70b)) {
this.f53r = readInt2;
this.f54s = readInt;
c f10 = c.f(6, this.f43h);
i12 = readInt;
c b10 = c.b(this.f53r, this.f43h);
dVar = dVar2;
c b11 = c.b(this.f54s, this.f43h);
this.f41f[4].put("Compression", f10);
this.f41f[4].put("JPEGInterchangeFormat", b10);
this.f41f[4].put("JPEGInterchangeFormatLength", b11);
j13 = readInt2;
j11 = j10;
if (j13 + j10 > bVar.f63p) {
bVar.i(j13);
} else {
if (z11) {
Log.d(str, "Skip the tag entry since data offset is invalid: " + readInt2);
}
bVar.i(c11);
}
}
}
dVar = dVar2;
i12 = readInt;
j13 = readInt2;
j11 = j10;
if (j13 + j10 > bVar.f63p) {
}
} else {
s11 = readShort;
dVar = dVar2;
j11 = j10;
i11 = readUnsignedShort3;
i12 = readInt;
}
Integer num = f22p0.get(Integer.valueOf(readUnsignedShort2));
if (z11) {
StringBuilder sb3 = new StringBuilder();
sb3.append("nextIfdType: ");
sb3.append(num);
sb3.append(" byteCount: ");
j12 = j11;
sb3.append(j12);
Log.d(str, sb3.toString());
} else {
j12 = j11;
}
if (num != null) {
long j14 = -1;
int i14 = i11;
if (i14 == 3) {
readUnsignedShort = bVar.readUnsignedShort();
} else {
if (i14 == 4) {
j14 = bVar.e();
} else if (i14 == 8) {
readUnsignedShort = bVar.readShort();
} else if (i14 == 9 || i14 == 13) {
readUnsignedShort = bVar.readInt();
}
if (z11) {
Log.d(str, String.format("Offset: %d, tagName: %s", Long.valueOf(j14), dVar.f70b));
}
if (j14 > 0 || j14 >= bVar.f63p) {
if (z11) {
Log.d(str, "Skip jump into the IFD since its offset is invalid: " + j14);
}
} else if (!this.f42g.contains(Integer.valueOf((int) j14))) {
bVar.i(j14);
M(bVar, num.intValue());
} else if (z11) {
Log.d(str, "Skip jump into the IFD since it has already been read: IfdType " + num + " (at " + j14 + ")");
}
bVar.i(c11);
}
j14 = readUnsignedShort;
if (z11) {
}
if (j14 > 0) {
}
if (z11) {
}
bVar.i(c11);
} else {
d dVar3 = dVar;
int c12 = bVar.c() + this.f51p;
byte[] bArr = new byte[(int) j12];
bVar.readFully(bArr);
c cVar = new c(i11, i12, c12, bArr);
this.f41f[i10].put(dVar3.f70b, cVar);
if ("DNGVersion".equals(dVar3.f70b)) {
this.f39d = 3;
}
if ((("Make".equals(dVar3.f70b) || "Model".equals(dVar3.f70b)) && cVar.j(this.f43h).contains("PENTAX")) || ("Compression".equals(dVar3.f70b) && cVar.i(this.f43h) == 65535)) {
this.f39d = 8;
}
if (bVar.c() != c11) {
bVar.i(c11);
}
}
s12 = (short) (s10 + 1);
i13 = i10;
str2 = str;
readShort = s11;
c10 = 0;
}
s12 = (short) (s10 + 1);
i13 = i10;
str2 = str;
readShort = s11;
c10 = 0;
} else {
z10 = true;
if (z10) {
}
s12 = (short) (s10 + 1);
i13 = i10;
str2 = str;
readShort = s11;
c10 = 0;
}
} else if (z11) {
Log.d(str2, "Skip the tag entry since data format (" + V[readUnsignedShort3] + ") is unexpected for tag: " + dVar2.f70b);
}
}
}
str = str2;
s10 = s12;
if (z11) {
Log.d(str, "Skip the tag entry since data format is invalid: " + readUnsignedShort3);
}
j10 = 0;
z10 = false;
if (z10) {
}
s12 = (short) (s10 + 1);
i13 = i10;
str2 = str;
readShort = s11;
c10 = 0;
} else if (z11) {
Log.d(str2, "Skip the tag entry since tag number is not defined: " + readUnsignedShort2);
}
str = str2;
s10 = s12;
j10 = 0;
z10 = false;
if (z10) {
}
s12 = (short) (s10 + 1);
i13 = i10;
str2 = str;
readShort = s11;
c10 = 0;
}
String str3 = str2;
if (bVar.c() + 4 <= bVar.f63p) {
int readInt3 = bVar.readInt();
boolean z12 = f27u;
if (z12) {
Log.d(str3, String.format("nextIfdOffset: %d", Integer.valueOf(readInt3)));
}
long j15 = readInt3;
if (j15 <= 0 || readInt3 >= bVar.f63p) {
if (z12) {
Log.d(str3, "Stop reading file since a wrong offset may cause an infinite loop: " + readInt3);
}
} else if (this.f42g.contains(Integer.valueOf(readInt3))) {
if (z12) {
Log.d(str3, "Stop reading file since re-reading an IFD may cause an infinite loop: " + readInt3);
}
} else {
bVar.i(j15);
if (this.f41f[4].isEmpty()) {
M(bVar, 4);
} else if (this.f41f[5].isEmpty()) {
M(bVar, 5);
}
}
}
}
private void N(b bVar, int i10) throws IOException {
c cVar = this.f41f[i10].get("ImageLength");
c cVar2 = this.f41f[i10].get("ImageWidth");
if (cVar == null || cVar2 == null) {
c cVar3 = this.f41f[i10].get("JPEGInterchangeFormat");
c cVar4 = this.f41f[i10].get("JPEGInterchangeFormatLength");
if (cVar3 == null || cVar4 == null) {
return;
}
int i11 = cVar3.i(this.f43h);
int i12 = cVar3.i(this.f43h);
bVar.i(i11);
byte[] bArr = new byte[i12];
bVar.read(bArr);
k(new b(bArr), i11, i10);
}
}
private void O(b bVar) throws IOException {
HashMap<String, c> hashMap = this.f41f[4];
c cVar = hashMap.get("Compression");
if (cVar != null) {
int i10 = cVar.i(this.f43h);
this.f50o = i10;
if (i10 != 1) {
if (i10 == 6) {
u(bVar, hashMap);
return;
} else if (i10 != 7) {
return;
}
}
if (E(hashMap)) {
v(bVar, hashMap);
return;
}
return;
}
this.f50o = 6;
u(bVar, hashMap);
}
private static boolean P(byte[] bArr, byte[] bArr2) {
if (bArr == null || bArr2 == null || bArr.length < bArr2.length) {
return false;
}
for (int i10 = 0; i10 < bArr2.length; i10++) {
if (bArr[i10] != bArr2[i10]) {
return false;
}
}
return true;
}
private void Q(int i10, int i11) throws IOException {
if (!this.f41f[i10].isEmpty() && !this.f41f[i11].isEmpty()) {
c cVar = this.f41f[i10].get("ImageLength");
c cVar2 = this.f41f[i10].get("ImageWidth");
c cVar3 = this.f41f[i11].get("ImageLength");
c cVar4 = this.f41f[i11].get("ImageWidth");
if (cVar == null || cVar2 == null) {
if (f27u) {
Log.d("ExifInterface", "First image does not contain valid size information");
}
} else if (cVar3 != null && cVar4 != null) {
int i12 = cVar.i(this.f43h);
int i13 = cVar2.i(this.f43h);
int i14 = cVar3.i(this.f43h);
int i15 = cVar4.i(this.f43h);
if (i12 >= i14 || i13 >= i15) {
return;
}
HashMap<String, c>[] hashMapArr = this.f41f;
HashMap<String, c> hashMap = hashMapArr[i10];
hashMapArr[i10] = hashMapArr[i11];
hashMapArr[i11] = hashMap;
} else if (f27u) {
Log.d("ExifInterface", "Second image does not contain valid size information");
}
} else if (f27u) {
Log.d("ExifInterface", "Cannot perform swap since only one image data exists");
}
}
private void R(b bVar, int i10) throws IOException {
c f10;
c f11;
c cVar = this.f41f[i10].get("DefaultCropSize");
c cVar2 = this.f41f[i10].get("SensorTopBorder");
c cVar3 = this.f41f[i10].get("SensorLeftBorder");
c cVar4 = this.f41f[i10].get("SensorBottomBorder");
c cVar5 = this.f41f[i10].get("SensorRightBorder");
if (cVar == null) {
if (cVar2 != null && cVar3 != null && cVar4 != null && cVar5 != null) {
int i11 = cVar2.i(this.f43h);
int i12 = cVar4.i(this.f43h);
int i13 = cVar5.i(this.f43h);
int i14 = cVar3.i(this.f43h);
if (i12 <= i11 || i13 <= i14) {
return;
}
c f12 = c.f(i12 - i11, this.f43h);
c f13 = c.f(i13 - i14, this.f43h);
this.f41f[i10].put("ImageLength", f12);
this.f41f[i10].put("ImageWidth", f13);
return;
}
N(bVar, i10);
return;
}
if (cVar.f65a == 5) {
e[] eVarArr = (e[]) cVar.k(this.f43h);
if (eVarArr != null && eVarArr.length == 2) {
f10 = c.d(eVarArr[0], this.f43h);
f11 = c.d(eVarArr[1], this.f43h);
} else {
Log.w("ExifInterface", "Invalid crop size values. cropSize=" + Arrays.toString(eVarArr));
return;
}
} else {
int[] iArr = (int[]) cVar.k(this.f43h);
if (iArr != null && iArr.length == 2) {
f10 = c.f(iArr[0], this.f43h);
f11 = c.f(iArr[1], this.f43h);
} else {
Log.w("ExifInterface", "Invalid crop size values. cropSize=" + Arrays.toString(iArr));
return;
}
}
this.f41f[i10].put("ImageWidth", f10);
this.f41f[i10].put("ImageLength", f11);
}
private void S() throws IOException {
Q(0, 5);
Q(0, 4);
Q(5, 4);
c cVar = this.f41f[1].get("PixelXDimension");
c cVar2 = this.f41f[1].get("PixelYDimension");
if (cVar != null && cVar2 != null) {
this.f41f[0].put("ImageWidth", cVar);
this.f41f[0].put("ImageLength", cVar2);
}
if (this.f41f[4].isEmpty() && F(this.f41f[5])) {
HashMap<String, c>[] hashMapArr = this.f41f;
hashMapArr[4] = hashMapArr[5];
hashMapArr[5] = new HashMap<>();
}
if (F(this.f41f[4])) {
return;
}
Log.d("ExifInterface", "No image meets the size requirements of a thumbnail image.");
}
private void a() {
String f10 = f("DateTimeOriginal");
if (f10 != null && f("DateTime") == null) {
this.f41f[0].put("DateTime", c.a(f10));
}
if (f("ImageWidth") == null) {
this.f41f[0].put("ImageWidth", c.b(0L, this.f43h));
}
if (f("ImageLength") == null) {
this.f41f[0].put("ImageLength", c.b(0L, this.f43h));
}
if (f("Orientation") == null) {
this.f41f[0].put("Orientation", c.b(0L, this.f43h));
}
if (f("LightSource") == null) {
this.f41f[1].put("LightSource", c.b(0L, this.f43h));
}
}
private static String b(byte[] bArr) {
StringBuilder sb2 = new StringBuilder(bArr.length * 2);
for (int i10 = 0; i10 < bArr.length; i10++) {
sb2.append(String.format("%02x", Byte.valueOf(bArr[i10])));
}
return sb2.toString();
}
private static double c(String str, String str2) {
try {
String[] split = str.split(",", -1);
String[] split2 = split[0].split("/", -1);
String[] split3 = split[1].split("/", -1);
String[] split4 = split[2].split("/", -1);
double parseDouble = (Double.parseDouble(split2[0].trim()) / Double.parseDouble(split2[1].trim())) + ((Double.parseDouble(split3[0].trim()) / Double.parseDouble(split3[1].trim())) / 60.0d) + ((Double.parseDouble(split4[0].trim()) / Double.parseDouble(split4[1].trim())) / 3600.0d);
if (!str2.equals("S") && !str2.equals("W")) {
if (!str2.equals("N") && !str2.equals("E")) {
throw new IllegalArgumentException();
}
return parseDouble;
}
return -parseDouble;
} catch (ArrayIndexOutOfBoundsException | NumberFormatException unused) {
throw new IllegalArgumentException();
}
}
private static long[] d(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;
} else if (obj instanceof long[]) {
return (long[]) obj;
} else {
return null;
}
}
private c i(String str) {
Objects.requireNonNull(str, "tag shouldn't be null");
if ("ISOSpeedRatings".equals(str)) {
if (f27u) {
Log.d("ExifInterface", "getExifAttribute: Replacing TAG_ISO_SPEED_RATINGS with TAG_PHOTOGRAPHIC_SENSITIVITY.");
}
str = "PhotographicSensitivity";
}
for (int i10 = 0; i10 < f15i0.length; i10++) {
c cVar = this.f41f[i10].get(str);
if (cVar != null) {
return cVar;
}
}
return null;
}
private void j(b bVar) throws IOException {
String str;
String str2;
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
try {
if (Build.VERSION.SDK_INT >= 23) {
mediaMetadataRetriever.setDataSource(new C0002a(bVar));
} else {
FileDescriptor fileDescriptor = this.f37b;
if (fileDescriptor != null) {
mediaMetadataRetriever.setDataSource(fileDescriptor);
} else {
String str3 = this.f36a;
if (str3 == null) {
return;
}
mediaMetadataRetriever.setDataSource(str3);
}
}
String extractMetadata = mediaMetadataRetriever.extractMetadata(33);
String extractMetadata2 = mediaMetadataRetriever.extractMetadata(34);
String extractMetadata3 = mediaMetadataRetriever.extractMetadata(26);
String extractMetadata4 = mediaMetadataRetriever.extractMetadata(17);
String str4 = null;
if ("yes".equals(extractMetadata3)) {
str4 = mediaMetadataRetriever.extractMetadata(29);
str = mediaMetadataRetriever.extractMetadata(30);
str2 = mediaMetadataRetriever.extractMetadata(31);
} else if ("yes".equals(extractMetadata4)) {
str4 = mediaMetadataRetriever.extractMetadata(18);
str = mediaMetadataRetriever.extractMetadata(19);
str2 = mediaMetadataRetriever.extractMetadata(24);
} else {
str = null;
str2 = null;
}
if (str4 != null) {
this.f41f[0].put("ImageWidth", c.f(Integer.parseInt(str4), this.f43h));
}
if (str != null) {
this.f41f[0].put("ImageLength", c.f(Integer.parseInt(str), this.f43h));
}
if (str2 != null) {
int i10 = 1;
int parseInt = Integer.parseInt(str2);
if (parseInt == 90) {
i10 = 6;
} else if (parseInt == 180) {
i10 = 3;
} else if (parseInt == 270) {
i10 = 8;
}
this.f41f[0].put("Orientation", c.f(i10, this.f43h));
}
if (extractMetadata != null && extractMetadata2 != null) {
int parseInt2 = Integer.parseInt(extractMetadata);
int parseInt3 = Integer.parseInt(extractMetadata2);
if (parseInt3 > 6) {
bVar.i(parseInt2);
byte[] bArr = new byte[6];
if (bVar.read(bArr) == 6) {
int i11 = parseInt2 + 6;
int i12 = parseInt3 - 6;
if (Arrays.equals(bArr, f24r0)) {
byte[] bArr2 = new byte[i12];
if (bVar.read(bArr2) == i12) {
this.f51p = i11;
L(bArr2, 0);
} else {
throw new IOException("Can't read exif");
}
} else {
throw new IOException("Invalid identifier");
}
} else {
throw new IOException("Can't read identifier");
}
} else {
throw new IOException("Invalid exif length");
}
}
if (f27u) {
Log.d("ExifInterface", "Heif meta: " + str4 + "x" + str + ", rotation " + str2);
}
} finally {
mediaMetadataRetriever.release();
}
}
private void k(b bVar, int i10, int i11) throws IOException {
byte readByte;
byte readByte2;
String str;
String str2 = "ExifInterface";
if (f27u) {
Log.d("ExifInterface", "getJpegAttributes starting with: " + bVar);
}
char c10 = 0;
bVar.mark(0);
bVar.l(ByteOrder.BIG_ENDIAN);
if (bVar.readByte() == -1) {
if (bVar.readByte() != -40) {
throw new IOException("Invalid marker: " + Integer.toHexString(readByte & 255));
}
int i12 = 2;
int i13 = 2;
while (true) {
if (bVar.readByte() == -1) {
int i14 = i13 + 1;
byte readByte3 = bVar.readByte();
boolean z10 = f27u;
if (z10) {
Log.d(str2, "Found JPEG segment indicator: " + Integer.toHexString(readByte3 & 255));
}
int i15 = i14 + 1;
if (readByte3 != -39 && readByte3 != -38) {
int readUnsignedShort = bVar.readUnsignedShort() - i12;
int i16 = i15 + i12;
if (z10) {
Log.d(str2, "JPEG segment: " + Integer.toHexString(readByte3 & 255) + " (length: " + (readUnsignedShort + 2) + ")");
}
if (readUnsignedShort < 0) {
throw new IOException("Invalid length");
}
if (readByte3 == -31) {
byte[] bArr = new byte[readUnsignedShort];
bVar.readFully(bArr);
int i17 = i16 + readUnsignedShort;
byte[] bArr2 = f24r0;
if (P(bArr, bArr2)) {
byte[] copyOfRange = Arrays.copyOfRange(bArr, bArr2.length, readUnsignedShort);
this.f51p = i10 + i16 + bArr2.length;
L(copyOfRange, i11);
O(new b(copyOfRange));
} else {
byte[] bArr3 = f25s0;
if (P(bArr, bArr3)) {
int length = i16 + bArr3.length;
byte[] copyOfRange2 = Arrays.copyOfRange(bArr, bArr3.length, readUnsignedShort);
if (f("Xmp") == null) {
str = str2;
this.f41f[c10].put("Xmp", new c(1, copyOfRange2.length, length, copyOfRange2));
this.f55t = true;
i16 = i17;
}
}
}
str = str2;
i16 = i17;
} else if (readByte3 != -2) {
switch (readByte3) {
default:
switch (readByte3) {
default:
switch (readByte3) {
default:
switch (readByte3) {
}
case -55:
case -54:
case -53:
if (bVar.skipBytes(1) == 1) {
this.f41f[i11].put("ImageLength", c.b(bVar.readUnsignedShort(), this.f43h));
this.f41f[i11].put("ImageWidth", c.b(bVar.readUnsignedShort(), this.f43h));
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;
}
str = str2;
if (readUnsignedShort < 0) {
if (bVar.skipBytes(readUnsignedShort) != readUnsignedShort) {
throw new IOException("Invalid JPEG segment");
}
i13 = i16 + readUnsignedShort;
str2 = str;
c10 = 0;
i12 = 2;
} else {
throw new IOException("Invalid length");
}
} else {
byte[] bArr4 = new byte[readUnsignedShort];
if (bVar.read(bArr4) == readUnsignedShort) {
if (f("UserComment") == null) {
this.f41f[1].put("UserComment", c.a(new String(bArr4, f23q0)));
}
str = str2;
} else {
throw new IOException("Invalid exif");
}
}
readUnsignedShort = 0;
if (readUnsignedShort < 0) {
}
}
} else {
throw new IOException("Invalid marker:" + Integer.toHexString(readByte2 & 255));
}
}
} else {
throw new IOException("Invalid marker: " + Integer.toHexString(readByte & 255));
}
}
private int m(BufferedInputStream bufferedInputStream) throws IOException {
bufferedInputStream.mark(5000);
byte[] bArr = new byte[5000];
bufferedInputStream.read(bArr);
bufferedInputStream.reset();
if (y(bArr)) {
return 4;
}
if (B(bArr)) {
return 9;
}
if (x(bArr)) {
return 12;
}
if (z(bArr)) {
return 7;
}
if (C(bArr)) {
return 10;
}
if (A(bArr)) {
return 13;
}
return G(bArr) ? 14 : 0;
}
private void n(b bVar) throws IOException {
q(bVar);
c cVar = this.f41f[1].get("MakerNote");
if (cVar != null) {
b bVar2 = new b(cVar.f68d);
bVar2.l(this.f43h);
byte[] bArr = E;
byte[] bArr2 = new byte[bArr.length];
bVar2.readFully(bArr2);
bVar2.i(0L);
byte[] bArr3 = F;
byte[] bArr4 = new byte[bArr3.length];
bVar2.readFully(bArr4);
if (Arrays.equals(bArr2, bArr)) {
bVar2.i(8L);
} else if (Arrays.equals(bArr4, bArr3)) {
bVar2.i(12L);
}
M(bVar2, 6);
c cVar2 = this.f41f[7].get("PreviewImageStart");
c cVar3 = this.f41f[7].get("PreviewImageLength");
if (cVar2 != null && cVar3 != null) {
this.f41f[5].put("JPEGInterchangeFormat", cVar2);
this.f41f[5].put("JPEGInterchangeFormatLength", cVar3);
}
c cVar4 = this.f41f[8].get("AspectFrame");
if (cVar4 != null) {
int[] iArr = (int[]) cVar4.k(this.f43h);
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;
}
c f10 = c.f(i10, this.f43h);
c f11 = c.f(i11, this.f43h);
this.f41f[0].put("ImageWidth", f10);
this.f41f[0].put("ImageLength", f11);
return;
}
Log.w("ExifInterface", "Invalid aspect frame values. frame=" + Arrays.toString(iArr));
}
}
}
private void o(b bVar) throws IOException {
if (f27u) {
Log.d("ExifInterface", "getPngAttributes starting with: " + bVar);
}
bVar.mark(0);
bVar.l(ByteOrder.BIG_ENDIAN);
byte[] bArr = G;
bVar.skipBytes(bArr.length);
int length = bArr.length + 0;
while (true) {
try {
int readInt = bVar.readInt();
int i10 = length + 4;
byte[] bArr2 = new byte[4];
if (bVar.read(bArr2) == 4) {
int i11 = i10 + 4;
if (i11 == 16 && !Arrays.equals(bArr2, I)) {
throw new IOException("Encountered invalid PNG file--IHDR chunk should appearas the first chunk");
}
if (Arrays.equals(bArr2, J)) {
return;
}
if (Arrays.equals(bArr2, H)) {
byte[] bArr3 = new byte[readInt];
if (bVar.read(bArr3) == readInt) {
int readInt2 = bVar.readInt();
CRC32 crc32 = new CRC32();
crc32.update(bArr2);
crc32.update(bArr3);
if (((int) crc32.getValue()) == readInt2) {
this.f51p = i11;
L(bArr3, 0);
S();
O(new b(bArr3));
return;
}
throw new IOException("Encountered invalid CRC value for PNG-EXIF chunk.\n recorded CRC value: " + readInt2 + ", calculated CRC value: " + crc32.getValue());
}
throw new IOException("Failed to read given length for given PNG chunk type: " + b(bArr2));
}
int i12 = readInt + 4;
bVar.skipBytes(i12);
length = i11 + i12;
} else {
throw new IOException("Encountered invalid length while parsing PNG chunktype");
}
} catch (EOFException unused) {
throw new IOException("Encountered corrupt PNG file.");
}
}
}
private void p(b bVar) throws IOException {
boolean z10 = f27u;
if (z10) {
Log.d("ExifInterface", "getRafAttributes starting with: " + bVar);
}
bVar.mark(0);
bVar.skipBytes(84);
byte[] bArr = new byte[4];
byte[] bArr2 = new byte[4];
byte[] bArr3 = new byte[4];
bVar.read(bArr);
bVar.read(bArr2);
bVar.read(bArr3);
int i10 = ByteBuffer.wrap(bArr).getInt();
int i11 = ByteBuffer.wrap(bArr2).getInt();
int i12 = ByteBuffer.wrap(bArr3).getInt();
byte[] bArr4 = new byte[i11];
bVar.i(i10);
bVar.read(bArr4);
k(new b(bArr4), i10, 5);
bVar.i(i12);
bVar.l(ByteOrder.BIG_ENDIAN);
int readInt = bVar.readInt();
if (z10) {
Log.d("ExifInterface", "numberOfDirectoryEntry: " + readInt);
}
for (int i13 = 0; i13 < readInt; i13++) {
int readUnsignedShort = bVar.readUnsignedShort();
int readUnsignedShort2 = bVar.readUnsignedShort();
if (readUnsignedShort == f10d0.f69a) {
short readShort = bVar.readShort();
short readShort2 = bVar.readShort();
c f10 = c.f(readShort, this.f43h);
c f11 = c.f(readShort2, this.f43h);
this.f41f[0].put("ImageLength", f10);
this.f41f[0].put("ImageWidth", f11);
if (f27u) {
Log.d("ExifInterface", "Updated to length: " + ((int) readShort) + ", width: " + ((int) readShort2));
return;
}
return;
}
bVar.skipBytes(readUnsignedShort2);
}
}
private void q(b bVar) throws IOException {
c cVar;
I(bVar, bVar.available());
M(bVar, 0);
R(bVar, 0);
R(bVar, 5);
R(bVar, 4);
S();
if (this.f39d != 8 || (cVar = this.f41f[1].get("MakerNote")) == null) {
return;
}
b bVar2 = new b(cVar.f68d);
bVar2.l(this.f43h);
bVar2.i(6L);
M(bVar2, 9);
c cVar2 = this.f41f[9].get("ColorSpace");
if (cVar2 != null) {
this.f41f[1].put("ColorSpace", cVar2);
}
}
private void r(b bVar) throws IOException {
if (f27u) {
Log.d("ExifInterface", "getRw2Attributes starting with: " + bVar);
}
q(bVar);
c cVar = this.f41f[0].get("JpgFromRaw");
if (cVar != null) {
k(new b(cVar.f68d), (int) cVar.f67c, 5);
}
c cVar2 = this.f41f[0].get("ISO");
c cVar3 = this.f41f[1].get("PhotographicSensitivity");
if (cVar2 == null || cVar3 != null) {
return;
}
this.f41f[1].put("PhotographicSensitivity", cVar2);
}
private void s(b bVar) throws IOException {
byte[] bArr = f24r0;
bVar.skipBytes(bArr.length);
byte[] bArr2 = new byte[bVar.available()];
bVar.readFully(bArr2);
this.f51p = bArr.length;
L(bArr2, 0);
}
private void t(b bVar) throws IOException {
if (f27u) {
Log.d("ExifInterface", "getWebpAttributes starting with: " + bVar);
}
bVar.mark(0);
bVar.l(ByteOrder.LITTLE_ENDIAN);
bVar.skipBytes(K.length);
int readInt = bVar.readInt() + 8;
int skipBytes = bVar.skipBytes(L.length) + 8;
while (true) {
try {
byte[] bArr = new byte[4];
if (bVar.read(bArr) == 4) {
int readInt2 = bVar.readInt();
int i10 = skipBytes + 4 + 4;
if (Arrays.equals(M, bArr)) {
byte[] bArr2 = new byte[readInt2];
if (bVar.read(bArr2) == readInt2) {
this.f51p = i10;
L(bArr2, 0);
O(new b(bArr2));
return;
}
throw new IOException("Failed to read given length for given PNG chunk type: " + b(bArr));
}
if (readInt2 % 2 == 1) {
readInt2++;
}
int i11 = i10 + readInt2;
if (i11 == readInt) {
return;
}
if (i11 <= readInt) {
int skipBytes2 = bVar.skipBytes(readInt2);
if (skipBytes2 != readInt2) {
throw new IOException("Encountered WebP file with invalid chunk size");
}
skipBytes = i10 + skipBytes2;
} else {
throw new IOException("Encountered WebP file with invalid chunk size");
}
} else {
throw new IOException("Encountered invalid length while parsing WebP chunktype");
}
} catch (EOFException unused) {
throw new IOException("Encountered corrupt WebP file.");
}
}
}
private void u(b bVar, HashMap hashMap) throws IOException {
c cVar = (c) hashMap.get("JPEGInterchangeFormat");
c cVar2 = (c) hashMap.get("JPEGInterchangeFormatLength");
if (cVar == null || cVar2 == null) {
return;
}
int i10 = cVar.i(this.f43h);
int i11 = cVar2.i(this.f43h);
if (this.f39d == 7) {
i10 += this.f52q;
}
int min = Math.min(i11, bVar.b() - i10);
if (i10 > 0 && min > 0) {
this.f44i = true;
if (this.f36a == null && this.f38c == null && this.f37b == null) {
byte[] bArr = new byte[min];
bVar.skip(i10);
bVar.read(bArr);
this.f49n = bArr;
}
this.f47l = i10;
this.f48m = min;
}
if (f27u) {
Log.d("ExifInterface", "Setting thumbnail attributes with offset: " + i10 + ", length: " + min);
}
}
private void v(b bVar, HashMap hashMap) throws IOException {
c cVar = (c) hashMap.get("StripOffsets");
c cVar2 = (c) hashMap.get("StripByteCounts");
if (cVar == null || cVar2 == null) {
return;
}
long[] d10 = d(cVar.k(this.f43h));
long[] d11 = d(cVar2.k(this.f43h));
if (d10 != null && d10.length != 0) {
if (d11 != null && d11.length != 0) {
if (d10.length != d11.length) {
Log.w("ExifInterface", "stripOffsets and stripByteCounts should have same length.");
return;
}
long j10 = 0;
for (long j11 : d11) {
j10 += j11;
}
int i10 = (int) j10;
byte[] bArr = new byte[i10];
int i11 = 1;
this.f46k = true;
this.f45j = true;
this.f44i = true;
int i12 = 0;
int i13 = 0;
int i14 = 0;
while (i12 < d10.length) {
int i15 = (int) d10[i12];
int i16 = (int) d11[i12];
if (i12 < d10.length - i11 && i15 + i16 != d10[i12 + 1]) {
this.f46k = false;
}
int i17 = i15 - i13;
if (i17 < 0) {
Log.d("ExifInterface", "Invalid strip offset value");
return;
}
long j12 = i17;
if (bVar.skip(j12) != j12) {
Log.d("ExifInterface", "Failed to skip " + i17 + " bytes.");
return;
}
int i18 = i13 + i17;
byte[] bArr2 = new byte[i16];
if (bVar.read(bArr2) != i16) {
Log.d("ExifInterface", "Failed to read " + i16 + " bytes.");
return;
}
i13 = i18 + i16;
System.arraycopy(bArr2, 0, bArr, i14, i16);
i14 += i16;
i12++;
i11 = 1;
}
this.f49n = bArr;
if (this.f46k) {
this.f47l = (int) d10[0];
this.f48m = i10;
return;
}
return;
}
Log.w("ExifInterface", "stripByteCounts should not be null or have zero length.");
return;
}
Log.w("ExifInterface", "stripOffsets should not be null or have zero length.");
}
private static boolean w(BufferedInputStream bufferedInputStream) throws IOException {
byte[] bArr = f24r0;
bufferedInputStream.mark(bArr.length);
byte[] bArr2 = new byte[bArr.length];
bufferedInputStream.read(bArr2);
bufferedInputStream.reset();
int i10 = 0;
while (true) {
byte[] bArr3 = f24r0;
if (i10 >= bArr3.length) {
return true;
}
if (bArr2[i10] != bArr3[i10]) {
return false;
}
i10++;
}
}
private boolean x(byte[] bArr) throws IOException {
b bVar;
long readInt;
byte[] bArr2;
b bVar2 = null;
try {
try {
bVar = new b(bArr);
} catch (Exception e10) {
e = e10;
}
} catch (Throwable th) {
th = th;
}
try {
readInt = bVar.readInt();
bArr2 = new byte[4];
bVar.read(bArr2);
} catch (Exception e11) {
e = e11;
bVar2 = bVar;
if (f27u) {
Log.d("ExifInterface", "Exception parsing HEIF file type box.", e);
}
if (bVar2 != null) {
bVar2.close();
}
return false;
} catch (Throwable th2) {
th = th2;
bVar2 = bVar;
if (bVar2 != null) {
bVar2.close();
}
throw th;
}
if (!Arrays.equals(bArr2, B)) {
bVar.close();
return false;
}
long j10 = 16;
if (readInt == 1) {
readInt = bVar.readLong();
if (readInt < 16) {
bVar.close();
return false;
}
} else {
j10 = 8;
}
if (readInt > bArr.length) {
readInt = bArr.length;
}
long j11 = readInt - j10;
if (j11 < 8) {
bVar.close();
return false;
}
byte[] bArr3 = new byte[4];
boolean z10 = false;
boolean z11 = false;
for (long j12 = 0; j12 < j11 / 4; j12++) {
if (bVar.read(bArr3) != 4) {
bVar.close();
return false;
}
if (j12 != 1) {
if (Arrays.equals(bArr3, C)) {
z10 = true;
} else if (Arrays.equals(bArr3, D)) {
z11 = true;
}
if (z10 && z11) {
bVar.close();
return true;
}
}
}
bVar.close();
return false;
}
private static boolean y(byte[] bArr) throws IOException {
int i10 = 0;
while (true) {
byte[] bArr2 = A;
if (i10 >= bArr2.length) {
return true;
}
if (bArr[i10] != bArr2[i10]) {
return false;
}
i10++;
}
}
private boolean z(byte[] bArr) throws IOException {
boolean z10 = false;
b bVar = null;
try {
b bVar2 = new b(bArr);
try {
ByteOrder K2 = K(bVar2);
this.f43h = K2;
bVar2.l(K2);
short readShort = bVar2.readShort();
z10 = (readShort == 20306 || readShort == 21330) ? true : true;
bVar2.close();
return z10;
} catch (Exception unused) {
bVar = bVar2;
if (bVar != null) {
bVar.close();
}
return false;
} catch (Throwable th) {
th = th;
bVar = bVar2;
if (bVar != null) {
bVar.close();
}
throw th;
}
} catch (Exception unused2) {
} catch (Throwable th2) {
th = th2;
}
}
public double e(double d10) {
double g10 = g("GPSAltitude", -1.0d);
int h10 = h("GPSAltitudeRef", -1);
if (g10 < 0.0d || h10 < 0) {
return d10;
}
return g10 * (h10 != 1 ? 1 : -1);
}
public String f(String str) {
Objects.requireNonNull(str, "tag shouldn't be null");
c i10 = i(str);
if (i10 != null) {
if (!f21o0.contains(str)) {
return i10.j(this.f43h);
}
if (str.equals("GPSTimeStamp")) {
int i11 = i10.f65a;
if (i11 != 5 && i11 != 10) {
Log.w("ExifInterface", "GPS Timestamp format is not rational. format=" + i10.f65a);
return null;
}
e[] eVarArr = (e[]) i10.k(this.f43h);
if (eVarArr != null && eVarArr.length == 3) {
return String.format("%02d:%02d:%02d", Integer.valueOf((int) (((float) eVarArr[0].f73a) / ((float) eVarArr[0].f74b))), Integer.valueOf((int) (((float) eVarArr[1].f73a) / ((float) eVarArr[1].f74b))), Integer.valueOf((int) (((float) eVarArr[2].f73a) / ((float) eVarArr[2].f74b))));
}
Log.w("ExifInterface", "Invalid GPS Timestamp array. array=" + Arrays.toString(eVarArr));
return null;
}
try {
return Double.toString(i10.h(this.f43h));
} catch (NumberFormatException unused) {
}
}
return null;
}
public double g(String str, double d10) {
Objects.requireNonNull(str, "tag shouldn't be null");
c i10 = i(str);
if (i10 == null) {
return d10;
}
try {
return i10.h(this.f43h);
} catch (NumberFormatException unused) {
return d10;
}
}
public int h(String str, int i10) {
Objects.requireNonNull(str, "tag shouldn't be null");
c i11 = i(str);
if (i11 == null) {
return i10;
}
try {
return i11.i(this.f43h);
} catch (NumberFormatException unused) {
return i10;
}
}
public double[] l() {
String f10 = f("GPSLatitude");
String f11 = f("GPSLatitudeRef");
String f12 = f("GPSLongitude");
String f13 = f("GPSLongitudeRef");
if (f10 == null || f11 == null || f12 == null || f13 == null) {
return null;
}
try {
return new double[]{c(f10, f11), c(f12, f13)};
} catch (IllegalArgumentException unused) {
Log.w("ExifInterface", "Latitude/longitude values are not parsable. " + String.format("latValue=%s, latRef=%s, lngValue=%s, lngRef=%s", f10, f11, f12, f13));
return null;
}
}
public a(InputStream inputStream, int i10) throws IOException {
d[][] dVarArr = f15i0;
this.f41f = new HashMap[dVarArr.length];
this.f42g = new HashSet(dVarArr.length);
this.f43h = ByteOrder.BIG_ENDIAN;
Objects.requireNonNull(inputStream, "inputStream cannot be null");
this.f36a = null;
if (i10 == 1) {
BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream, 5000);
if (!w(bufferedInputStream)) {
Log.w("ExifInterface", "Given data does not follow the structure of an Exif-only data.");
return;
}
this.f40e = true;
this.f38c = null;
this.f37b = null;
inputStream = bufferedInputStream;
} else if (inputStream instanceof AssetManager.AssetInputStream) {
this.f38c = (AssetManager.AssetInputStream) inputStream;
this.f37b = null;
} else {
if (inputStream instanceof FileInputStream) {
FileInputStream fileInputStream = (FileInputStream) inputStream;
if (D(fileInputStream.getFD())) {
this.f38c = null;
this.f37b = fileInputStream.getFD();
}
}
this.f38c = null;
this.f37b = null;
}
H(inputStream);
}
public static class d {
public final int f69a;
public final String f70b;
public final int f71c;
public final int f72d;
d(String str, int i10, int i11) {
this.f70b = str;
this.f69a = i10;
this.f71c = i11;
this.f72d = -1;
}
boolean a(int i10) {
int i11;
int i12 = this.f71c;
if (i12 == 7 || i10 == 7 || i12 == i10 || (i11 = this.f72d) == 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;
}
d(String str, int i10, int i11, int i12) {
this.f70b = str;
this.f69a = i10;
this.f71c = i11;
this.f72d = i12;
}
}
}