msm8974-common: init: Override everything ^.^

Change-Id: If09eed5bf254a386631327ea19e21d42366fb08f
This commit is contained in:
LuK1337 2019-10-10 23:04:22 +02:00 committed by Kevin F. Haggerty
parent 0fd0cb6ade
commit c0ea446532
No known key found for this signature in database
GPG Key ID: 6D95512933112729
2 changed files with 25 additions and 12 deletions

View File

@ -28,6 +28,8 @@
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <android-base/strings.h>
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <sys/_system_properties.h> #include <sys/_system_properties.h>
@ -37,6 +39,17 @@
using android::init::property_set; using android::init::property_set;
// copied from build/tools/releasetools/ota_from_target_files.py
// but with "." at the end and empty entry
std::vector<std::string> ro_product_props_default_source_order = {
"",
"product.",
"product_services.",
"odm.",
"vendor.",
"system.",
};
void set_rild_libpath(char const variant[]) void set_rild_libpath(char const variant[])
{ {
std::string libpath("/system/vendor/lib/libsec-ril."); std::string libpath("/system/vendor/lib/libsec-ril.");
@ -76,20 +89,21 @@ void gsm_properties(const char default_network[],
property_set("telephony.lteOnGsmDevice", "1"); property_set("telephony.lteOnGsmDevice", "1");
} }
void property_override(char const prop[], char const value[]) void property_override(char const prop[], char const value[], bool add)
{ {
prop_info *pi; auto pi = (prop_info *) __system_property_find(prop);
pi = (prop_info*) __system_property_find(prop); if (pi != nullptr) {
if (pi)
__system_property_update(pi, value, strlen(value)); __system_property_update(pi, value, strlen(value));
else } else if (add) {
__system_property_add(prop, strlen(prop), value, strlen(value)); __system_property_add(prop, strlen(prop), value, strlen(value));
}
} }
void property_override_dual(char const system_prop[], void set_ro_product_prop(char const prop[], char const value[])
char const vendor_prop[], char const value[])
{ {
property_override(system_prop, value); for (const auto &source : ro_product_props_default_source_order) {
property_override(vendor_prop, value); auto prop_name = "ro.product." + source + prop;
property_override(prop_name.c_str(), value, false);
}
} }

View File

@ -39,8 +39,7 @@ void cdma_properties(char const operator_alpha[],
void gsm_properties(char const default_network[], void gsm_properties(char const default_network[],
char const rild_lib_variant[]); char const rild_lib_variant[]);
void init_target_properties(); void init_target_properties();
void property_override(char const prop[], char const value[]); void property_override(char const prop[], char const value[], bool add=false);
void property_override_dual(char const system_prop[], void set_ro_product_prop(char const prop[], char const value[]);
char const vendor_prop[], char const value[]);
#endif /* __INIT_MSM8974__H__ */ #endif /* __INIT_MSM8974__H__ */