Merge "[DexManager] Fix off-by-N error in DexManager when reporting dex loads"
am: ca98e2866e
Change-Id: Ie0c5b0cb12f59c8bf5f2b9a0647cd6cecaacf352
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
|
||||
// do not record it. This case does not bring any new usable information
|
||||
// and can be safely skipped.
|
||||
dexPathIndex++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -159,6 +159,31 @@ public class DexManagerTests {
|
||||
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
|
||||
public void testNotifySecondaryForeign() {
|
||||
// Foo loads bar secondary files.
|
||||
|
||||
Reference in New Issue
Block a user