From b7df175ea306e863dee8b849b6aaaa357cbb04b5 Mon Sep 17 00:00:00 2001 From: GuaiYiHu Date: Thu, 29 Nov 2018 01:37:09 +0800 Subject: [PATCH] clover: libinit: Set device specific changes via libinit Change-Id: I9a2dea3291b76d185d9ecda524a4234b6ed25412 --- init/init_clover.cpp | 55 ++++++++++++++++++----------- rootdir/bin/init.qcom.early_boot.sh | 16 +-------- 2 files changed, 35 insertions(+), 36 deletions(-) diff --git a/init/init_clover.cpp b/init/init_clover.cpp index 35b16fa..b5e2f66 100755 --- a/init/init_clover.cpp +++ b/init/init_clover.cpp @@ -1,19 +1,29 @@ /* -# -# Copyright 2018 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# + Copyright (c) 2015, The Linux Foundation. All rights reserved. + Copyright (C) 2016 The CyanogenMod 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 @@ -93,17 +103,20 @@ void vendor_load_properties() char const *hw_id_file = "/sys/devices/platform/HardwareInfo/hw_id"; - hw_device = GetProperty("ro.board.variant", ""); - if (hw_device.compare("d9")) { - property_set ( "ro.vendor.product.model", "MI PAD 4"); - } else if (hw_device.compare("d9p")) { - property_set ( "ro.vendor.product.model", "MI PAD 4 PLUS"); - } + platform = GetProperty("ro.board.platform", ""); + if (platform != ANDROID_TARGET) + return; 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("ro.sf.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("ro.sf.lcd_density", "320"); property_override_dual("ro.product.model", "ro.vendor.product.model", "MI PAD 4"); } diff --git a/rootdir/bin/init.qcom.early_boot.sh b/rootdir/bin/init.qcom.early_boot.sh index 2936c85..9ef3cbd 100644 --- a/rootdir/bin/init.qcom.early_boot.sh +++ b/rootdir/bin/init.qcom.early_boot.sh @@ -517,18 +517,4 @@ fi if [ -f /sys/class/kgsl/kgsl-3d0/gpu_available_frequencies ]; then gpu_freq=`cat /sys/class/kgsl/kgsl-3d0/gpu_available_frequencies` 2> /dev/null setprop ro.gpu.available_frequencies "$gpu_freq" -fi - -# set prop for fingerprint identification -hw_id=`cat /sys/devices/platform/HardwareInfo/hw_id` -hw_device=`echo $hw_id | sed -ne 's/^\([^_]*\)_\([^_]*\)_\([^_]*\).*/\3/p'` -case "$hw_device" in - "D9" | "NULL" ) - setprop persist.sys.fp.vendor none - setprop ro.board.variant d9 - ;; - "D9P" ) - setprop persist.sys.fp.vendor fpc - setprop ro.board.variant d9p - ;; -esac +fi \ No newline at end of file