Lines Matching defs:apex_file
23 #include "apex_file.h"
193 auto apex_file = ApexFile::Open(path);
194 if (!apex_file.ok()) {
199 if (IsBootstrapApex(*apex_file)) {
353 Result<ApexFile> apex_file = ApexFile::Open(path);
354 if (!apex_file.ok()) {
355 return apex_file.error();
358 const std::string& package_name = apex_file->GetManifest().name();
365 if (files_to_keep.find(apex_file->GetPath()) != files_to_keep.end()) {
370 LOG(DEBUG) << "Deleting previously active apex " << apex_file->GetPath();
371 if (unlink(apex_file->GetPath().c_str()) != 0) {
372 return ErrnoError() << "Failed to unlink " << apex_file->GetPath();
707 for (const ApexFile& apex_file : apexes) {
708 apexd_private::UnmountTempMount(apex_file);
717 for (const ApexFile& apex_file : apexes) {
718 if (!(apex_file.GetManifest().*fn)().empty()) {
772 Result<ApexFile> apex_file = ApexFile::Open(path);
773 if (!apex_file.ok()) {
774 return apex_file.error();
776 ret.emplace_back(std::move(*apex_file));
797 Result<void> VerifyPackageBoot(const ApexFile& apex_file) {
800 auto public_key = instance.GetPublicKey(apex_file.GetManifest().name());
804 Result<ApexVerityData> verity_or = apex_file.VerifyApexVerity(*public_key);
809 if (shim::IsShimApex(apex_file)) {
813 const auto& result = ValidateStagingShimApex(apex_file);
825 Result<void> VerifyPackageStagedInstall(const ApexFile& apex_file) {
826 const auto& verify_package_boot_status = VerifyPackageBoot(apex_file);
834 return RunVerifyFnInsideTempMount(apex_file, kSuccessFn, false);
847 for (const ApexFile& apex_file : *apex_files) {
848 Result<void> result = verify_apex_fn(apex_file);
924 auto backup_path_fn = [](const ApexFile& apex_file) {
926 GetPackageId(apex_file.GetManifest()).c_str(),
940 Result<ApexFile> apex_file = ApexFile::Open(path);
941 if (!apex_file.ok()) {
942 return Error() << "Backup failed : " << apex_file.error();
944 const auto& dest_path = backup_path_fn(*apex_file);
945 if (link(apex_file->GetPath().c_str(), dest_path.c_str()) != 0) {
946 return ErrnoError() << "Failed to backup " << apex_file->GetPath();
1236 Result<void> ActivatePackageImpl(const ApexFile& apex_file,
1238 const ApexManifest& manifest = apex_file.GetManifest();
1245 if (shim::IsShimApex(apex_file) &&
1246 !ApexFileRepository::GetInstance().IsPreInstalledApex(apex_file)) {
1249 Result<void> result = VerifyPackageBoot(apex_file);
1251 LOG(ERROR) << "Failed to validate shim apex: " << apex_file.GetPath();
1296 auto mount_status = MountPackage(apex_file, mount_point, device_name);
1308 gMountedApexes.SetLatest(manifest.name(), apex_file.GetPath());
1325 gMountedApexes.SetLatest(manifest.name(), apex_file.GetPath());
1337 LOG(DEBUG) << "Successfully activated " << apex_file.GetPath()
1346 Result<ApexFile> apex_file = ApexFile::Open(full_path);
1347 if (!apex_file.ok()) {
1348 return apex_file.error();
1350 return ActivatePackageImpl(*apex_file,
1351 GetPackageId(apex_file->GetManifest()));
1357 Result<ApexFile> apex_file = ApexFile::Open(full_path);
1358 if (!apex_file.ok()) {
1359 return apex_file.error();
1362 return UnmountPackage(*apex_file, /* allow_latest= */ true,
1374 Result<ApexFile> apex_file = ApexFile::Open(data.full_path);
1375 if (!apex_file.ok()) {
1378 ret.emplace_back(std::move(*apex_file));
1484 Result<ApexFile> apex_file = ApexFile::Open(path);
1485 if (!apex_file.ok()) {
1486 LOG(ERROR) << apex_file.error();
1490 if (apex_file->IsCompressed() &&
1493 apex_file->GetManifest().name()) !=
1498 ret.emplace_back(std::move(*apex_file));
1558 Result<ApexFile> apex_file = ApexFile::Open(name);
1559 if (!apex_file.ok()) {
1560 LOG(ERROR) << "Failed to scan " << name << " : " << apex_file.error();
1562 ret.emplace_back(std::move(*apex_file));
1693 for (const ApexFile& apex_file : decompressed_apex) {
1694 fallback_apexes.emplace_back(std::cref(apex_file));
2061 Result<ApexFile> apex_file = ApexFile::Open(apex);
2062 if (!apex_file.ok()) {
2066 session.AddApexName(apex_file->GetManifest().name());
2109 std::string StageDestPath(const ApexFile& apex_file) {
2111 GetPackageId(apex_file.GetManifest()).c_str(),
2131 for (const ApexFile& apex_file : *apex_files) {
2132 if (shim::IsShimApex(apex_file)) {
2136 Result<void> result = VerifyPackageBoot(apex_file);
2169 for (const ApexFile& apex_file : *apex_files) {
2172 std::string new_hashtree_file = GetHashTreeFileName(apex_file,
2174 std::string old_hashtree_file = GetHashTreeFileName(apex_file,
2185 std::string dest_path = StageDestPath(apex_file);
2193 if (link(apex_file.GetPath().c_str(), dest_path.c_str()) != 0) {
2194 return ErrnoError() << "Unable to link " << apex_file.GetPath() << " to "
2198 staged_packages.insert(apex_file.GetManifest().name());
2200 LOG(DEBUG) << "Success linking " << apex_file.GetPath() << " to "
2819 for (const ApexFile& apex_file : decompressed_apex) {
2820 activation_list.emplace_back(std::cref(apex_file));
3296 for (const ApexFile& apex_file : decompressed_apex) {
3297 activation_list.emplace_back(std::cref(apex_file));
3444 Result<void> VerifyPackageNonStagedInstall(const ApexFile& apex_file) {
3445 const auto& verify_package_boot_status = VerifyPackageBoot(apex_file);
3450 auto check_fn = [&apex_file](const std::string& mount_point) -> Result<void> {
3457 return Error() << apex_file.GetPath() << " contains app inside";
3461 return Error() << apex_file.GetPath() << " contains priv-app inside";
3465 return RunVerifyFnInsideTempMount(apex_file, check_fn, true);