sm6250-common: Adapt libinit to Android 11

[wight554: add property_override to common header]

Signed-off-by: Mohammad Hasan Keramat J <ikeramat80@gmail.com>
Signed-off-by: Volodymyr Zhdanov <wight554@gmail.com>
Change-Id: Ia6b6f753891b639dad4e380bdba6b594faf2a550
This commit is contained in:
Lucchetto 2020-09-16 18:48:36 +02:00 committed by Demon000
parent 2e3dfe8988
commit 1ea5b096b4
3 changed files with 20 additions and 7 deletions

View File

@ -26,6 +26,9 @@ cc_library_static {
], ],
export_include_dirs: [ export_include_dirs: [
"include" "include"
],
shared_libs: [
"libbase",
] ]
} }

View File

@ -2,5 +2,6 @@
#define __INIT_COMMON__H__ #define __INIT_COMMON__H__
void load_common_properties(); void load_common_properties();
void property_override(char const prop[], char const value[], bool add = true);
#endif #endif

View File

@ -23,7 +23,16 @@
#include "init_common.h" #include "init_common.h"
#include "property_service.h" #include "property_service.h"
using android::init::property_set; void property_override(char const prop[], char const value[], bool add)
{
auto pi = (prop_info *) __system_property_find(prop);
if (pi != nullptr) {
__system_property_update(pi, value, strlen(value));
} else if (add) {
__system_property_add(prop, strlen(prop), value, strlen(value));
}
}
void load_dalvik_properties() { void load_dalvik_properties() {
char const *heapstartsize; char const *heapstartsize;
@ -56,12 +65,12 @@ void load_dalvik_properties() {
return; return;
} }
property_set("dalvik.vm.heapstartsize", heapstartsize); property_override("dalvik.vm.heapstartsize", heapstartsize);
property_set("dalvik.vm.heapgrowthlimit", heapgrowthlimit); property_override("dalvik.vm.heapgrowthlimit", heapgrowthlimit);
property_set("dalvik.vm.heapsize", heapsize); property_override("dalvik.vm.heapsize", heapsize);
property_set("dalvik.vm.heaptargetutilization", heaptargetutilization); property_override("dalvik.vm.heaptargetutilization", heaptargetutilization);
property_set("dalvik.vm.heapminfree", heapminfree); property_override("dalvik.vm.heapminfree", heapminfree);
property_set("dalvik.vm.heapmaxfree", heapmaxfree); property_override("dalvik.vm.heapmaxfree", heapmaxfree);
} }
void load_common_properties() { void load_common_properties() {