diff options
author | Hung-ying Tyan <tyanh@google.com> | 2017-06-13 11:23:06 +0800 |
---|---|---|
committer | Hung-ying Tyan <tyanh@google.com> | 2017-06-13 21:22:06 +0800 |
commit | 12ea2d12ef3f708832facef96f5cf9bd84894928 (patch) | |
tree | 960e05fbed10ebbca6c308b403b0745a90549e7d | |
parent | 642ca632f6b60b7ba875114abacc1b64cf9bffca (diff) | |
download | core-12ea2d12ef3f708832facef96f5cf9bd84894928.tar.gz |
Revert "Revert "Load default prop from /system/etc/prop.default""
This reverts commit 98a73a2ce10df46bc8d095413b415e284206836b.
Bug: 37815285
Bug: 62525809
Test: Tested with ag/2398663 and ag/2400524. Booted pixel phones,
checked the location of pro.default, verified the symlink
at /default.prop, checked a few properties via adb shell and
manually tested a few apps.
Booted to recovery mode and ran 'adb sideload' successfully.
Change-Id: I407412a7002b898ffb352cb5f331cab9c15be39a
-rw-r--r-- | init/property_service.cpp | 12 | ||||
-rw-r--r-- | libcutils/fs_config.c | 3 |
2 files changed, 10 insertions, 5 deletions
diff --git a/init/property_service.cpp b/init/property_service.cpp index 5884cb60c..60c1895f1 100644 --- a/init/property_service.cpp +++ b/init/property_service.cpp @@ -444,7 +444,7 @@ static void handle_property_set_fd() { } } -static void load_properties_from_file(const char *, const char *); +static bool load_properties_from_file(const char *, const char *); /* * Filter is used to decide which properties to load: NULL loads all keys, @@ -508,16 +508,17 @@ static void load_properties(char *data, const char *filter) // Filter is used to decide which properties to load: NULL loads all keys, // "ro.foo.*" is a prefix match, and "ro.foo.bar" is an exact match. -static void load_properties_from_file(const char* filename, const char* filter) { +static bool load_properties_from_file(const char* filename, const char* filter) { Timer t; std::string data; if (!read_file(filename, &data)) { PLOG(WARNING) << "Couldn't load properties from " << filename; - return; + return false; } data.push_back('\n'); load_properties(&data[0], filter); LOG(VERBOSE) << "(Loading properties from " << filename << " took " << t << ".)"; + return true; } static void load_persistent_properties() { @@ -592,7 +593,10 @@ static void update_sys_usb_config() { } void property_load_boot_defaults() { - load_properties_from_file("/default.prop", NULL); + if (!load_properties_from_file("/system/etc/prop.default", NULL)) { + // legacy path + load_properties_from_file("/default.prop", NULL); + } load_properties_from_file("/odm/default.prop", NULL); load_properties_from_file("/vendor/default.prop", NULL); diff --git a/libcutils/fs_config.c b/libcutils/fs_config.c index d98a923c9..5b9d17429 100644 --- a/libcutils/fs_config.c +++ b/libcutils/fs_config.c @@ -135,7 +135,8 @@ static const struct fs_path_config android_files[] = { { 00640, AID_ROOT, AID_SHELL, 0, "data/nativetest64/tests.txt" }, { 00750, AID_ROOT, AID_SHELL, 0, "data/nativetest/*" }, { 00750, AID_ROOT, AID_SHELL, 0, "data/nativetest64/*" }, - { 00600, AID_ROOT, AID_ROOT, 0, "default.prop" }, + { 00600, AID_ROOT, AID_ROOT, 0, "default.prop" }, // legacy + { 00600, AID_ROOT, AID_ROOT, 0, "system/etc/prop.default" }, { 00600, AID_ROOT, AID_ROOT, 0, "odm/build.prop" }, { 00600, AID_ROOT, AID_ROOT, 0, "odm/default.prop" }, { 00444, AID_ROOT, AID_ROOT, 0, odm_conf_dir + 1 }, |