207 lines
7.6 KiB
Java
207 lines
7.6 KiB
Java
package c.f.m;
|
|
|
|
import android.content.Context;
|
|
import android.util.Log;
|
|
import c.f.m.a;
|
|
import c.f.m.m;
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.util.Arrays;
|
|
import java.util.Enumeration;
|
|
import java.util.HashMap;
|
|
import java.util.LinkedHashSet;
|
|
import java.util.Objects;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
import java.util.zip.ZipEntry;
|
|
import java.util.zip.ZipFile;
|
|
/* compiled from: ExtractFromZipSoSource */
|
|
public class f extends m {
|
|
public final File f;
|
|
public final String g;
|
|
|
|
/* compiled from: ExtractFromZipSoSource */
|
|
public static final class b extends m.b implements Comparable {
|
|
public final ZipEntry k;
|
|
public final int l;
|
|
|
|
public b(String str, ZipEntry zipEntry, int i) {
|
|
super(str, String.format("pseudo-zip-hash-1-%s-%s-%s-%s", zipEntry.getName(), Long.valueOf(zipEntry.getSize()), Long.valueOf(zipEntry.getCompressedSize()), Long.valueOf(zipEntry.getCrc())));
|
|
this.k = zipEntry;
|
|
this.l = i;
|
|
}
|
|
|
|
@Override // java.lang.Comparable
|
|
public int compareTo(Object obj) {
|
|
return this.i.compareTo(((b) obj).i);
|
|
}
|
|
}
|
|
|
|
/* compiled from: ExtractFromZipSoSource */
|
|
public class c extends m.f {
|
|
public b[] i;
|
|
public final ZipFile j;
|
|
public final m k;
|
|
|
|
/* compiled from: ExtractFromZipSoSource */
|
|
public final class a extends m.e {
|
|
public int i;
|
|
|
|
public a(a aVar) {
|
|
}
|
|
|
|
@Override // c.f.m.m.e
|
|
public boolean a() {
|
|
c.this.c();
|
|
return this.i < c.this.i.length;
|
|
}
|
|
|
|
@Override // c.f.m.m.e
|
|
public m.d b() throws IOException {
|
|
c.this.c();
|
|
c cVar = c.this;
|
|
b[] bVarArr = cVar.i;
|
|
int i = this.i;
|
|
this.i = i + 1;
|
|
b bVar = bVarArr[i];
|
|
InputStream inputStream = cVar.j.getInputStream(bVar.k);
|
|
try {
|
|
return new m.d(bVar, inputStream);
|
|
} catch (Throwable th) {
|
|
if (inputStream != null) {
|
|
inputStream.close();
|
|
}
|
|
throw th;
|
|
}
|
|
}
|
|
}
|
|
|
|
public c(m mVar) throws IOException {
|
|
this.j = new ZipFile(f.this.f);
|
|
this.k = mVar;
|
|
}
|
|
|
|
@Override // c.f.m.m.f
|
|
public final m.c a() throws IOException {
|
|
return new m.c(c());
|
|
}
|
|
|
|
@Override // c.f.m.m.f
|
|
public final m.e b() throws IOException {
|
|
return new a(null);
|
|
}
|
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:41:0x0120 */
|
|
/* JADX WARNING: Removed duplicated region for block: B:42:0x0123 */
|
|
public final b[] c() {
|
|
int i;
|
|
boolean z2;
|
|
String str;
|
|
if (this.i == null) {
|
|
LinkedHashSet linkedHashSet = new LinkedHashSet();
|
|
HashMap hashMap = new HashMap();
|
|
Pattern compile = Pattern.compile(f.this.g);
|
|
String[] M0 = AnimatableValueParser.M0();
|
|
Enumeration<? extends ZipEntry> entries = this.j.entries();
|
|
while (true) {
|
|
i = 0;
|
|
if (!entries.hasMoreElements()) {
|
|
break;
|
|
}
|
|
ZipEntry zipEntry = (ZipEntry) entries.nextElement();
|
|
Matcher matcher = compile.matcher(zipEntry.getName());
|
|
if (matcher.matches()) {
|
|
String group = matcher.group(1);
|
|
String group2 = matcher.group(2);
|
|
while (true) {
|
|
if (i >= M0.length) {
|
|
i = -1;
|
|
break;
|
|
}
|
|
if (M0[i] != null && group.equals(M0[i])) {
|
|
break;
|
|
}
|
|
i++;
|
|
}
|
|
if (i >= 0) {
|
|
linkedHashSet.add(group);
|
|
b bVar = (b) hashMap.get(group2);
|
|
if (bVar == null || i < bVar.l) {
|
|
hashMap.put(group2, new b(group2, zipEntry, i));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
m mVar = this.k;
|
|
String[] strArr = (String[]) linkedHashSet.toArray(new String[linkedHashSet.size()]);
|
|
Objects.requireNonNull(mVar);
|
|
b[] bVarArr = (b[]) hashMap.values().toArray(new b[hashMap.size()]);
|
|
Arrays.sort(bVarArr);
|
|
int i2 = 0;
|
|
for (int i3 = 0; i3 < bVarArr.length; i3++) {
|
|
b bVar2 = bVarArr[i3];
|
|
ZipEntry zipEntry2 = bVar2.k;
|
|
String str2 = bVar2.i;
|
|
a.C0066a aVar = (a.C0066a) this;
|
|
String name = zipEntry2.getName();
|
|
if (str2.equals(a.this.d)) {
|
|
a.this.d = null;
|
|
str = String.format("allowing consideration of corrupted lib %s", str2);
|
|
} else if ((aVar.n & 1) == 0) {
|
|
str = c.d.b.a.a.v("allowing consideration of ", name, ": self-extraction preferred");
|
|
} else {
|
|
File file = new File(aVar.m, str2);
|
|
if (!file.isFile()) {
|
|
str = String.format("allowing considering of %s: %s not in system lib dir", name, str2);
|
|
} else {
|
|
long length = file.length();
|
|
long size = zipEntry2.getSize();
|
|
if (length != size) {
|
|
str = String.format("allowing consideration of %s: sysdir file length is %s, but the file is %s bytes long in the APK", file, Long.valueOf(length), Long.valueOf(size));
|
|
} else {
|
|
str = c.d.b.a.a.v("not allowing consideration of ", name, ": deferring to libdir");
|
|
z2 = false;
|
|
Log.d("ApkSoSource", str);
|
|
if (!z2) {
|
|
i2++;
|
|
} else {
|
|
bVarArr[i3] = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
z2 = true;
|
|
Log.d("ApkSoSource", str);
|
|
if (!z2) {
|
|
}
|
|
}
|
|
b[] bVarArr2 = new b[i2];
|
|
int i4 = 0;
|
|
while (i < bVarArr.length) {
|
|
b bVar3 = bVarArr[i];
|
|
if (bVar3 != null) {
|
|
bVarArr2[i4] = bVar3;
|
|
i4++;
|
|
}
|
|
i++;
|
|
}
|
|
this.i = bVarArr2;
|
|
}
|
|
return this.i;
|
|
}
|
|
|
|
@Override // c.f.m.m.f, java.io.Closeable, java.lang.AutoCloseable
|
|
public void close() throws IOException {
|
|
this.j.close();
|
|
}
|
|
}
|
|
|
|
public f(Context context, String str, File file, String str2) {
|
|
super(context, str);
|
|
this.f = file;
|
|
this.g = str2;
|
|
}
|
|
}
|