summaryrefslogtreecommitdiff
path: root/init/init_sdm660.cpp
diff options
context:
space:
mode:
authorLucchetto <lucchetto.tie@live.com>2020-09-16 18:48:36 +0200
committerMichael Bestas <mkbestas@lineageos.org>2020-12-20 18:55:01 +0200
commit1fdc4f54ca24f0e29a89a831191842da7919c5cc (patch)
tree387c321f8e835a15b1d3f40b058d42511af10889 /init/init_sdm660.cpp
parent3301bde40bd6182ff7397f81beb1748c12b5f528 (diff)
sdm660-common: Adapt libinit to Android 11
Change-Id: Ia6b6f753891b639dad4e380bdba6b594faf2a550
Diffstat (limited to 'init/init_sdm660.cpp')
-rw-r--r--init/init_sdm660.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/init/init_sdm660.cpp b/init/init_sdm660.cpp
index 63e7d79..fc0c5bc 100644
--- a/init/init_sdm660.cpp
+++ b/init/init_sdm660.cpp
@@ -1,6 +1,6 @@
/*
Copyright (c) 2016, The CyanogenMod Project
- Copyright (c) 2019, The LineageOS Project
+ Copyright (c) 2019-2020, The LineageOS Project
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -41,9 +41,6 @@
#include "vendor_init.h"
#include "property_service.h"
-using android::base::GetProperty;
-using android::init::property_set;
-
char const *heapstartsize;
char const *heapgrowthlimit;
char const *heapsize;
@@ -84,14 +81,25 @@ void check_device()
}
}
+void property_override(char const prop[], char const value[], bool add = true)
+{
+ 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 vendor_load_properties()
{
check_device();
- property_set("dalvik.vm.heapstartsize", heapstartsize);
- property_set("dalvik.vm.heapgrowthlimit", heapgrowthlimit);
- property_set("dalvik.vm.heapsize", heapsize);
- property_set("dalvik.vm.heaptargetutilization", heaptargetutilization);
- property_set("dalvik.vm.heapminfree", heapminfree);
- property_set("dalvik.vm.heapmaxfree", heapmaxfree);
+ property_override("dalvik.vm.heapstartsize", heapstartsize);
+ property_override("dalvik.vm.heapgrowthlimit", heapgrowthlimit);
+ property_override("dalvik.vm.heapsize", heapsize);
+ property_override("dalvik.vm.heaptargetutilization", heaptargetutilization);
+ property_override("dalvik.vm.heapminfree", heapminfree);
+ property_override("dalvik.vm.heapmaxfree", heapmaxfree);
}