Lines Matching defs:apex_file
75 #include "apex_file.h"
203 auto apex_file = ApexFile::Open(path);
204 if (!apex_file.ok()) {
209 if (IsBootstrapApex(*apex_file)) {
396 Result<ApexFile> apex_file = ApexFile::Open(path);
397 if (!apex_file.ok()) {
398 return apex_file.error();
401 const std::string& package_name = apex_file->GetManifest().name();
408 if (files_to_keep.find(apex_file->GetPath()) != files_to_keep.end()) {
413 LOG(DEBUG) << "Deleting previously active apex " << apex_file->GetPath();
414 if (unlink(apex_file->GetPath().c_str()) != 0) {
415 return ErrnoError() << "Failed to unlink " << apex_file->GetPath();
867 Result<ApexFile> apex_file = ApexFile::Open(path);
868 if (!apex_file.ok()) {
869 return apex_file.error();
871 ret.emplace_back(std::move(*apex_file));
892 Result<void> VerifyPackageBoot(const ApexFile& apex_file) {
895 auto public_key = instance.GetPublicKey(apex_file.GetManifest().name());
899 Result<ApexVerityData> verity_or = apex_file.VerifyApexVerity(*public_key);
904 if (shim::IsShimApex(apex_file)) {
908 const auto& result = ValidateStagingShimApex(apex_file);
922 Result<void> VerifyPackageStagedInstall(const ApexFile& apex_file) {
923 const auto& verify_package_boot_status = VerifyPackageBoot(apex_file);
928 const auto validate_fn = [&apex_file](const std::string& mount_point) {
929 if (apex_file.GetManifest().name() == kSepolicyApexName) {
934 return RunVerifyFnInsideTempMount(apex_file, validate_fn, false);
947 for (const ApexFile& apex_file : *apex_files) {
948 Result<void> result = verify_apex_fn(apex_file);
1024 auto backup_path_fn = [](const ApexFile& apex_file) {
1026 GetPackageId(apex_file.GetManifest()).c_str(),
1040 Result<ApexFile> apex_file = ApexFile::Open(path);
1041 if (!apex_file.ok()) {
1042 return Error() << "Backup failed : " << apex_file.error();
1044 const auto& dest_path = backup_path_fn(*apex_file);
1045 if (link(apex_file->GetPath().c_str(), dest_path.c_str()) != 0) {
1046 return ErrnoError() << "Failed to backup " << apex_file->GetPath();
1347 Result<void> ActivatePackageImpl(const ApexFile& apex_file,
1351 const ApexManifest& manifest = apex_file.GetManifest();
1358 if (shim::IsShimApex(apex_file) &&
1359 !ApexFileRepository::GetInstance().IsPreInstalledApex(apex_file)) {
1362 Result<void> result = VerifyPackageBoot(apex_file);
1364 LOG(ERROR) << "Failed to validate shim apex: " << apex_file.GetPath();
1409 auto mount_status = MountPackage(apex_file, mount_point, device_name,
1422 gMountedApexes.SetLatest(manifest.name(), apex_file.GetPath());
1439 gMountedApexes.SetLatest(manifest.name(), apex_file.GetPath());
1451 LOG(DEBUG) << "Successfully activated " << apex_file.GetPath()
1460 Result<ApexFile> apex_file = ApexFile::Open(full_path);
1461 if (!apex_file.ok()) {
1462 return apex_file.error();
1464 return ActivatePackageImpl(*apex_file, GetPackageId(apex_file->GetManifest()),
1471 Result<ApexFile> apex_file = ApexFile::Open(full_path);
1472 if (!apex_file.ok()) {
1473 return apex_file.error();
1476 return UnmountPackage(*apex_file, /* allow_latest= */ true,
1556 Result<ApexFile> apex_file = ApexFile::Open(data.full_path);
1557 if (!apex_file.ok()) {
1560 ret.emplace_back(std::move(*apex_file));
1666 Result<ApexFile> apex_file = ApexFile::Open(path);
1667 if (!apex_file.ok()) {
1668 LOG(ERROR) << apex_file.error();
1672 if (apex_file->IsCompressed() &&
1675 apex_file->GetManifest().name()) !=
1680 ret.emplace_back(std::move(*apex_file));
1880 for (const ApexFile& apex_file : decompressed_apex) {
1881 fallback_apexes.emplace_back(std::cref(apex_file));
2245 Result<ApexFile> apex_file = ApexFile::Open(apex);
2246 if (!apex_file.ok()) {
2250 staged_apex_names.push_back(apex_file->GetManifest().name());
2279 std::string StageDestPath(const ApexFile& apex_file) {
2281 GetPackageId(apex_file.GetManifest()).c_str(),
2301 for (const ApexFile& apex_file : *apex_files) {
2302 if (shim::IsShimApex(apex_file)) {
2306 Result<void> result = VerifyPackageBoot(apex_file);
2339 for (const ApexFile& apex_file : *apex_files) {
2342 std::string new_hashtree_file = GetHashTreeFileName(apex_file,
2344 std::string old_hashtree_file = GetHashTreeFileName(apex_file,
2355 std::string dest_path = StageDestPath(apex_file);
2363 if (link(apex_file.GetPath().c_str(), dest_path.c_str()) != 0) {
2364 return ErrnoError() << "Unable to link " << apex_file.GetPath() << " to "
2368 staged_packages.insert(apex_file.GetManifest().name());
2370 LOG(DEBUG) << "Success linking " << apex_file.GetPath() << " to "
3024 for (const ApexFile& apex_file : decompressed_apex) {
3025 activation_list.emplace_back(std::cref(apex_file));
3159 for (const auto& apex_file : ret) {
3160 session->AddApexName(apex_file.GetManifest().name());
3627 for (const ApexFile& apex_file : decompressed_apex) {
3628 activation_list.emplace_back(std::cref(apex_file));
3776 Result<void> VerifyPackageNonStagedInstall(const ApexFile& apex_file) {
3777 const auto& verify_package_boot_status = VerifyPackageBoot(apex_file);
3782 auto check_fn = [&apex_file](const std::string& mount_point) -> Result<void> {
3789 return Error() << apex_file.GetPath() << " contains app inside";
3793 return Error() << apex_file.GetPath() << " contains priv-app inside";
3797 return RunVerifyFnInsideTempMount(apex_file, check_fn, true);