summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHung-ying Tyan2017-05-24 21:46:10 -0500
committerandroid-build-merger2017-05-24 21:46:10 -0500
commita22e004f57f87da1df0b1d953786f4256f9ad873 (patch)
tree8c3671d73b6e622a3bf38a0d73efff11149b21f1
parent122acf177a68597da9661642755e09470ca6dc0a (diff)
parent0cd0d52147264122734d9fab36418713254685ed (diff)
downloadplatform-system-core-a22e004f57f87da1df0b1d953786f4256f9ad873.tar.gz
platform-system-core-a22e004f57f87da1df0b1d953786f4256f9ad873.tar.xz
platform-system-core-a22e004f57f87da1df0b1d953786f4256f9ad873.zip
Merge "Load {default,build}.prop from /{system,vendor,odm}/etc/" am: a9aa77d259 am: 26c4bcfadd
am: 0cd0d52147 Change-Id: Ide638286886cef323e8bb049f5baf4bbe659c47a
-rw-r--r--init/property_service.cpp34
-rw-r--r--libcutils/fs_config.cpp15
2 files changed, 32 insertions, 17 deletions
diff --git a/init/property_service.cpp b/init/property_service.cpp
index 18e47e3df..7fa37c8a9 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -443,7 +443,7 @@ static void handle_property_set_fd() {
443 } 443 }
444} 444}
445 445
446static void load_properties_from_file(const char *, const char *); 446static bool load_properties_from_file(const char *, const char *);
447 447
448/* 448/*
449 * Filter is used to decide which properties to load: NULL loads all keys, 449 * Filter is used to decide which properties to load: NULL loads all keys,
@@ -507,17 +507,18 @@ static void load_properties(char *data, const char *filter)
507 507
508// Filter is used to decide which properties to load: NULL loads all keys, 508// Filter is used to decide which properties to load: NULL loads all keys,
509// "ro.foo.*" is a prefix match, and "ro.foo.bar" is an exact match. 509// "ro.foo.*" is a prefix match, and "ro.foo.bar" is an exact match.
510static void load_properties_from_file(const char* filename, const char* filter) { 510static bool load_properties_from_file(const char* filename, const char* filter) {
511 Timer t; 511 Timer t;
512 std::string data; 512 std::string data;
513 std::string err; 513 std::string err;
514 if (!ReadFile(filename, &data, &err)) { 514 if (!ReadFile(filename, &data, &err)) {
515 PLOG(WARNING) << "Couldn't load property file: " << err; 515 PLOG(WARNING) << "Couldn't load property file: " << filename << ": " << err;
516 return; 516 return false;
517 } 517 }
518 data.push_back('\n'); 518 data.push_back('\n');
519 load_properties(&data[0], filter); 519 load_properties(&data[0], filter);
520 LOG(VERBOSE) << "(Loading properties from " << filename << " took " << t << ".)"; 520 LOG(VERBOSE) << "(Loading properties from " << filename << " took " << t << ".)";
521 return true;
521} 522}
522 523
523static void load_persistent_properties() { 524static void load_persistent_properties() {
@@ -592,16 +593,21 @@ static void update_sys_usb_config() {
592} 593}
593 594
594void property_load_boot_defaults() { 595void property_load_boot_defaults() {
595 load_properties_from_file("/default.prop", NULL); 596 if (!load_properties_from_file("/system/etc/prop.default", nullptr)) {
596 load_properties_from_file("/odm/default.prop", NULL); 597 // for legacy devices
597 load_properties_from_file("/vendor/default.prop", NULL); 598 if (!load_properties_from_file("/default.prop", nullptr)) {
599 PLOG(ERROR) << "Failed to load default prop";
600 }
601 }
602 load_properties_from_file("/odm/etc/prop.default", nullptr);
603 load_properties_from_file("/vendor/etc/prop.default", nullptr);
598 604
599 update_sys_usb_config(); 605 update_sys_usb_config();
600} 606}
601 607
602static void load_override_properties() { 608static void load_override_properties() {
603 if (ALLOW_LOCAL_PROP_OVERRIDE) { 609 if (ALLOW_LOCAL_PROP_OVERRIDE) {
604 load_properties_from_file("/data/local.prop", NULL); 610 load_properties_from_file("/data/local.prop", nullptr);
605 } 611 }
606} 612}
607 613
@@ -649,9 +655,15 @@ void load_recovery_id_prop() {
649} 655}
650 656
651void load_system_props() { 657void load_system_props() {
652 load_properties_from_file("/system/build.prop", NULL); 658 if (!load_properties_from_file("/system/etc/prop.build", nullptr)) {
653 load_properties_from_file("/odm/build.prop", NULL); 659 // for legacy devices
654 load_properties_from_file("/vendor/build.prop", NULL); 660 load_properties_from_file("/system/build.prop", nullptr);
661 }
662 load_properties_from_file("/odm/etc/prop.build", nullptr);
663 if (!load_properties_from_file("/vendor/etc/prop.build", nullptr)) {
664 // for legacy devices
665 load_properties_from_file("/vendor/build.prop", nullptr);
666 }
655 load_properties_from_file("/factory/factory.prop", "ro.*"); 667 load_properties_from_file("/factory/factory.prop", "ro.*");
656 load_recovery_id_prop(); 668 load_recovery_id_prop();
657} 669}
diff --git a/libcutils/fs_config.cpp b/libcutils/fs_config.cpp
index 221dea268..5defb69c0 100644
--- a/libcutils/fs_config.cpp
+++ b/libcutils/fs_config.cpp
@@ -134,9 +134,10 @@ static const struct fs_path_config android_files[] = {
134 { 00640, AID_ROOT, AID_SHELL, 0, "data/nativetest64/tests.txt" }, 134 { 00640, AID_ROOT, AID_SHELL, 0, "data/nativetest64/tests.txt" },
135 { 00750, AID_ROOT, AID_SHELL, 0, "data/nativetest/*" }, 135 { 00750, AID_ROOT, AID_SHELL, 0, "data/nativetest/*" },
136 { 00750, AID_ROOT, AID_SHELL, 0, "data/nativetest64/*" }, 136 { 00750, AID_ROOT, AID_SHELL, 0, "data/nativetest64/*" },
137 { 00600, AID_ROOT, AID_ROOT, 0, "default.prop" }, 137 { 00600, AID_ROOT, AID_ROOT, 0, "default.prop" }, // legacy
138 { 00600, AID_ROOT, AID_ROOT, 0, "odm/build.prop" }, 138 { 00600, AID_ROOT, AID_ROOT, 0, "system/etc/prop.default" },
139 { 00600, AID_ROOT, AID_ROOT, 0, "odm/default.prop" }, 139 { 00600, AID_ROOT, AID_ROOT, 0, "odm/etc/prop.build" },
140 { 00600, AID_ROOT, AID_ROOT, 0, "odm/etc/prop.default" },
140 { 00444, AID_ROOT, AID_ROOT, 0, odm_conf_dir + 1 }, 141 { 00444, AID_ROOT, AID_ROOT, 0, odm_conf_dir + 1 },
141 { 00444, AID_ROOT, AID_ROOT, 0, odm_conf_file + 1 }, 142 { 00444, AID_ROOT, AID_ROOT, 0, odm_conf_file + 1 },
142 { 00444, AID_ROOT, AID_ROOT, 0, oem_conf_dir + 1 }, 143 { 00444, AID_ROOT, AID_ROOT, 0, oem_conf_dir + 1 },
@@ -148,7 +149,8 @@ static const struct fs_path_config android_files[] = {
148 { 00750, AID_ROOT, AID_ROOT, 0, "system/bin/install-recovery.sh" }, 149 { 00750, AID_ROOT, AID_ROOT, 0, "system/bin/install-recovery.sh" },
149 { 00700, AID_ROOT, AID_ROOT, 0, "system/bin/secilc" }, 150 { 00700, AID_ROOT, AID_ROOT, 0, "system/bin/secilc" },
150 { 00750, AID_ROOT, AID_ROOT, 0, "system/bin/uncrypt" }, 151 { 00750, AID_ROOT, AID_ROOT, 0, "system/bin/uncrypt" },
151 { 00600, AID_ROOT, AID_ROOT, 0, "system/build.prop" }, 152 { 00600, AID_ROOT, AID_ROOT, 0, "system/build.prop" }, // legacy
153 { 00600, AID_ROOT, AID_ROOT, 0, "system/etc/prop.build" },
152 { 00444, AID_ROOT, AID_ROOT, 0, sys_conf_dir + 1 }, 154 { 00444, AID_ROOT, AID_ROOT, 0, sys_conf_dir + 1 },
153 { 00444, AID_ROOT, AID_ROOT, 0, sys_conf_file + 1 }, 155 { 00444, AID_ROOT, AID_ROOT, 0, sys_conf_file + 1 },
154 { 00440, AID_ROOT, AID_SHELL, 0, "system/etc/init.goldfish.rc" }, 156 { 00440, AID_ROOT, AID_SHELL, 0, "system/etc/init.goldfish.rc" },
@@ -157,8 +159,9 @@ static const struct fs_path_config android_files[] = {
157 { 00555, AID_ROOT, AID_ROOT, 0, "system/etc/ppp/*" }, 159 { 00555, AID_ROOT, AID_ROOT, 0, "system/etc/ppp/*" },
158 { 00555, AID_ROOT, AID_ROOT, 0, "system/etc/rc.*" }, 160 { 00555, AID_ROOT, AID_ROOT, 0, "system/etc/rc.*" },
159 { 00440, AID_ROOT, AID_ROOT, 0, "system/etc/recovery.img" }, 161 { 00440, AID_ROOT, AID_ROOT, 0, "system/etc/recovery.img" },
160 { 00600, AID_ROOT, AID_ROOT, 0, "vendor/build.prop" }, 162 { 00600, AID_ROOT, AID_ROOT, 0, "vendor/build.prop" }, // legacy
161 { 00600, AID_ROOT, AID_ROOT, 0, "vendor/default.prop" }, 163 { 00600, AID_ROOT, AID_ROOT, 0, "vendor/etc/prop.build" },
164 { 00600, AID_ROOT, AID_ROOT, 0, "vendor/etc/prop.default" },
162 { 00444, AID_ROOT, AID_ROOT, 0, ven_conf_dir + 1 }, 165 { 00444, AID_ROOT, AID_ROOT, 0, ven_conf_dir + 1 },
163 { 00444, AID_ROOT, AID_ROOT, 0, ven_conf_file + 1 }, 166 { 00444, AID_ROOT, AID_ROOT, 0, ven_conf_file + 1 },
164 167