mirror of
https://github.com/revanced/smali.git
synced 2025-05-10 03:14:31 +02:00
Load oat dependencies by default, if present
This commit is contained in:
parent
c3270cf991
commit
17054d5c3d
@ -41,6 +41,7 @@ import org.jf.dexlib2.Opcodes;
|
|||||||
import org.jf.dexlib2.dexbacked.DexBackedDexFile;
|
import org.jf.dexlib2.dexbacked.DexBackedDexFile;
|
||||||
import org.jf.dexlib2.dexbacked.DexBackedOdexFile;
|
import org.jf.dexlib2.dexbacked.DexBackedOdexFile;
|
||||||
import org.jf.dexlib2.dexbacked.OatFile;
|
import org.jf.dexlib2.dexbacked.OatFile;
|
||||||
|
import org.jf.dexlib2.dexbacked.OatFile.OatDexFile;
|
||||||
import org.jf.dexlib2.iface.DexFile;
|
import org.jf.dexlib2.iface.DexFile;
|
||||||
import org.jf.dexlib2.iface.MultiDexContainer;
|
import org.jf.dexlib2.iface.MultiDexContainer;
|
||||||
import org.jf.dexlib2.iface.MultiDexContainer.MultiDexFile;
|
import org.jf.dexlib2.iface.MultiDexContainer.MultiDexFile;
|
||||||
@ -106,8 +107,7 @@ public class ClassPathResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ClassPathResolver(@Nonnull List<String> bootClassPathDirs, @Nullable List<String> bootClassPathEntries,
|
private ClassPathResolver(@Nonnull List<String> bootClassPathDirs, @Nullable List<String> bootClassPathEntries,
|
||||||
@Nonnull List<String> extraClassPathEntries,
|
@Nonnull List<String> extraClassPathEntries, @Nonnull DexFile dexFile, int apiLevel)
|
||||||
@Nonnull DexFile dexFile, int apiLevel)
|
|
||||||
throws IOException {
|
throws IOException {
|
||||||
this.classPathDirs = bootClassPathDirs;
|
this.classPathDirs = bootClassPathDirs;
|
||||||
opcodes = dexFile.getOpcodes();
|
opcodes = dexFile.getOpcodes();
|
||||||
@ -116,7 +116,7 @@ public class ClassPathResolver {
|
|||||||
bootClassPathEntries = getDefaultBootClassPath(dexFile, apiLevel);
|
bootClassPathEntries = getDefaultBootClassPath(dexFile, apiLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String entry: bootClassPathEntries) {
|
for (String entry : bootClassPathEntries) {
|
||||||
try {
|
try {
|
||||||
loadLocalOrDeviceBootClassPathEntry(entry);
|
loadLocalOrDeviceBootClassPathEntry(entry);
|
||||||
} catch (NoDexException ex) {
|
} catch (NoDexException ex) {
|
||||||
@ -311,6 +311,16 @@ public class ClassPathResolver {
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
private static List<String> getDefaultBootClassPath(@Nonnull DexFile dexFile, int apiLevel) {
|
private static List<String> getDefaultBootClassPath(@Nonnull DexFile dexFile, int apiLevel) {
|
||||||
if (dexFile instanceof OatFile.OatDexFile) {
|
if (dexFile instanceof OatFile.OatDexFile) {
|
||||||
|
List<String> bcp = ((OatDexFile)dexFile).getContainer().getBootClassPath();
|
||||||
|
if (!bcp.isEmpty()) {
|
||||||
|
for (int i=0; i<bcp.size(); i++) {
|
||||||
|
String entry = bcp.get(i);
|
||||||
|
if (entry.endsWith(".art")) {
|
||||||
|
bcp.set(i, entry.substring(0, entry.length() - 4) + ".oat");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bcp;
|
||||||
|
}
|
||||||
return Lists.newArrayList("boot.oat");
|
return Lists.newArrayList("boot.oat");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user