Loading init/property_service.cpp +16 −8 Original line number Diff line number Diff line Loading @@ -877,28 +877,36 @@ static void property_derive_build_fingerprint() { } void PropertyLoadBootDefaults() { // TODO(b/117892318): merge prop.default and build.prop files into one // We read the properties and their values into a map, in order to always allow properties // loaded in the later property files to override the properties in loaded in the earlier // property files, regardless of if they are "ro." properties or not. std::map<std::string, std::string> properties; if (!load_properties_from_file("/system/etc/prop.default", nullptr, &properties)) { // Try recovery path if (!load_properties_from_file("/prop.default", nullptr, &properties)) { // Try legacy path load_properties_from_file("/default.prop", nullptr, &properties); } if (IsRecoveryMode()) { load_properties_from_file("/prop.default", nullptr, &properties); } // Try legacy (non-Treble) path. This file might not exist in most of the // post-Oreo devices. Absence of the file is not an error. load_properties_from_file("/default.prop", nullptr, &properties); load_properties_from_file("/system/build.prop", nullptr, &properties); load_properties_from_file("/system_ext/build.prop", nullptr, &properties); // TODO(b/117892318): uncomment the following condition when vendor.imgs for // aosp_* targets are all updated. // if (SelinuxGetVendorAndroidVersion() <= __ANDROID_API_R__) { load_properties_from_file("/vendor/default.prop", nullptr, &properties); // } load_properties_from_file("/vendor/build.prop", nullptr, &properties); if (SelinuxGetVendorAndroidVersion() >= __ANDROID_API_Q__) { load_properties_from_file("/odm/etc/build.prop", nullptr, &properties); } else { load_properties_from_file("/odm/default.prop", nullptr, &properties); load_properties_from_file("/odm/build.prop", nullptr, &properties); } load_properties_from_file("/product/build.prop", nullptr, &properties); load_properties_from_file("/factory/factory.prop", "ro.*", &properties); Loading init/util_test.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -61,8 +61,8 @@ TEST(util, ReadFileWorldWiteable) { TEST(util, ReadFileSymbolicLink) { errno = 0; // lrw------- 1 root root 23 2008-12-31 19:00 default.prop -> system/etc/prop.default auto file_contents = ReadFile("/default.prop"); // lrwxr-xr-x 1 root shell 6 2009-01-01 09:00 /system/bin/ps -> toybox auto file_contents = ReadFile("/system/bin/ps"); EXPECT_EQ(ELOOP, errno); ASSERT_FALSE(file_contents.ok()); EXPECT_EQ("open() failed: Too many symbolic links encountered", Loading Loading
init/property_service.cpp +16 −8 Original line number Diff line number Diff line Loading @@ -877,28 +877,36 @@ static void property_derive_build_fingerprint() { } void PropertyLoadBootDefaults() { // TODO(b/117892318): merge prop.default and build.prop files into one // We read the properties and their values into a map, in order to always allow properties // loaded in the later property files to override the properties in loaded in the earlier // property files, regardless of if they are "ro." properties or not. std::map<std::string, std::string> properties; if (!load_properties_from_file("/system/etc/prop.default", nullptr, &properties)) { // Try recovery path if (!load_properties_from_file("/prop.default", nullptr, &properties)) { // Try legacy path load_properties_from_file("/default.prop", nullptr, &properties); } if (IsRecoveryMode()) { load_properties_from_file("/prop.default", nullptr, &properties); } // Try legacy (non-Treble) path. This file might not exist in most of the // post-Oreo devices. Absence of the file is not an error. load_properties_from_file("/default.prop", nullptr, &properties); load_properties_from_file("/system/build.prop", nullptr, &properties); load_properties_from_file("/system_ext/build.prop", nullptr, &properties); // TODO(b/117892318): uncomment the following condition when vendor.imgs for // aosp_* targets are all updated. // if (SelinuxGetVendorAndroidVersion() <= __ANDROID_API_R__) { load_properties_from_file("/vendor/default.prop", nullptr, &properties); // } load_properties_from_file("/vendor/build.prop", nullptr, &properties); if (SelinuxGetVendorAndroidVersion() >= __ANDROID_API_Q__) { load_properties_from_file("/odm/etc/build.prop", nullptr, &properties); } else { load_properties_from_file("/odm/default.prop", nullptr, &properties); load_properties_from_file("/odm/build.prop", nullptr, &properties); } load_properties_from_file("/product/build.prop", nullptr, &properties); load_properties_from_file("/factory/factory.prop", "ro.*", &properties); Loading
init/util_test.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -61,8 +61,8 @@ TEST(util, ReadFileWorldWiteable) { TEST(util, ReadFileSymbolicLink) { errno = 0; // lrw------- 1 root root 23 2008-12-31 19:00 default.prop -> system/etc/prop.default auto file_contents = ReadFile("/default.prop"); // lrwxr-xr-x 1 root shell 6 2009-01-01 09:00 /system/bin/ps -> toybox auto file_contents = ReadFile("/system/bin/ps"); EXPECT_EQ(ELOOP, errno); ASSERT_FALSE(file_contents.ok()); EXPECT_EQ("open() failed: Too many symbolic links encountered", Loading