Cache package names after reboot

In case of a reboot mApkToPackageMap becomes empty, but packages can still
be installed in user 0. We need to repopulate the cache again.

Bug: 30280710
Change-Id: Ia18e93c351b5af80de434e8c5311b961b314a9fb
This commit is contained in:
Fyodor Kupolov
2016-07-28 19:53:19 -07:00
parent 51ce8ee3b1
commit 773e997432

View File

@@ -130,6 +130,10 @@ class PreloadAppsInstaller {
// Install on user 0 so that the package is cached when demo user is re-created
installExistingPackage(basePackageName, UserHandle.USER_SYSTEM, counter);
} else if (returnCode == PackageManager.INSTALL_FAILED_ALREADY_EXISTS) {
// This can only happen in first session after a reboot
if (!mApkToPackageMap.containsKey(apkName)) {
mApkToPackageMap.put(apkName, basePackageName);
}
installExistingPackage(basePackageName, userId, counter);
}
}