Merge "[DexManager] Fix off-by-N error in DexManager when reporting dex loads"
This commit is contained in:
@@ -229,6 +229,7 @@ public class DexManager {
|
|||||||
// If the dex file is the primary apk (or a split) and not isUsedByOtherApps
|
// If the dex file is the primary apk (or a split) and not isUsedByOtherApps
|
||||||
// do not record it. This case does not bring any new usable information
|
// do not record it. This case does not bring any new usable information
|
||||||
// and can be safely skipped.
|
// and can be safely skipped.
|
||||||
|
dexPathIndex++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -159,6 +159,31 @@ public class DexManagerTests {
|
|||||||
assertHasDclInfo(mFooUser0, mFooUser0, fooSecondaries);
|
assertHasDclInfo(mFooUser0, mFooUser0, fooSecondaries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNotifyPrimaryAndSecondary() {
|
||||||
|
List<String> dexFiles = mFooUser0.getBaseAndSplitDexPaths();
|
||||||
|
List<String> secondaries = mFooUser0.getSecondaryDexPaths();
|
||||||
|
int baseAndSplitCount = dexFiles.size();
|
||||||
|
dexFiles.addAll(secondaries);
|
||||||
|
|
||||||
|
notifyDexLoad(mFooUser0, dexFiles, mUser0);
|
||||||
|
|
||||||
|
PackageUseInfo pui = getPackageUseInfo(mFooUser0);
|
||||||
|
assertIsUsedByOtherApps(mFooUser0, pui, false);
|
||||||
|
assertEquals(secondaries.size(), pui.getDexUseInfoMap().size());
|
||||||
|
|
||||||
|
String[] allExpectedContexts = DexoptUtils.processContextForDexLoad(
|
||||||
|
Arrays.asList(mFooUser0.mClassLoader),
|
||||||
|
Arrays.asList(String.join(File.pathSeparator, dexFiles)));
|
||||||
|
String[] secondaryExpectedContexts = Arrays.copyOfRange(allExpectedContexts,
|
||||||
|
baseAndSplitCount, dexFiles.size());
|
||||||
|
|
||||||
|
assertSecondaryUse(mFooUser0, pui, secondaries, /*isUsedByOtherApps*/false, mUser0,
|
||||||
|
secondaryExpectedContexts);
|
||||||
|
|
||||||
|
assertHasDclInfo(mFooUser0, mFooUser0, secondaries);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNotifySecondaryForeign() {
|
public void testNotifySecondaryForeign() {
|
||||||
// Foo loads bar secondary files.
|
// Foo loads bar secondary files.
|
||||||
|
|||||||
Reference in New Issue
Block a user