diff --git a/BoardConfig.mk b/BoardConfig.mk index fda3e41..071940c 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -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 diff --git a/configs/check_features.sh b/configs/check_features.sh new file mode 100644 index 0000000..49c69f7 --- /dev/null +++ b/configs/check_features.sh @@ -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 diff --git a/device.mk b/device.mk index 51bc0f9..a18a3ce 100644 --- a/device.mk +++ b/device.mk @@ -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 \ diff --git a/releasetools/releasetools.py b/releasetools/releasetools.py new file mode 100644 index 0000000..68fcec3 --- /dev/null +++ b/releasetools/releasetools.py @@ -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") + \ No newline at end of file