* commit '7b73a788f0c18a31de729daa51e7e06286cf7609': When scanning unbundled apps, only install the expected APK tree
This commit is contained in:
@@ -271,6 +271,7 @@ public class PackageManagerService extends IPackageManager.Stub {
|
|||||||
static final int SCAN_TRUSTED_OVERLAY = 1<<9;
|
static final int SCAN_TRUSTED_OVERLAY = 1<<9;
|
||||||
static final int SCAN_DELETE_DATA_ON_FAILURES = 1<<10;
|
static final int SCAN_DELETE_DATA_ON_FAILURES = 1<<10;
|
||||||
static final int SCAN_REPLACING = 1<<11;
|
static final int SCAN_REPLACING = 1<<11;
|
||||||
|
static final int SCAN_REQUIRE_KNOWN = 1<<12;
|
||||||
|
|
||||||
static final int REMOVE_CHATTY = 1<<16;
|
static final int REMOVE_CHATTY = 1<<16;
|
||||||
|
|
||||||
@@ -1646,10 +1647,10 @@ public class PackageManagerService extends IPackageManager.Stub {
|
|||||||
if (!mOnlyCore) {
|
if (!mOnlyCore) {
|
||||||
EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_DATA_SCAN_START,
|
EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_DATA_SCAN_START,
|
||||||
SystemClock.uptimeMillis());
|
SystemClock.uptimeMillis());
|
||||||
scanDirLI(mAppInstallDir, 0, scanFlags, 0);
|
scanDirLI(mAppInstallDir, 0, scanFlags | SCAN_REQUIRE_KNOWN, 0);
|
||||||
|
|
||||||
scanDirLI(mDrmAppPrivateInstallDir, PackageParser.PARSE_FORWARD_LOCK,
|
scanDirLI(mDrmAppPrivateInstallDir, PackageParser.PARSE_FORWARD_LOCK,
|
||||||
scanFlags, 0);
|
scanFlags | SCAN_REQUIRE_KNOWN, 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove disable package settings for any updated system
|
* Remove disable package settings for any updated system
|
||||||
@@ -5349,6 +5350,28 @@ public class PackageManagerService extends IPackageManager.Stub {
|
|||||||
+ " already installed. Skipping duplicate.");
|
+ " already installed. Skipping duplicate.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we're only installing presumed-existing packages, require that the
|
||||||
|
// scanned APK is both already known and at the path previously established
|
||||||
|
// for it. Previously unknown packages we pick up normally, but if we have an
|
||||||
|
// a priori expectation about this package's install presence, enforce it.
|
||||||
|
if ((scanFlags & SCAN_REQUIRE_KNOWN) != 0) {
|
||||||
|
PackageSetting known = mSettings.peekPackageLPr(pkg.packageName);
|
||||||
|
if (known != null) {
|
||||||
|
if (DEBUG_PACKAGE_SCANNING) {
|
||||||
|
Log.d(TAG, "Examining " + pkg.codePath
|
||||||
|
+ " and requiring known paths " + known.codePathString
|
||||||
|
+ " & " + known.resourcePathString);
|
||||||
|
}
|
||||||
|
if (!pkg.applicationInfo.getCodePath().equals(known.codePathString)
|
||||||
|
|| !pkg.applicationInfo.getResourcePath().equals(known.resourcePathString)) {
|
||||||
|
throw new PackageManagerException(INSTALL_FAILED_PACKAGE_CHANGED,
|
||||||
|
"Application package " + pkg.packageName
|
||||||
|
+ " found at " + pkg.applicationInfo.getCodePath()
|
||||||
|
+ " but expected at " + known.codePathString + "; ignoring.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize package source and resource directories
|
// Initialize package source and resource directories
|
||||||
File destCodeFile = new File(pkg.applicationInfo.getCodePath());
|
File destCodeFile = new File(pkg.applicationInfo.getCodePath());
|
||||||
File destResourceFile = new File(pkg.applicationInfo.getResourcePath());
|
File destResourceFile = new File(pkg.applicationInfo.getResourcePath());
|
||||||
|
|||||||
Reference in New Issue
Block a user