If we ever rescan a stub, make sure to uncompress it

If ever the APK in /data/app is removed, we always rescan the
version on a system partition. In the case of compessed stubs,
we didn't keep track of rescanned stubs; which meant we
would never attempted to uncompress & install the full APK
after a rescan.

Add any rescanned stub to the set of known stubs so they can
correctly be uncompressed.

Bug: 186726837
Fixes: 186726837
Test: MANUAL.
Test: Boot the device
Test: Remove the uncompressed system package from /data/app
Test: Reboot the device
Test: Note that the stub is again uncompressed and replaced
Change-Id: I2b903516e2e70b659aa789120d6dd15986f9c94c
This commit is contained in:
Todd Kennedy
2021-05-21 14:42:29 -07:00
parent 36da5805e5
commit 62f34260dc

View File

@@ -6762,7 +6762,12 @@ public class PackageManagerService extends IPackageManager.Stub
mSettings.enableSystemPackageLPw(packageName);
try {
scanPackageTracedLI(scanFile, reparseFlags, rescanFlags, 0, null);
final AndroidPackage newPkg = scanPackageTracedLI(
scanFile, reparseFlags, rescanFlags, 0, null);
// We rescanned a stub, add it to the list of stubbed system packages
if (newPkg.isStub()) {
stubSystemApps.add(packageName);
}
} catch (PackageManagerException e) {
Slog.e(TAG, "Failed to parse original system package: "
+ e.getMessage());