clover: libinit: Set device specific changes via libinit

Change-Id: I9a2dea3291b76d185d9ecda524a4234b6ed25412
This commit is contained in:
GuaiYiHu 2018-11-29 01:37:09 +08:00 committed by Max Weffers
parent 3c6bab5243
commit b7df175ea3
No known key found for this signature in database
GPG key ID: 795F73D22FB93FAE
2 changed files with 35 additions and 36 deletions

View file

@ -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 <stdio.h>
@ -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");
}

View file

@ -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