diff options
| author | Arvin Quilao <arquilao@gmail.com> | 2017-06-15 06:48:54 +0000 |
|---|---|---|
| committer | Rygebin <kaankulahli@gmail.com> | 2017-06-24 09:36:46 +0000 |
| commit | 714296b49f9d97581f502b17f8ee68abd0a3d083 (patch) | |
| tree | 293ff83d98551553b9762e07a00c23c32127ef3a /init | |
| parent | e049ee48c045604d633986701b1c1139c7a6a1cd (diff) | |
seed: Unify Android One variants
The device tree should support all 4 variants of Android One 2nd Gen.
* Use init library to set the corresponding properties and build fingerprints.
* Import additional properties from oem.prop
Change-Id: Ife54224a6fcef177fc29509534ab4a41d4f535e3
Diffstat (limited to 'init')
| -rw-r--r-- | init/init_seed.cpp | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/init/init_seed.cpp b/init/init_seed.cpp new file mode 100644 index 0000000..75334ee --- /dev/null +++ b/init/init_seed.cpp @@ -0,0 +1,90 @@ +/* + Copyright (c) 2017, The LineageOS Project + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of The Linux Foundation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <cstdlib> +#include <fstream> +#include <string> +#include <sys/sysinfo.h> + +#include "vendor_init.h" +#include "property_service.h" +#include "log.h" +#include "util.h" + +#include "init_msm8916.h" + +char const *heapstartsize; +char const *heapgrowthlimit; +char const *heapsize; +char const *heapminfree; + +void check_device() +{ + struct sysinfo sys; + + sysinfo(&sys); + + if (sys.totalram > 1024ull * 1024 * 1024) { + // from - phone-xhdpi-2048-dalvik-heap.mk + heapstartsize = "8m"; + heapgrowthlimit = "192m"; + heapsize = "512m"; + heapminfree = "512k"; + } else { + // from - phone-xhdpi-1024-dalvik-heap.mk + heapstartsize = "8m"; + heapgrowthlimit = "96m"; + heapsize = "256m"; + heapminfree = "2m"; + } +} + +void init_target_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", "0.75"); + property_set("dalvik.vm.heapminfree", heapminfree); + property_set("dalvik.vm.heapmaxfree", "8m"); + + std::string device = property_get("ro.product.device"); + + if (device == "ctih220_sprout") { + property_set("ro.build.fingerprint", "google/ctih220/ctih220_sprout:7.1.1/N4F26W/3815918:user/release-keys"); + } else if (device == "imobileiq2_sprout") { + property_set("ro.build.fingerprint", "google/imobileiq2/imobileiq2_sprout:7.1.1/N4F26W/3815918:user/release-keys"); + } else if (device == "gm4g_sprout") { + property_set("ro.build.fingerprint", "google/gm4g/gm4g_sprout:7.1.1/N4F26W/3815918:user/release-keys"); + } else if (device == "gm4g_s_sprout") { + property_set("ro.build.fingerprint", "google/gm4g_s/gm4g_s_sprout:7.1.1/N4F26W/3815918:user/release-keys"); + } + + property_set("ro.build.description", "seed_l8150-user 7.1.1 N4F26W 3815918 release-keys"); +} |
