summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHung-ying Tyan2017-06-02 05:59:46 -0500
committerHung-ying Tyan2017-06-16 09:46:15 -0500
commit527d80d945e7b53e53bcc4d42900b3bce228f5d1 (patch)
treeb480816e87e9140e51264854fcde4d7963c3c220
parentfe11ca54212f83c83af3a448248deb072d8041a8 (diff)
downloadplatform-system-core-527d80d945e7b53e53bcc4d42900b3bce228f5d1.tar.gz
platform-system-core-527d80d945e7b53e53bcc4d42900b3bce228f5d1.tar.xz
platform-system-core-527d80d945e7b53e53bcc4d42900b3bce228f5d1.zip
Load default prop from /system/etc/prop.default
/default.prop is moved to /system/etc/prop.default for full Treblized devices. Modifies property_service to load it from there first. In recovery mode, the file is renamed as /prop.default. This path is tried if /system/etc/prop.default is not available. Bug: 37815285 Test: Tested with ag/2419001. Booted pixel phones, checked the location of prop.default, verified the symlink at /default.prop, checked a few properties via adb shell and manually tested a few apps. Booted to recovery and ran 'adb sideload' successfully. Change-Id: I485231f21fc86b0aec58edf867e229a31e77d85e
-rw-r--r--init/property_service.cpp15
-rw-r--r--libcutils/fs_config.cpp3
2 files changed, 13 insertions, 5 deletions
diff --git a/init/property_service.cpp b/init/property_service.cpp
index 3490544c8..20f21a950 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: " << 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,7 +593,13 @@ 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", NULL)) {
597 // Try recovery path
598 if (!load_properties_from_file("/prop.default", NULL)) {
599 // Try legacy path
600 load_properties_from_file("/default.prop", NULL);
601 }
602 }
596 load_properties_from_file("/odm/default.prop", NULL); 603 load_properties_from_file("/odm/default.prop", NULL);
597 load_properties_from_file("/vendor/default.prop", NULL); 604 load_properties_from_file("/vendor/default.prop", NULL);
598 605
diff --git a/libcutils/fs_config.cpp b/libcutils/fs_config.cpp
index 221dea268..c39071cb0 100644
--- a/libcutils/fs_config.cpp
+++ b/libcutils/fs_config.cpp
@@ -134,7 +134,8 @@ 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, "system/etc/prop.default" },
138 { 00600, AID_ROOT, AID_ROOT, 0, "odm/build.prop" }, 139 { 00600, AID_ROOT, AID_ROOT, 0, "odm/build.prop" },
139 { 00600, AID_ROOT, AID_ROOT, 0, "odm/default.prop" }, 140 { 00600, AID_ROOT, AID_ROOT, 0, "odm/default.prop" },
140 { 00444, AID_ROOT, AID_ROOT, 0, odm_conf_dir + 1 }, 141 { 00444, AID_ROOT, AID_ROOT, 0, odm_conf_dir + 1 },