Load in-memory dex into a single DexFile/Element object
InMemoryDexClassLoader only accepts ByteBuffers containing dex files,
not apks. Loading dex files in a multidex fashion is therefore
impossible as each ByteBuffer is loaded into its own Element/DexFile
object. This has not been an issue so far because dex files loaded with
InMemoryDexClassLoader are never optimized or backed by an oat file,
and the first time a class can be resolved is after the whole class
loader class path has been initialized.
Refactor this now because introduction of a vdex backing the dex files
changes this. It is also convenient to generate just one vdex per class
loader than one vdex per ByteBuffer.
The original makeInMemoryDexElements() method is left unused after the
refactor but it is known to be in use by 3p apps. Leave it there are add
a test to make sure it continues to work.
4 files changed