Skip to content

Commit

Permalink
Unify Android One variants
Browse files Browse the repository at this point in the history
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: I4173a68aa68d5bc949881dd21cd76511e864b2ad
  • Loading branch information
arvinquilao committed Jun 20, 2017
1 parent 09d6674 commit 2fe0116
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 28 deletions.
3 changes: 3 additions & 0 deletions board/init.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# seed init
TARGET_LIBINIT_MSM8916_DEFINES_FILE := device/google/seed/init/init_seed.cpp
TARGET_UNIFIED_DEVICE := true
90 changes: 90 additions & 0 deletions init/init_seed.cpp
Original file line number Diff line number Diff line change
@@ -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");
}
8 changes: 2 additions & 6 deletions lineage.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,11 @@ $(call inherit-product, vendor/cm/config/common_full_phone.mk)
# Must define platform variant before including any common things
TARGET_BOARD_PLATFORM_VARIANT := msm8916

TARGET_OTA_ASSERT_DEVICE := ctih220_sprout,gm4g_sprout,gm4g_s_sprout,imobileiq2_sprout,seed

PRODUCT_NAME := lineage_seed
PRODUCT_DEVICE := seed
PRODUCT_BRAND := google
PRODUCT_MODEL := seed
PRODUCT_MANUFACTURER := google

PRODUCT_GMS_CLIENTID_BASE := android-google

PRODUCT_BUILD_PROP_OVERRIDES += \
PRODUCT_NAME=seed \
BUILD_FINGERPRINT=google/seed_l8150/seed:7.1.1/N4F26W/3815918:user/release-keys \
PRIVATE_BUILD_DESC="seed_l8150-user 7.1.1 N4F26W 3815918 release-keys"
20 changes: 1 addition & 19 deletions product/display.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,4 @@ PRODUCT_PROPERTY_OVERRIDES += \
PRODUCT_AAPT_CONFIG := normal
PRODUCT_AAPT_PREF_CONFIG := xhdpi

PRODUCT_PROPERTY_OVERRIDES += \
dalvik.vm.heapstartsize=8m \
dalvik.vm.heapsize=256m \
dalvik.vm.heaptargetutilization=0.75 \
dalvik.vm.heapminfree=512k \
dalvik.vm.heapmaxfree=8m

PRODUCT_PROPERTY_OVERRIDES += \
ro.hwui.texture_cache_size=72 \
ro.hwui.layer_cache_size=48 \
ro.hwui.r_buffer_cache_size=8 \
ro.hwui.path_cache_size=32 \
ro.hwui.gradient_cache_size=1 \
ro.hwui.drop_shadow_cache_size=6 \
ro.hwui.texture_cache_flushrate=0.4 \
ro.hwui.text_small_cache_width=1024 \
ro.hwui.text_small_cache_height=1024 \
ro.hwui.text_large_cache_width=2048 \
ro.hwui.text_large_cache_height=1024
$(call inherit-product, frameworks/native/build/phone-xxhdpi-2048-hwui-memory.mk)
3 changes: 3 additions & 0 deletions product/oem.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Delegation for OEM customization
PRODUCT_SYSTEM_PROPERTY_BLACKLIST := \
ro.build.description \
ro.build.fingerprint \
ro.product.device \
ro.product.name \
ro.product.manufacturer \
ro.product.model
3 changes: 1 addition & 2 deletions product/qcom-radio.mk
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Properties
PRODUCT_PROPERTY_OVERRIDES += \
persist.radio.multisim.config=dsds \
persist.radio.custom_ecc=1 \
persist.radio.ecc_hard_1=998 \
persist.radio.ecc_hard_count=1 \
persist.sys.ssr.restart_level=modem \
rild.libpath=/system/vendor/lib/libril-qc-qmi-1.so \
ro.telephony.default_network=9,9
ro.telephony.default_network=9

# RIL
ifeq ($(QCPATH),)
Expand Down
4 changes: 3 additions & 1 deletion system.prop
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
ro.product.model.platform=1

# OEM props
import /oem/oem.prop ro.product.name
import /oem/oem.prop persist.radio.multisim.config
import /oem/oem.prop ro.product.device
import /oem/oem.prop ro.product.manufacturer
import /oem/oem.prop ro.product.model
import /oem/oem.prop ro.product.name

0 comments on commit 2fe0116

Please sign in to comment.