potter: manage advertised features for XT1687

* Drop unneeded features after flash using releasetools
This commit is contained in:
Vachounet
2017-05-23 09:54:02 +02:00
parent 0016b82a8f
commit 1c6db0a43f
4 changed files with 48 additions and 0 deletions

View File

@@ -147,6 +147,9 @@ TARGET_RECOVERY_FSTAB := $(DEVICE_PATH)/rootdir/etc/fstab.qcom
TARGET_USERIMAGES_USE_EXT4 := true
TARGET_USERIMAGES_USE_F2FS := true
# Releasetools
TARGET_RELEASETOOLS_EXTENSIONS := $(DEVICE_PATH)/releasetools
# SELinux
include device/qcom/sepolicy/sepolicy.mk
BOARD_SEPOLICY_DIRS += $(DEVICE_PATH)/sepolicy

13
configs/check_features.sh Normal file
View File

@@ -0,0 +1,13 @@
#!/sbin/sh
sku=`getprop ro.boot.hardware.sku`
if [ "$sku" = "XT1687" ]; then
# XT1687 doesn't have NFC chip
rm /system/etc/permissions/android.hardware.nfc.xml
rm /system/etc/permissions/android.hardware.nfc.hce.xml
rm /system/etc/permissions/com.android.nfc_extras.xml
else
# Only XT1687 variant got a compass
rm /system/etc/permissions/android.hardware.sensor.compass.xml
fi

View File

@@ -250,6 +250,10 @@ PRODUCT_PACKAGES += \
init.qcom.rc \
ueventd.qcom.rc
# Releasetools script
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/check_features.sh:install/bin/check_features.sh
# RIL
PRODUCT_PACKAGES += \
librmnetctl \

View File

@@ -0,0 +1,28 @@
# Copyright (C) 2016 The CyanogenMod Project
# Copyright (C) 2017 The LineageOS 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.
def IncrementalOTA_InstallEnd(info):
ReplaceDeviceConfig(info)
def FullOTA_InstallEnd(info):
ReplaceDeviceConfig(info)
def ReplaceDeviceConfig(info):
info.script.Mount("/system")
info.script.AppendExtra('ui_print("Checking NFC and compass support");')
info.script.AppendExtra('run_program("/sbin/sh", "/tmp/install/bin/check_features.sh");')
info.script.Unmount("/system")