Add check to determine whether or not to switch to TimeKeep

This commit is contained in:
Tad 2017-06-01 05:07:04 -04:00
parent af20268167
commit 7bb915536e

View File

@ -174,6 +174,7 @@ export base;
deblobDevice() { deblobDevice() {
devicePath=$1; devicePath=$1;
cd $base$devicePath; cd $base$devicePath;
if grep -q "time_daemon" *proprietary*.txt; then replaceTime="true" fi; #Enable TimeKeep replacement
if [ -f Android.mk ]; then if [ -f Android.mk ]; then
sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(CMN_SYMLINKS)//' Android.mk; #Remove CMN firmware sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(CMN_SYMLINKS)//' Android.mk; #Remove CMN firmware
sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(DXHDCP2_SYMLINKS)//' Android.mk; #Remove Discretix firmware sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(DXHDCP2_SYMLINKS)//' Android.mk; #Remove Discretix firmware
@ -183,25 +184,31 @@ deblobDevice() {
sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(WV_SYMLINKS)//' Android.mk; #Remove Google Widevine firmware sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(WV_SYMLINKS)//' Android.mk; #Remove Google Widevine firmware
fi; fi;
if [ -f BoardConfig.mk ]; then if [ -f BoardConfig.mk ]; then
if [ -z "$replaceTime" ]; then
sed -i 's/BOARD_USES_QC_TIME_SERVICES := true/BOARD_USES_QC_TIME_SERVICES := false/' BoardConfig.mk; #Switch to Sony TimeKeep sed -i 's/BOARD_USES_QC_TIME_SERVICES := true/BOARD_USES_QC_TIME_SERVICES := false/' BoardConfig.mk; #Switch to Sony TimeKeep
if ! grep -q "BOARD_USES_QC_TIME_SERVICES := false" BoardConfig.mk; then echo "BOARD_USES_QC_TIME_SERVICES := false" >> BoardConfig.mk; fi; #Switch to Sony TimeKeep if ! grep -q "BOARD_USES_QC_TIME_SERVICES := false" BoardConfig.mk; then echo "BOARD_USES_QC_TIME_SERVICES := false" >> BoardConfig.mk; fi; #Switch to Sony TimeKeep
fi;
sed -i 's/BOARD_USES_QCNE := true/BOARD_USES_QCNE := false/' BoardConfig.mk; #Disable CNE sed -i 's/BOARD_USES_QCNE := true/BOARD_USES_QCNE := false/' BoardConfig.mk; #Disable CNE
sed -i 's/BOARD_USES_WIPOWER := true/BOARD_USES_WIPOWER := false/' BoardConfig.mk; #Disable WiPower sed -i 's/BOARD_USES_WIPOWER := true/BOARD_USES_WIPOWER := false/' BoardConfig.mk; #Disable WiPower
fi; fi;
if [ -f device.mk ]; then if [ -f device.mk ]; then
awk -i inplace '!/'$makes'/' device.mk; #Remove all shim references from device makefile awk -i inplace '!/'$makes'/' device.mk; #Remove all shim references from device makefile
if [ -z "$replaceTime" ]; then
#Switch to Sony TimeKeep #Switch to Sony TimeKeep
echo "PRODUCT_PACKAGES += \\" >> device.mk; echo "PRODUCT_PACKAGES += \\" >> device.mk;
echo " timekeep \\" >> device.mk; echo " timekeep \\" >> device.mk;
echo " TimeKeep" >> device.mk; echo " TimeKeep" >> device.mk;
fi; fi;
fi;
if [ -f "${PWD##*/}".mk ] && [ "${PWD##*/}".mk != "sepolicy" ]; then if [ -f "${PWD##*/}".mk ] && [ "${PWD##*/}".mk != "sepolicy" ]; then
awk -i inplace '!/'$makes'/' "${PWD##*/}".mk; #Remove all shim references from device makefile awk -i inplace '!/'$makes'/' "${PWD##*/}".mk; #Remove all shim references from device makefile
if [ -z "$replaceTime" ]; then
#Switch to Sony TimeKeep #Switch to Sony TimeKeep
echo "PRODUCT_PACKAGES += \\" >> device.mk; echo "PRODUCT_PACKAGES += \\" >> device.mk;
echo " timekeep \\" >> device.mk; echo " timekeep \\" >> device.mk;
echo " TimeKeep" >> device.mk; echo " TimeKeep" >> device.mk;
fi; fi;
fi;
if [ -f system.prop ]; then if [ -f system.prop ]; then
sed -i 's/drm.service.enabled=true/drm.service.enabled=false/' system.prop; sed -i 's/drm.service.enabled=true/drm.service.enabled=false/' system.prop;
if ! grep -q "drm.service.enabled=false" system.prop; then echo "drm.service.enabled=false" >> system.prop; fi; #Disable DRM server if ! grep -q "drm.service.enabled=false" system.prop; then echo "drm.service.enabled=false" >> system.prop; fi; #Disable DRM server
@ -246,11 +253,13 @@ deblobDevice() {
sed -i 's|<bool name="config_device_wfc_ims_available">true</bool>|<bool name="config_device_wfc_ims_available">false</bool>|' overlay/frameworks/base/core/res/res/values/config.xml; sed -i 's|<bool name="config_device_wfc_ims_available">true</bool>|<bool name="config_device_wfc_ims_available">false</bool>|' overlay/frameworks/base/core/res/res/values/config.xml;
fi; fi;
if [ -d sepolicy ]; then if [ -d sepolicy ]; then
if [ -z "$replaceTime" ]; then
#Switch to Sony TimeKeep #Switch to Sony TimeKeep
echo "allow system_app time_data_file:dir { create_dir_perms search };" >> sepolicy/system_app.te; echo "allow system_app time_data_file:dir { create_dir_perms search };" >> sepolicy/system_app.te;
echo "allow system_app time_data_file:file create_file_perms;" >> sepolicy/system_app.te; echo "allow system_app time_data_file:file create_file_perms;" >> sepolicy/system_app.te;
fi; fi;
sed -i 's|service time_daemon /system/bin/time_daemon|service timekeep /system/bin/timekeep restore\n oneshot|' init.*.rc rootdir/init.*.rc rootdir/etc/init.*.rc &> /dev/null || true; #Switch to Sony TimeKeep fi;
if [ -z "$replaceTime" ]; then sed -i 's|service time_daemon /system/bin/time_daemon|service timekeep /system/bin/timekeep restore\n oneshot|' init.*.rc rootdir/init.*.rc rootdir/etc/init.*.rc &> /dev/null || true; fi; #Switch to Sony TimeKeep
rm -f rootdir/etc/init.qti.ims.sh #Remove IMS startup script rm -f rootdir/etc/init.qti.ims.sh #Remove IMS startup script
rm -rf IMSEnabler; #Remove IMS compatibility module rm -rf IMSEnabler; #Remove IMS compatibility module
rm -rf data-ipa-cfg-mgr; #Remove IPACM rm -rf data-ipa-cfg-mgr; #Remove IPACM