summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-28 18:49:10 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-28 18:49:10 +0000
commit83a9ccff6539772e66e7e03fb5566ac5e617d002 (patch)
tree9d22628e96d2e00ba044c86e13689461b67ee568
parent97ba350dad734a6e032bedf0618eb8061e027a8b (diff)
parent552df6a87356d678baffda45e2207aeeb85f55e3 (diff)
downloadapex-83a9ccff6539772e66e7e03fb5566ac5e617d002.tar.gz
Snap for 8513021 from 552df6a87356d678baffda45e2207aeeb85f55e3 to main-cg-testing-release
Change-Id: I62472f4fa930cc2c670096c496f4ee29cdf4ee82
-rw-r--r--apexd/apexd.cpp36
-rw-r--r--apexd/apexservice_test.cpp4
-rw-r--r--apexer/apexer.py6
-rw-r--r--shim/build/Android.bp14
4 files changed, 36 insertions, 24 deletions
diff --git a/apexd/apexd.cpp b/apexd/apexd.cpp
index 055c641e..0f0c729b 100644
--- a/apexd/apexd.cpp
+++ b/apexd/apexd.cpp
@@ -122,6 +122,7 @@ static constexpr const char* kDmVerityRestartOnCorruption =
MountedApexDatabase gMountedApexes;
+// Can be set by SetConfig()
std::optional<ApexdConfig> gConfig;
CheckpointInterface* gVoldService;
@@ -1637,31 +1638,22 @@ std::vector<ApexFile> GetFactoryPackages() {
}
}
- for (const auto& dir : gConfig->apex_built_in_dirs) {
- auto all_apex_files = FindFilesBySuffix(
- dir, {kApexPackageSuffix, kCompressedApexPackageSuffix});
- if (!all_apex_files.ok()) {
- LOG(ERROR) << all_apex_files.error();
+ const auto& file_repository = ApexFileRepository::GetInstance();
+ for (const auto& ref : file_repository.GetPreInstalledApexFiles()) {
+ Result<ApexFile> apex_file = ApexFile::Open(ref.get().GetPath());
+ if (!apex_file.ok()) {
+ LOG(ERROR) << apex_file.error();
continue;
}
-
- for (const std::string& path : *all_apex_files) {
- Result<ApexFile> apex_file = ApexFile::Open(path);
- if (!apex_file.ok()) {
- LOG(ERROR) << apex_file.error();
- continue;
- }
- // Ignore compressed APEX if it has been decompressed already
- if (apex_file->IsCompressed() &&
- std::find(decompressed_pkg_names.begin(),
- decompressed_pkg_names.end(),
- apex_file->GetManifest().name()) !=
- decompressed_pkg_names.end()) {
- continue;
- }
-
- ret.emplace_back(std::move(*apex_file));
+ // Ignore compressed APEX if it has been decompressed already
+ if (apex_file->IsCompressed() &&
+ std::find(decompressed_pkg_names.begin(), decompressed_pkg_names.end(),
+ apex_file->GetManifest().name()) !=
+ decompressed_pkg_names.end()) {
+ continue;
}
+
+ ret.emplace_back(std::move(*apex_file));
}
return ret;
}
diff --git a/apexd/apexservice_test.cpp b/apexd/apexservice_test.cpp
index 29cf1d73..18918fb3 100644
--- a/apexd/apexservice_test.cpp
+++ b/apexd/apexservice_test.cpp
@@ -769,7 +769,7 @@ TEST_F(ApexServiceTest, GetFactoryPackages) {
}
}
-TEST_F(ApexServiceTest, DISABLED_NoPackagesAreBothActiveAndInactive) {
+TEST_F(ApexServiceTest, NoPackagesAreBothActiveAndInactive) {
Result<std::vector<ApexInfo>> active_packages = GetActivePackages();
ASSERT_TRUE(IsOk(active_packages));
ASSERT_TRUE(active_packages->size() > 0);
@@ -789,7 +789,7 @@ TEST_F(ApexServiceTest, DISABLED_NoPackagesAreBothActiveAndInactive) {
ASSERT_THAT(intersection, SizeIs(0));
}
-TEST_F(ApexServiceTest, DISABLED_GetAllPackages) {
+TEST_F(ApexServiceTest, GetAllPackages) {
Result<std::vector<ApexInfo>> all_packages = GetAllPackages();
ASSERT_TRUE(IsOk(all_packages));
ASSERT_TRUE(all_packages->size() > 0);
diff --git a/apexer/apexer.py b/apexer/apexer.py
index 71b3a948..d2155950 100644
--- a/apexer/apexer.py
+++ b/apexer/apexer.py
@@ -487,6 +487,12 @@ def ShaHashFiles(file_paths):
def CreateImageExt4(args, staging_input_dir, work_dir, manifests_dir, img_file, canned_fs_config):
"""Create image for ext4 file system."""
+
+ lost_found_location = os.path.join(args.input_dir, 'lost+found')
+ if os.path.exists(lost_found_location):
+ print('Warning: input_dir contains a lost+found/ root folder, which '
+ 'has been known to cause non-deterministic apex builds.')
+
# sufficiently big = size + 16MB margin
size_in_mb = (GetDirSize(staging_input_dir) // (1024 * 1024))
size_in_mb += 16
diff --git a/shim/build/Android.bp b/shim/build/Android.bp
index 2fa99bf5..6dc64a3f 100644
--- a/shim/build/Android.bp
+++ b/shim/build/Android.bp
@@ -265,6 +265,7 @@ genrule {
":com.android.apex.cts.shim.v2_with_post_install_hook",
":com.android.apex.cts.shim.v2_sdk_target_p",
":com.android.apex.cts.shim.v2_apk_in_apex_sdk_target_p",
+ ":com.android.apex.cts.shim.v2_apk_in_apex_upgrades",
":com.android.apex.cts.shim.v2_rebootless",
":com.android.apex.cts.shim.v3",
":com.android.apex.cts.shim.v3_rebootless",
@@ -582,3 +583,16 @@ apex {
installable: false,
updatable: false,
}
+
+// Apex shim with upgraded apk-in-apexes
+apex {
+ name: "com.android.apex.cts.shim.v2_apk_in_apex_upgrades",
+ manifest: "manifest_v2.json",
+ androidManifest: "AndroidManifest.xml",
+ file_contexts: ":apex.test-file_contexts",
+ key: "com.android.apex.cts.shim.key",
+ prebuilts: ["hash_of_dev_null"],
+ apps: ["CtsShim", "CtsShimPrivUpgrade"],
+ installable: false,
+ updatable: false,
+}