sdm660-common: libinit: Set device specific changes via libinit
Change-Id: I9a2dea3291b76d185d9ecda524a4234b6ed25412
This commit is contained in:
parent
c2d9327ee3
commit
1e1cbb13c4
3 changed files with 45 additions and 0 deletions
|
@ -34,7 +34,9 @@
|
|||
#include <sys/sysinfo.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <android-base/file.h>
|
||||
#include <android-base/properties.h>
|
||||
#include <android-base/strings.h>
|
||||
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
|
||||
#include <sys/_system_properties.h>
|
||||
|
||||
|
@ -44,6 +46,8 @@
|
|||
|
||||
using android::base::GetProperty;
|
||||
using android::init::property_set;
|
||||
using android::base::ReadFileToString;
|
||||
using android::base::Trim;
|
||||
|
||||
char const *heapstartsize;
|
||||
char const *heapgrowthlimit;
|
||||
|
@ -56,6 +60,24 @@ __attribute__ ((weak))
|
|||
void init_target_properties() {}
|
||||
#endif
|
||||
|
||||
void property_override(char const prop[], char const value[])
|
||||
{
|
||||
prop_info *pi;
|
||||
|
||||
pi = (prop_info*) __system_property_find(prop);
|
||||
if (pi)
|
||||
__system_property_update(pi, value, strlen(value));
|
||||
else
|
||||
__system_property_add(prop, strlen(prop), value, strlen(value));
|
||||
}
|
||||
|
||||
void property_override_dual(char const system_prop[],
|
||||
char const vendor_prop[], char const value[])
|
||||
{
|
||||
property_override(system_prop, value);
|
||||
property_override(vendor_prop, value);
|
||||
}
|
||||
|
||||
void check_device()
|
||||
{
|
||||
struct sysinfo sys;
|
||||
|
@ -92,4 +114,25 @@ void vendor_load_properties()
|
|||
property_set("dalvik.vm.heaptargetutilization", "0.75");
|
||||
property_set("dalvik.vm.heapminfree", heapminfree);
|
||||
property_set("dalvik.vm.heapmaxfree", heapmaxfree);
|
||||
|
||||
std::string product = GetProperty("ro.product.name", "");
|
||||
if (product.find("clover") != std::string::npos) {
|
||||
|
||||
std::string hw_device;
|
||||
|
||||
char const *hw_id_file = "/sys/devices/platform/HardwareInfo/hw_id";
|
||||
|
||||
ReadFileToString(hw_id_file, &hw_device);
|
||||
if (hw_device.find("D9P") != std::string::npos) {
|
||||
property_override("persist.sys.fp.vendor", "fpc");
|
||||
property_override("ro.board.variant", "d9p");
|
||||
property_override("vendor.display.lcd_density", "265");
|
||||
property_override_dual("ro.product.model", "ro.vendor.product.model", "MI PAD 4 PLUS");
|
||||
} else {
|
||||
property_override("persist.sys.fp.vendor", "none");
|
||||
property_override("ro.board.variant", "d9");
|
||||
property_override("vendor.display.lcd_density", "320");
|
||||
property_override_dual("ro.product.model", "ro.vendor.product.model", "MI PAD 4");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
1
sepolicy/vendor/init.te
vendored
1
sepolicy/vendor/init.te
vendored
|
@ -4,3 +4,4 @@ allow init ion_device:chr_file ioctl;
|
|||
allow init property_socket:sock_file write;
|
||||
allow init sysfs_dm:file { open write };
|
||||
allow init tee_device:chr_file { write ioctl };
|
||||
allow init vendor_default_prop:property_service set;
|
||||
|
|
1
sepolicy/vendor/property_contexts
vendored
1
sepolicy/vendor/property_contexts
vendored
|
@ -30,3 +30,4 @@ sys.thermal. u:object_r:thermal_engine_prop:s0
|
|||
# vendor_default_prop
|
||||
fpc_kpi u:object_r:vendor_default_prop:s0
|
||||
gpu.stats.debug.level u:object_r:vendor_default_prop:s0
|
||||
vendor.display.lcd_density u:object_r:vendor_default_prop:s0
|
||||
|
|
Loading…
Reference in a new issue