Lines Matching defs:apex_file
75 #include "apex_file.h"
366 Result<ApexFile> apex_file = ApexFile::Open(path);
367 if (!apex_file.ok()) {
368 return apex_file.error();
371 const std::string& package_name = apex_file->GetManifest().name();
378 if (files_to_keep.find(apex_file->GetPath()) != files_to_keep.end()) {
383 LOG(DEBUG) << "Deleting previously active apex " << apex_file->GetPath();
384 if (unlink(apex_file->GetPath().c_str()) != 0) {
385 return ErrnoError() << "Failed to unlink " << apex_file->GetPath();
834 Result<ApexFile> apex_file = ApexFile::Open(path);
835 if (!apex_file.ok()) {
836 return apex_file.error();
838 ret.emplace_back(std::move(*apex_file));
856 Result<void> VerifyVndkVersion(const ApexFile& apex_file) {
857 const std::string& vndk_version = apex_file.GetManifest().vndkversion();
868 instance.GetPreInstalledApex(apex_file.GetManifest().name());
894 Result<void> VerifyPackageBoot(const ApexFile& apex_file) {
897 auto public_key = instance.GetPublicKey(apex_file.GetManifest().name());
901 Result<ApexVerityData> verity_or = apex_file.VerifyApexVerity(*public_key);
906 if (shim::IsShimApex(apex_file)) {
910 const auto& result = ValidateStagingShimApex(apex_file);
916 if (auto result = VerifyVndkVersion(apex_file); !result.ok()) {
929 Result<void> VerifyPackageStagedInstall(const ApexFile& apex_file) {
930 const auto& verify_package_boot_status = VerifyPackageBoot(apex_file);
935 const auto validate_fn = [&apex_file](const std::string& mount_point) {
936 if (apex_file.GetManifest().name() == kSepolicyApexName) {
941 return RunVerifyFnInsideTempMount(apex_file, validate_fn, false);
954 for (const ApexFile& apex_file : *apex_files) {
955 Result<void> result = verify_apex_fn(apex_file);
1031 auto backup_path_fn = [](const ApexFile& apex_file) {
1033 GetPackageId(apex_file.GetManifest()).c_str(),
1047 Result<ApexFile> apex_file = ApexFile::Open(path);
1048 if (!apex_file.ok()) {
1049 return Error() << "Backup failed : " << apex_file.error();
1051 const auto& dest_path = backup_path_fn(*apex_file);
1052 if (link(apex_file->GetPath().c_str(), dest_path.c_str()) != 0) {
1053 return ErrnoError() << "Failed to backup " << apex_file->GetPath();
1348 // 1. Create loop devices that is backed by the given apex_file
1349 // 2. If apex_file resides on /data partition then create a dm-verity device
1361 Result<void> ActivatePackageImpl(const ApexFile& apex_file,
1365 const ApexManifest& manifest = apex_file.GetManifest();
1372 if (shim::IsShimApex(apex_file) &&
1373 !ApexFileRepository::GetInstance().IsPreInstalledApex(apex_file)) {
1376 Result<void> result = VerifyPackageBoot(apex_file);
1378 LOG(ERROR) << "Failed to validate shim apex: " << apex_file.GetPath();
1423 auto mount_status = MountPackage(apex_file, mount_point, device_name,
1436 gMountedApexes.SetLatest(manifest.name(), apex_file.GetPath());
1453 gMountedApexes.SetLatest(manifest.name(), apex_file.GetPath());
1457 LOG(DEBUG) << "Successfully activated " << apex_file.GetPath()
1468 Result<ApexFile> apex_file = ApexFile::Open(full_path);
1469 if (!apex_file.ok()) {
1470 return apex_file.error();
1472 return ActivatePackageImpl(*apex_file, GetPackageId(apex_file->GetManifest()),
1479 Result<ApexFile> apex_file = ApexFile::Open(full_path);
1480 if (!apex_file.ok()) {
1481 return apex_file.error();
1484 return UnmountPackage(*apex_file, /* allow_latest= */ true,
1564 Result<ApexFile> apex_file = ApexFile::Open(data.full_path);
1565 if (!apex_file.ok()) {
1568 ret.emplace_back(std::move(*apex_file));
1667 Result<ApexFile> apex_file = ApexFile::Open(ref.get().GetPath());
1668 if (!apex_file.ok()) {
1669 LOG(ERROR) << apex_file.error();
1673 if (apex_file->IsCompressed() &&
1675 apex_file->GetManifest().name()) !=
1680 ret.emplace_back(std::move(*apex_file));
1925 for (const ApexFile& apex_file : decompressed_apex) {
1926 fallback_apexes.emplace_back(std::cref(apex_file));
2290 Result<ApexFile> apex_file = ApexFile::Open(apex);
2291 if (!apex_file.ok()) {
2295 staged_apex_names.push_back(apex_file->GetManifest().name());
2324 std::string StageDestPath(const ApexFile& apex_file) {
2326 GetPackageId(apex_file.GetManifest()).c_str(),
2346 for (const ApexFile& apex_file : *apex_files) {
2347 if (shim::IsShimApex(apex_file)) {
2351 Result<void> result = VerifyPackageBoot(apex_file);
2384 for (const ApexFile& apex_file : *apex_files) {
2387 std::string new_hashtree_file = GetHashTreeFileName(apex_file,
2389 std::string old_hashtree_file = GetHashTreeFileName(apex_file,
2400 std::string dest_path = StageDestPath(apex_file);
2408 if (link(apex_file.GetPath().c_str(), dest_path.c_str()) != 0) {
2409 return ErrnoError() << "Unable to link " << apex_file.GetPath() << " to "
2413 staged_packages.insert(apex_file.GetManifest().name());
2415 LOG(DEBUG) << "Success linking " << apex_file.GetPath() << " to "
3083 for (const ApexFile& apex_file : decompressed_apex) {
3084 activation_list.emplace_back(std::cref(apex_file));
3212 for (const auto& apex_file : ret) {
3213 session->AddApexName(apex_file.GetManifest().name());
3682 for (const ApexFile& apex_file : decompressed_apex) {
3683 activation_list.emplace_back(std::cref(apex_file));
3868 Result<void> VerifyPackageNonStagedInstall(const ApexFile& apex_file) {
3869 const auto& verify_package_boot_status = VerifyPackageBoot(apex_file);
3874 auto check_fn = [&apex_file](const std::string& mount_point) -> Result<void> {
3881 return Error() << apex_file.GetPath() << " contains app inside";
3885 return Error() << apex_file.GetPath() << " contains priv-app inside";
3889 return RunVerifyFnInsideTempMount(apex_file, check_fn, true);