summaryrefslogtreecommitdiff
path: root/dexopt_chroot_setup
diff options
context:
space:
mode:
author Jiakai Zhang <jiakaiz@google.com> 2024-11-19 15:36:28 +0000
committer Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-11-19 16:52:03 +0000
commit5e5cbd91497fee640eecb58873e89a008d536658 (patch)
tree8dac2a7285fa631509648c3b3f9dbb1d82299560 /dexopt_chroot_setup
parent44dda682e05809b6e6118f17cbb19f75f1c27649 (diff)
Skip temporary mount points created by Package Manager.
These mount points are created by Package Manager during app install and are not in the Package Manager's snapshot. Therefore, we won't be able to dexopt the app there anyway. Bug: 377790316 Change-Id: I0a3ba52918c8666cb3c346a206e42db44519c075 Test: Presubmit
Diffstat (limited to 'dexopt_chroot_setup')
-rw-r--r--dexopt_chroot_setup/dexopt_chroot_setup.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/dexopt_chroot_setup/dexopt_chroot_setup.cc b/dexopt_chroot_setup/dexopt_chroot_setup.cc
index b9513df529..a88195d443 100644
--- a/dexopt_chroot_setup/dexopt_chroot_setup.cc
+++ b/dexopt_chroot_setup/dexopt_chroot_setup.cc
@@ -314,7 +314,21 @@ Result<void> BindMountRecursive(const std::string& source, const std::string& ta
// `source` itself. Already mounted.
continue;
}
- OR_RETURN(BindMount(entry.mount_point, std::string(target).append(sub_dir)));
+ if (Result<void> result = BindMount(entry.mount_point, std::string(target).append(sub_dir));
+ !result.ok()) {
+ // Match paths for the "u:object_r:apk_tmp_file:s0" file context in
+ // system/sepolicy/private/file_contexts.
+ std::regex apk_tmp_file_re(R"re((/data|/mnt/expand/[^/]+)/app/vmdl[^/]+\.tmp(/.*)?)re");
+ std::smatch match;
+ if (std::regex_match(entry.mount_point, match, apk_tmp_file_re)) {
+ // Don't bother. The mount point is a temporary directory created by Package Manager during
+ // app install. We won't be able to dexopt the app there anyway because it's not in the
+ // Package Manager's snapshot.
+ LOG(INFO) << ART_FORMAT("Skipped temporary mount point '{}'", entry.mount_point);
+ continue;
+ }
+ return result;
+ }
}
return {};
}