Fix missing .fsv_sig after partial split install
Test: adb install-multiple foo.apk foo.apk.fsv_sig
adb install-multiple -p com.foo foo_split.apk foo_split.apk.fsv_sig
# See base.apk.fsv_sig in /data/app/com.foo-*/
Bug: 112037636
Change-Id: I043c7bf545164c58b2cc37507d10188c25033f6b
This commit is contained in:
@@ -1474,12 +1474,12 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
// Inherit base if not overridden
|
||||
if (mResolvedBaseFile == null) {
|
||||
mResolvedBaseFile = new File(appInfo.getBaseCodePath());
|
||||
mResolvedInheritedFiles.add(mResolvedBaseFile);
|
||||
resolveInheritedFile(mResolvedBaseFile);
|
||||
// Inherit the dex metadata if present.
|
||||
final File baseDexMetadataFile =
|
||||
DexMetadataHelper.findDexMetadataForFile(mResolvedBaseFile);
|
||||
if (baseDexMetadataFile != null) {
|
||||
mResolvedInheritedFiles.add(baseDexMetadataFile);
|
||||
resolveInheritedFile(baseDexMetadataFile);
|
||||
}
|
||||
baseApk = existingBase;
|
||||
}
|
||||
@@ -1491,12 +1491,12 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
final File splitFile = new File(existing.splitCodePaths[i]);
|
||||
final boolean splitRemoved = removeSplitList.contains(splitName);
|
||||
if (!stagedSplits.contains(splitName) && !splitRemoved) {
|
||||
mResolvedInheritedFiles.add(splitFile);
|
||||
resolveInheritedFile(splitFile);
|
||||
// Inherit the dex metadata if present.
|
||||
final File splitDexMetadataFile =
|
||||
DexMetadataHelper.findDexMetadataForFile(splitFile);
|
||||
if (splitDexMetadataFile != null) {
|
||||
mResolvedInheritedFiles.add(splitDexMetadataFile);
|
||||
resolveInheritedFile(splitDexMetadataFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1610,6 +1610,17 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
mResolvedStagedFiles.add(stagedSignature);
|
||||
}
|
||||
|
||||
private void resolveInheritedFile(File origFile) {
|
||||
mResolvedInheritedFiles.add(origFile);
|
||||
|
||||
// Inherit the fsverity signature file if present.
|
||||
final File fsveritySignatureFile = new File(
|
||||
VerityUtils.getFsveritySignatureFilePath(origFile.getPath()));
|
||||
if (fsveritySignatureFile.exists()) {
|
||||
mResolvedInheritedFiles.add(fsveritySignatureFile);
|
||||
}
|
||||
}
|
||||
|
||||
@GuardedBy("mLock")
|
||||
private void assertApkConsistentLocked(String tag, ApkLite apk)
|
||||
throws PackageManagerException {
|
||||
|
||||
@@ -17041,7 +17041,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
|
||||
if (!legacyMode) {
|
||||
// fs-verity is optional for now. Only set up if signature is provided.
|
||||
if (new File(signaturePath).exists()) {
|
||||
if (new File(signaturePath).exists() && !VerityUtils.hasFsverity(filePath)) {
|
||||
try {
|
||||
VerityUtils.setUpFsverity(filePath, signaturePath);
|
||||
} catch (IOException | DigestException | NoSuchAlgorithmException
|
||||
|
||||
Reference in New Issue
Block a user