From 1d1a7f182ce74ade10a6f6fdf05b3700ec22cff7 Mon Sep 17 00:00:00 2001 From: "Kevin F. Haggerty" Date: Fri, 28 Feb 2020 07:50:43 -0700 Subject: [PATCH] msm8974-common: libinit: Commonize {cdma,gsm}_properties functions * It doesn't make sense to maintain these in the numerous device- specific trees. It especially doesn't make sense for those to be subtly-different. Change-Id: I4e82c0f6b5b835ac4c742a5d5663a8f3498aaf7b --- init/init_msm8974.cpp | 39 +++++++++++++++++++++++++++++++++++++++ init/init_msm8974.h | 9 ++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/init/init_msm8974.cpp b/init/init_msm8974.cpp index 8fd73f1..1ecdb60 100644 --- a/init/init_msm8974.cpp +++ b/init/init_msm8974.cpp @@ -42,6 +42,45 @@ void init_target_properties() { } +void set_rild_libpath(char const variant[]) +{ + std::string libpath("/system/vendor/lib/libsec-ril."); + libpath += variant; + libpath += ".so"; + + property_override("rild.libpath", libpath.c_str()); +} + +void cdma_properties(char const operator_alpha[], + char const operator_numeric[], + char const default_cdma_sub[], + char const default_network[], + char const rild_lib_variant[]) +{ + // Dynamic CDMA Properties + property_set("ro.cdma.home.operator.alpha", operator_alpha); + property_set("ro.cdma.home.operator.numeric", operator_numeric); + property_set("ro.telephony.default_cdma_sub", default_cdma_sub); + property_set("ro.telephony.default_network", default_network); + set_rild_libpath(rild_lib_variant); + + // Static CDMA Properties + property_set("ril.subscription.types", "NV,RUIM"); + property_set("telephony.lteOnCdmaDevice", "1"); +} + +void gsm_properties(const char default_network[], + char const rild_lib_variant[]) +{ + set_rild_libpath(rild_lib_variant); + + // Dynamic GSM Properties + property_set("ro.telephony.default_network", default_network); + + // Static GSM Properties + property_set("telephony.lteOnGsmDevice", "1"); +} + void property_override(char const prop[], char const value[]) { prop_info *pi; diff --git a/init/init_msm8974.h b/init/init_msm8974.h index b33e3cb..53085af 100644 --- a/init/init_msm8974.h +++ b/init/init_msm8974.h @@ -1,6 +1,6 @@ /* Copyright (c) 2016, The CyanogenMod Project - Copyright (c) 2018, The LineageOS Project + Copyright (c) 2018-2020, The LineageOS Project Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -31,6 +31,13 @@ #ifndef __INIT_MSM8974__H__ #define __INIT_MSM8974__H__ +void cdma_properties(char const operator_alpha[], + char const operator_numeric[], + char const default_cdma_sub[], + char const default_network[], + char const rild_lib_variant[]); +void gsm_properties(char const default_network[], + char const rild_lib_variant[]); void init_target_properties(); void property_override(char const prop[], char const value[]); void property_override_dual(char const system_prop[],