mirror of
https://github.com/revanced/smali.git
synced 2025-04-30 14:44:26 +02:00
Change OatFile to return DexBackedDexFiles, instead of OatDexFiles
This commit is contained in:
parent
1a52897373
commit
783943ebff
@ -41,7 +41,6 @@ import org.jf.dexlib2.dexbacked.DexBackedDexFile.NotADexFile;
|
|||||||
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.NotAnOatFileException;
|
import org.jf.dexlib2.dexbacked.OatFile.NotAnOatFileException;
|
||||||
import org.jf.dexlib2.dexbacked.OatFile.OatDexFile;
|
|
||||||
import org.jf.dexlib2.dexbacked.OatFile.VdexProvider;
|
import org.jf.dexlib2.dexbacked.OatFile.VdexProvider;
|
||||||
import org.jf.dexlib2.dexbacked.ZipDexContainer;
|
import org.jf.dexlib2.dexbacked.ZipDexContainer;
|
||||||
import org.jf.dexlib2.dexbacked.ZipDexContainer.NotAZipFileException;
|
import org.jf.dexlib2.dexbacked.ZipDexContainer.NotAZipFileException;
|
||||||
@ -120,7 +119,7 @@ public final class DexFileFactory {
|
|||||||
throw new UnsupportedOatVersionException(oatFile);
|
throw new UnsupportedOatVersionException(oatFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<OatDexFile> oatDexFiles = oatFile.getDexFiles();
|
List<DexBackedDexFile> oatDexFiles = oatFile.getDexFiles();
|
||||||
|
|
||||||
if (oatDexFiles.size() == 0) {
|
if (oatDexFiles.size() == 0) {
|
||||||
throw new DexFileNotFoundException("Oat file %s contains no dex files", file.getName());
|
throw new DexFileNotFoundException("Oat file %s contains no dex files", file.getName());
|
||||||
@ -205,7 +204,7 @@ public final class DexFileFactory {
|
|||||||
throw new UnsupportedOatVersionException(oatFile);
|
throw new UnsupportedOatVersionException(oatFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<OatDexFile> oatDexFiles = oatFile.getDexFiles();
|
List<? extends DexFile> oatDexFiles = oatFile.getDexFiles();
|
||||||
|
|
||||||
if (oatDexFiles.size() == 0) {
|
if (oatDexFiles.size() == 0) {
|
||||||
throw new DexFileNotFoundException("Oat file %s contains no dex files", file.getName());
|
throw new DexFileNotFoundException("Oat file %s contains no dex files", file.getName());
|
||||||
|
@ -36,7 +36,6 @@ import com.google.common.collect.ImmutableList;
|
|||||||
import com.google.common.collect.Iterators;
|
import com.google.common.collect.Iterators;
|
||||||
import com.google.common.io.ByteStreams;
|
import com.google.common.io.ByteStreams;
|
||||||
import org.jf.dexlib2.Opcodes;
|
import org.jf.dexlib2.Opcodes;
|
||||||
import org.jf.dexlib2.dexbacked.OatFile.OatDexFile;
|
|
||||||
import org.jf.dexlib2.dexbacked.OatFile.SymbolTable.Symbol;
|
import org.jf.dexlib2.dexbacked.OatFile.SymbolTable.Symbol;
|
||||||
import org.jf.dexlib2.dexbacked.raw.HeaderItem;
|
import org.jf.dexlib2.dexbacked.raw.HeaderItem;
|
||||||
import org.jf.dexlib2.iface.MultiDexContainer;
|
import org.jf.dexlib2.iface.MultiDexContainer;
|
||||||
@ -53,7 +52,7 @@ import java.util.Arrays;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class OatFile extends DexBuffer implements MultiDexContainer<OatDexFile> {
|
public class OatFile extends DexBuffer implements MultiDexContainer<DexBackedDexFile> {
|
||||||
private static final byte[] ELF_MAGIC = new byte[] { 0x7f, 'E', 'L', 'F' };
|
private static final byte[] ELF_MAGIC = new byte[] { 0x7f, 'E', 'L', 'F' };
|
||||||
private static final byte[] OAT_MAGIC = new byte[] { 'o', 'a', 't', '\n' };
|
private static final byte[] OAT_MAGIC = new byte[] { 'o', 'a', 't', '\n' };
|
||||||
private static final int MIN_ELF_HEADER_SIZE = 52;
|
private static final int MIN_ELF_HEADER_SIZE = 52;
|
||||||
@ -178,15 +177,15 @@ public class OatFile extends DexBuffer implements MultiDexContainer<OatDexFile>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public List<OatDexFile> getDexFiles() {
|
public List<DexBackedDexFile> getDexFiles() {
|
||||||
return new AbstractForwardSequentialList<OatDexFile>() {
|
return new AbstractForwardSequentialList<DexBackedDexFile>() {
|
||||||
@Override public int size() {
|
@Override public int size() {
|
||||||
return oatHeader.getDexFileCount();
|
return oatHeader.getDexFileCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull @Override public Iterator<OatDexFile> iterator() {
|
@Nonnull @Override public Iterator<DexBackedDexFile> iterator() {
|
||||||
return Iterators.transform(new DexEntryIterator(), new Function<OatDexEntry, OatDexFile>() {
|
return Iterators.transform(new DexEntryIterator(), new Function<OatDexEntry, DexBackedDexFile>() {
|
||||||
@Nullable @Override public OatDexFile apply(OatDexEntry dexEntry) {
|
@Nullable @Override public DexBackedDexFile apply(OatDexEntry dexEntry) {
|
||||||
return dexEntry.getDexFile();
|
return dexEntry.getDexFile();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -546,7 +545,7 @@ public class OatFile extends DexBuffer implements MultiDexContainer<OatDexFile>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class OatDexEntry implements MultiDexContainer.DexEntry<OatDexFile> {
|
private class OatDexEntry implements MultiDexContainer.DexEntry<DexBackedDexFile> {
|
||||||
public final String entryName;
|
public final String entryName;
|
||||||
public final byte[] buf;
|
public final byte[] buf;
|
||||||
public final int dexOffset;
|
public final int dexOffset;
|
||||||
@ -557,7 +556,7 @@ public class OatFile extends DexBuffer implements MultiDexContainer<OatDexFile>
|
|||||||
this.dexOffset = dexOffset;
|
this.dexOffset = dexOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OatDexFile getDexFile() {
|
public DexBackedDexFile getDexFile() {
|
||||||
return new OatDexFile(buf, dexOffset);
|
return new OatDexFile(buf, dexOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -569,7 +568,7 @@ public class OatFile extends DexBuffer implements MultiDexContainer<OatDexFile>
|
|||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public MultiDexContainer<? extends OatDexFile> getContainer() {
|
public MultiDexContainer<? extends DexBackedDexFile> getContainer() {
|
||||||
return OatFile.this;
|
return OatFile.this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user