msm8953-common: Adapt libinit to Android 11

Change-Id: Ia6b6f753891b639dad4e380bdba6b594faf2a550
This commit is contained in:
Lucchetto
2020-09-16 18:48:36 +02:00
committed by jeangraff30
parent e9c28120b4
commit 7ebebdc551
2 changed files with 22 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
//
// Copyright (C) 2019 The LineageOS Project
// Copyright (C) 2019-2020 The LineageOS Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -21,5 +21,8 @@ cc_library_static {
include_dirs: [
"system/core/base/include",
"system/core/init"
],
shared_libs: [
"libbase",
]
}

View File

@@ -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
@@ -42,7 +42,6 @@
#include "property_service.h"
using android::base::GetProperty;
using android::init::property_set;
char const *heapstartsize;
char const *heapgrowthlimit;
@@ -51,17 +50,6 @@ char const *heapminfree;
char const *heapmaxfree;
char const *heaptargetutilization;
void property_override(char const prop[], char const value[], bool add = true)
{
prop_info *pi;
pi = (prop_info*) __system_property_find(prop);
if (pi)
__system_property_update(pi, value, strlen(value));
else if (add)
__system_property_add(prop, strlen(prop), value, strlen(value));
}
void check_device()
{
struct sysinfo sys;
@@ -95,16 +83,27 @@ 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);
// Setting carrier prop
std::string carrier = GetProperty("ro.boot.carrier", "unknown");