use of com.android.server.pm.dex.PackageDexUsage.PackageUseInfo in project platform_frameworks_base by android.
the class DexManagerTests method testNotifySecondaryForeign.
@Test
public void testNotifySecondaryForeign() {
// Foo loads bar secondary files.
List<String> barSecondaries = mBarUser0.getSecondaryDexPaths();
notifyDexLoad(mFooUser0, barSecondaries, mUser0);
PackageUseInfo pui = getPackageUseInfo(mBarUser0);
assertNotNull(pui);
assertFalse(pui.isUsedByOtherApps());
assertEquals(barSecondaries.size(), pui.getDexUseInfoMap().size());
assertSecondaryUse(mFooUser0, pui, barSecondaries, /*isUsedByOtherApps*/
true, mUser0);
}
use of com.android.server.pm.dex.PackageDexUsage.PackageUseInfo in project platform_frameworks_base by android.
the class DexManagerTests method testNotifyPackageInstallUsedByOther.
@Test
public void testNotifyPackageInstallUsedByOther() {
TestData newPackage = new TestData("newPackage", VMRuntime.getInstructionSet(Build.SUPPORTED_ABIS[0]), mUser0);
List<String> newSecondaries = newPackage.getSecondaryDexPaths();
// Before we notify about the installation of the newPackage if mFoo
// is trying to load something from it we should not find it.
notifyDexLoad(mFooUser0, newSecondaries, mUser0);
assertNull(getPackageUseInfo(newPackage));
// Notify about newPackage install and let mFoo load its dexes.
mDexManager.notifyPackageInstalled(newPackage.mPackageInfo, mUser0);
notifyDexLoad(mFooUser0, newSecondaries, mUser0);
// We should get back the right info.
PackageUseInfo pui = getPackageUseInfo(newPackage);
assertNotNull(pui);
assertFalse(pui.isUsedByOtherApps());
assertEquals(newSecondaries.size(), pui.getDexUseInfoMap().size());
assertSecondaryUse(newPackage, pui, newSecondaries, /*isUsedByOtherApps*/
true, mUser0);
}
use of com.android.server.pm.dex.PackageDexUsage.PackageUseInfo in project platform_frameworks_base by android.
the class DexManagerTests method testNotifySequence.
@Test
public void testNotifySequence() {
// Foo loads its own secondary files.
List<String> fooSecondaries = mFooUser0.getSecondaryDexPaths();
notifyDexLoad(mFooUser0, fooSecondaries, mUser0);
// Foo loads Bar own secondary files.
List<String> barSecondaries = mBarUser0.getSecondaryDexPaths();
notifyDexLoad(mFooUser0, barSecondaries, mUser0);
// Foo loads Bar primary files.
notifyDexLoad(mFooUser0, mBarUser0.getBaseAndSplitDexPaths(), mUser0);
// Bar loads its own secondary files.
notifyDexLoad(mBarUser0, barSecondaries, mUser0);
// Bar loads some own secondary files which foo didn't load.
List<String> barSecondariesForOwnUse = mBarUser0.getSecondaryDexPathsForOwnUse();
notifyDexLoad(mBarUser0, barSecondariesForOwnUse, mUser0);
// Check bar usage. Should be used by other app (for primary and barSecondaries).
PackageUseInfo pui = getPackageUseInfo(mBarUser0);
assertNotNull(pui);
assertTrue(pui.isUsedByOtherApps());
assertEquals(barSecondaries.size() + barSecondariesForOwnUse.size(), pui.getDexUseInfoMap().size());
assertSecondaryUse(mFooUser0, pui, barSecondaries, /*isUsedByOtherApps*/
true, mUser0);
assertSecondaryUse(mFooUser0, pui, barSecondariesForOwnUse, /*isUsedByOtherApps*/
false, mUser0);
// Check foo usage. Should not be used by other app.
pui = getPackageUseInfo(mFooUser0);
assertNotNull(pui);
assertFalse(pui.isUsedByOtherApps());
assertEquals(fooSecondaries.size(), pui.getDexUseInfoMap().size());
assertSecondaryUse(mFooUser0, pui, fooSecondaries, /*isUsedByOtherApps*/
false, mUser0);
}
use of com.android.server.pm.dex.PackageDexUsage.PackageUseInfo in project platform_frameworks_base by android.
the class PackageDexUsageTests method assertPackageDexUsage.
private void assertPackageDexUsage(TestData primary, TestData... secondaries) {
String packageName = primary == null ? secondaries[0].mPackageName : primary.mPackageName;
boolean primaryUsedByOtherApps = primary == null ? false : primary.mUsedByOtherApps;
PackageUseInfo pInfo = mPackageDexUsage.getPackageUseInfo(packageName);
// Check package use info
assertNotNull(pInfo);
assertEquals(primaryUsedByOtherApps, pInfo.isUsedByOtherApps());
Map<String, DexUseInfo> dexUseInfoMap = pInfo.getDexUseInfoMap();
assertEquals(secondaries.length, dexUseInfoMap.size());
// Check dex use info
for (TestData testData : secondaries) {
DexUseInfo dInfo = dexUseInfoMap.get(testData.mDexFile);
assertNotNull(dInfo);
assertEquals(testData.mUsedByOtherApps, dInfo.isUsedByOtherApps());
assertEquals(testData.mOwnerUserId, dInfo.getOwnerUserId());
assertEquals(1, dInfo.getLoaderIsas().size());
assertTrue(dInfo.getLoaderIsas().contains(testData.mLoaderIsa));
}
}
Aggregations