2017-02-15 17:06:25 -05:00
#!/bin/bash
2017-11-05 10:58:01 -05:00
#DivestOS: A privacy oriented Android distribution
2017-06-04 09:29:47 -04:00
#Copyright (c) 2017 Spot Communications, Inc.
2017-11-05 10:58:01 -05:00
#
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program. If not, see <https://www.gnu.org/licenses/>.
2017-02-15 17:06:25 -05:00
2017-02-15 17:15:00 -05:00
#Goal: Remove as many proprietary blobs without breaking core functionality
#Outcome: Increased battery/performance/privacy/security, Decreased ROM size
2017-06-06 21:18:51 -04:00
#TODO: Clean init*.rc files, Modularize, Remove more variants
2017-02-15 17:15:00 -05:00
#
2017-06-06 21:18:51 -04:00
#Device Status (Tested under LineageOS 14.1)
2017-02-15 17:15:00 -05:00
#
2017-07-13 23:46:31 -04:00
#Functioning as Expected: bacon, clark, mako, marlin, sailfish, thor
2017-02-15 17:15:00 -05:00
2017-10-21 09:10:23 -04:00
echo "Deblobbing..."
2017-02-15 17:06:25 -05:00
#
#START OF BLOBS ARRAY
#
2017-06-23 15:44:33 -04:00
#WARNING: STRAY DELIMITERS WILL RESULT IN FILE DELETIONS
2017-06-05 23:04:51 -04:00
blobs = "" ; #Delimited using "|"
2017-05-13 13:43:00 -04:00
makes = "" ;
2017-06-23 15:44:33 -04:00
overlay = "" ;
2017-06-05 23:04:51 -04:00
kernels = "" ; #Delimited using " "
2017-02-15 17:06:25 -05:00
2017-05-05 19:54:06 -04:00
#ACDB (Audio Configurations) [Qualcomm] XXX: Breaks audio output
2017-02-21 12:24:14 -05:00
#blobs=$blobs"acdb";
2017-05-05 19:54:06 -04:00
#ADSP/Hexagon (Hardware Audio Decoding) [Qualcomm]
2017-02-21 12:24:14 -05:00
#blobs=$blobs"adsprpcd|libadsprpc.so|libadsprpc.so|libfastcvadsp_stub.so|libfastcvopt.so|libadsp_fd_skel.so";
2017-05-05 19:54:06 -04:00
#Alipay (Payment Platform) [Alibaba]
2017-02-19 17:58:45 -05:00
blobs = $blobs "alipay.b00|alipay.b01|alipay.b02|alipay.b03|alipay.b04|alipay.b05|alipay.b06|alipay.mdt" ;
2017-05-05 19:54:06 -04:00
#aptX (Bluetooth Audio Compression Codec) [Qualcomm]
2017-02-19 17:58:45 -05:00
blobs = $blobs "|libaptX-1.0.0-rel-Android21-ARMv7A.so|libaptXHD-1.0.0-rel-Android21-ARMv7A.so|libaptXScheduler.so" ;
2017-02-19 17:45:27 -05:00
2017-05-31 16:18:43 -04:00
#ATFWD [Qualcomm]
2017-02-19 17:45:27 -05:00
blobs = $blobs "|ATFWD-daemon|atfwd.apk" ;
2017-02-15 17:06:25 -05:00
2017-05-05 19:54:06 -04:00
#AudioFX (Audio Effects) [Qualcomm]
2017-02-21 15:52:15 -05:00
blobs = $blobs "|libqcbassboost.so|libqcreverb.so|libqcvirt.so" ;
2017-02-21 12:58:19 -05:00
2017-06-04 08:07:50 -04:00
#Camera
2017-06-21 00:33:29 -04:00
#Attempted, don't waste your time...
2017-02-21 12:58:19 -05:00
#FUN FACT: The Huawei Honor 5x ships with eight-hundred-and-thirty-five (*835*) proprietary camera blobs.
2017-02-21 12:24:14 -05:00
#blobs=$blobs"|";
2017-02-19 17:58:45 -05:00
2017-05-05 19:54:06 -04:00
#Clearkey (DRM) [Google]
2017-02-15 20:52:03 -05:00
blobs = $blobs "|libdrmclearkeyplugin.so" ;
2017-06-28 22:17:21 -04:00
#CMN (TrustZone?) [Qualcomm?]
2017-07-05 07:29:04 -04:00
#blobs=$blobs"|cmnlib.b00|cmnlib.b01|cmnlib.b02|cmnlib.b03|cmnlib.b04|cmnlib.b05|cmnlib.flist|cmnlib.mdt|cmnlib64.b00|cmnlib64.b01|cmnlib64.b02|cmnlib64.b03|cmnlib64.b04|cmnlib64.b05|cmnlib64.flist|cmnlib64.mdt";
2017-02-19 17:58:45 -05:00
2017-05-05 19:54:06 -04:00
#CNE (Automatic Cell/Wi-Fi Switching) [Qualcomm]
2017-06-29 21:26:07 -04:00
#blobs=$blobs"|libcneapiclient.so|libNimsWrap.so"; #XXX: Breaks radio
blobs = $blobs "|andsfCne.xml|ATT_profile1.xml|ATT_profile2.xml|ATT_profile3.xml|ATT_profile4.xml|ATT_profiles.xml|cnd|cneapiclient.jar|cneapiclient.xml|CNEService.apk|com.quicinc.cne.jar|com.quicinc.cne.xml|ConnectivityExt.jar|ConnectivityExt.xml|libcneconn.so|libcneqmiutils.so|libcne.so|libvendorconn.so|libwqe.so|profile1.xml|profile2.xml|profile3.xml|profile4.xml|profile5.xml|ROW_profile1.xml|ROW_profile2.xml|ROW_profile3.xml|ROW_profile4.xml|ROW_profile5.xml|ROW_profiles.xml|SwimConfig.xml|VZW_profile1.xml|VZW_profile2.xml|VZW_profile3.xml|VZW_profile4.xml|VZW_profile5.xml|VZW_profile6.xml|VZW_profiles.xml" ;
2017-05-13 14:02:31 -04:00
makes = $makes "libcnefeatureconfig" ;
2017-02-15 17:06:25 -05:00
2017-05-05 19:54:06 -04:00
#Diagnostics [Qualcomm]
2017-02-15 17:06:25 -05:00
blobs = $blobs "|[/]diag[/]|diag_callback_client|diag_dci_sample|diag_klog|diag_mdlog|diag_mdlog-getlogs|diag_mdlog-wrap|diag[/]mdm|diag_qshrink4_daemon|diag_socket_log|diag_uart_log|drmdiagapp|ibdrmdiag.so|ssr_diag|test_diag" ;
2017-06-18 11:16:46 -04:00
#Dirac (Audio Effects) [Dirac]
2017-06-25 11:24:45 -04:00
blobs = $blobs "|diracmobile.config|libDiracAPI_SHARED.so|libdirac.so|libdirac-appi.so" ;
2017-06-18 11:16:46 -04:00
2017-05-05 19:54:06 -04:00
#Discretix (DRM/HDCP) [Discretix Technologies]
2017-07-05 07:29:04 -04:00
blobs = $blobs "|discretix|DxHDCP.cfg|libDxHdcp.so" ;
blobs = $blobs "|dxhdcp2.b00|dxhdcp2.b01|dxhdcp2.b02|dxhdcp2.b03|dxhdcp2.mdt" ;
2017-11-05 14:30:15 -05:00
blobs = $blobs "|dxcprm.b00|dxcprm.b01|dxcprm.b02|dxcprm.b03|dxcprm.mdt" ;
2017-02-15 17:06:25 -05:00
2017-05-05 19:54:06 -04:00
#Display Color Tuning [Qualcomm]
2017-05-05 20:01:29 -04:00
blobs = $blobs "|colorservice.apk|com.qti.snapdragon.sdk.display.jar|com.qti.snapdragon.sdk.display.xml|libdisp-aba.so|libmm-abl-oem.so|libmm-abl.so|libmm-als.so|libmm-color-convertor.so|libmm-disp-apis.so|libmm-qdcm.so|libsd_sdk_display.so|mm-pp-daemon|mm-pp-dpps|PPPreference.apk" ;
2017-02-21 12:58:19 -05:00
2017-05-05 19:54:06 -04:00
#DivX (DRM) [DivX]
2017-02-15 17:06:25 -05:00
blobs = $blobs "|libDivxDrm.so|libSHIMDivxDrm.so" ;
2017-05-05 19:54:06 -04:00
#DPM (Data Power Management) [Qualcomm]
2017-02-15 17:06:25 -05:00
blobs = $blobs "|com.qti.dpmframework.jar|com.qti.dpmframework.xml|dpmapi.jar|dpmapi.xml|dpm.conf|dpmd|dpmserviceapp.apk|libdpmctmgr.so|libdpmfdmgr.so|libdpmframework.so|libdpmnsrm.so|libdpmtcm.so|NsrmConfiguration.xml|tcmclient.jar" ;
2017-02-25 23:55:50 -05:00
#DRM
blobs = $blobs "|lib-sec-disp.so|libSecureUILib.so|libsecureui.so|libsecureuisvc_jni.so|libsecureui_svcsock.so" ;
2017-10-03 05:41:25 -04:00
blobs = $blobs "|liboemcrypto.so|libtzdrmgenprov.so" ;
blobs = $blobs "|libpvr.so|librmp.so|libsi.so|libSSEPKCS11.so" ;
2017-02-15 17:06:25 -05:00
2017-05-05 19:54:06 -04:00
#Face Unlock [Google]
2017-04-17 16:36:49 -04:00
blobs = $blobs "|libfacenet.so|libfilterpack_facedetect.so|libfrsdk.so" ;
2017-05-05 19:54:06 -04:00
#GPS [Qualcomm]
2017-02-15 17:06:25 -05:00
#blobs=$blobs"|flp.conf|flp.default.so|flp.msm8084.so|flp.msm8960.so|gpsd|gps.msm8084.so|gps.msm8960.so|libflp.so|libgps.utils.so|libloc_api_v02.so|libloc_core.so|libloc_ds_api.so|libloc_eng.so|libloc_ext.so";
#HDCP (DRM)
2017-07-05 07:29:04 -04:00
blobs = $blobs "|libmm-hdcpmgr.so" ;
blobs = $blobs "|hdcp1.b00|hdcp1.b01|hdcp1.b02|hdcp1.b03|hdcp1.b04|hdcp1.b05|hdcp1.b06|hdcp1.mdt|tzhdcp.b00|tzhdcp.b01|tzhdcp.b02|tzhdcp.b03|tzhdcp.mdt" ;
2017-02-15 17:06:25 -05:00
2017-05-05 19:54:06 -04:00
#[HTC]
2017-07-05 07:29:04 -04:00
blobs = $blobs "|gptauuid.xml" ;
blobs = $blobs "|htc_drmprov.b00|htc_drmprov.b01|htc_drmprov.b02|htc_drmprov.b03|htc_drmprov.b04|htc_drmprov.b05|htc_drmprov.b06|htc_drmprov.mdt|gpsample.mbn" ;
2017-02-19 17:45:27 -05:00
2017-05-05 19:54:06 -04:00
#I/O Prefetcher [Qualcomm]
2017-06-29 15:47:37 -04:00
blobs = $blobs "|libqc-opt.so" ;
blobs = $blobs "|iop|libqti-iop-client.so|libqti-iop.so|QPerformance.jar" ;
2017-02-21 12:58:19 -05:00
2017-06-05 23:30:53 -04:00
#IMS (VoLTE/Wi-Fi Calling) [Qualcomm]
2017-06-21 00:33:29 -04:00
#blobs=$blobs"|ims.apk|ims.xml|libimsmedia_jni.so"; #IMS (Core) (To support carriers that have phased out 2G)
blobs = $blobs "|imscmlibrary.jar|imscmservice|imscm.xml|imsdatadaemon|imsqmidaemon|imssettings.apk|lib-imsdpl.so|lib-imscamera.so|libimscamera_jni.so|lib-imsqimf.so|lib-imsSDP.so|lib-imss.so|lib-imsvt.so|lib-imsxml.so" ; #IMS
2017-06-05 23:04:51 -04:00
blobs = $blobs "|ims_rtp_daemon|lib-rtpcommon.so|lib-rtpcore.so|lib-rtpdaemoninterface.so|lib-rtpsl.so" ; #RTP
2017-06-21 00:33:29 -04:00
blobs = $blobs "|lib-dplmedia.so|librcc.so|libvcel.so|libvoice-svc.so|qti_permissions.xml" ; #Misc.
#blobs=$blobs"|volte_modem[/]";
2017-05-01 02:49:57 -04:00
2017-06-05 14:35:40 -04:00
#IPA (Internet Packet Accelerator) [Qualcomm]
2017-06-06 21:48:32 -04:00
#This is actually open source (excluding -diag)
2017-06-05 23:30:53 -04:00
#blobs=$blobs"|ipacm";
2017-06-05 14:35:40 -04:00
blobs = $blobs "|ipacm-diag" ;
2017-06-05 23:30:53 -04:00
#makes=$makes"|ipacm|IPACM_cfg.xml";
#kernels=$kernels" drivers/platform/msm/ipa";
2017-02-15 17:06:25 -05:00
2017-06-21 00:33:29 -04:00
#Keystore/TrustZone (HW Crypto) [Qualcomm]
2017-07-02 23:29:47 -04:00
#blobs=$blobs"|qseecomd|keystore.qcom.so|libdrmdecrypt.so|libdrmfs.so|libdrmtime.so|libQSEEComAPI.so|librpmb.so|libssd.so";
2017-07-05 07:29:04 -04:00
#blobs=$blobs"|keymaster.b00|keymaster.b01|keymaster.b02|keymaster.b03|keymaster.flist|keymaster.mdt";
#blobs=$blobs"|tzapps.b00|tzapps.b01|tzapps.b02|tzapps.b03|tzapps.mdt";
2017-06-21 00:33:29 -04:00
2017-05-05 19:54:06 -04:00
#Location (gpsOne/gpsOneXTRA/IZat/Lumicast/QUIP) [Qualcomm]
2017-11-06 17:15:01 -05:00
blobs = $blobs "|cacert_location.pem|com.qti.location.sdk.jar|com.qti.location.sdk.xml|com.qualcomm.location.apk|com.qualcomm.location.xml|com.qualcomm.services.location.apk|gpsone_daemon|izat.conf|izat.xt.srv.jar|izat.xt.srv.xml|libalarmservice_jni.so|libasn1cper.so|libasn1crt.so|libasn1crtx.so|libdataitems.so|libdrplugin_client.so|libDRPlugin.so|libevent_observer.so|libgdtap.so|libgeofence.so|libizat_core.so|liblbs_core.so|liblocationservice_glue.so|liblocationservice.so|libloc_ext.so|libloc_xtra.so|liblowi_client.so|liblowi_wifihal_nl.so|liblowi_wifihal.so|libquipc_os_api.so|libquipc_ulp_adapter.so|libulp2.so|libxtadapter.so|libxt_native.so|libxtwifi_ulp_adaptor.so|libxtwifi_zpp_adaptor.so|location-mq|loc_launcher|lowi.conf|lowi-server|slim_ap_daemon|slim_daemon|xtra_root_cert.pem|xtra_t_app.apk|xtwifi.conf|xtwifi-client|xtwifi-inet-agent" ;
2017-06-23 15:44:33 -04:00
overlay = $overlay "config_comboNetworkLocationProvider|config_enableFusedLocationOverlay|config_enableNetworkLocationOverlay|config_fusedLocationProviderPackageName|config_enableNetworkLocationOverlay|config_networkLocationProviderPackageName|com.qualcomm.location" ;
2017-02-15 17:06:25 -05:00
#Misc
2017-02-21 12:04:27 -05:00
blobs = $blobs "|libjni_latinime.so|libuiblur.so|libwifiscanner.so" ;
2017-02-15 17:06:25 -05:00
2017-05-05 19:54:06 -04:00
#[Motorola]
2017-06-05 22:52:42 -04:00
blobs = $blobs "|AppDirectedSMSProxy.apk|BuaContactAdapter.apk|batt_health|com.motorola.DirectedSMSProxy.xml|com.motorola.motosignature.jar|com.motorola.motosignature.xml|com.motorola.camera.xml|com.motorola.gallery.xml|com.motorola.msimsettings.xml|com.motorola.triggerenroll.xml|MotoDisplayFWProxy.apk|MotoSignatureApp.apk|TriggerEnroll.apk|TriggerTrainingService.apk" ;
2017-05-13 13:43:00 -04:00
makes = $makes "|com.motorola.cameraone.xml" ;
2017-02-15 17:06:25 -05:00
2017-05-31 23:57:26 -04:00
#Performance [Qualcomm]
2017-06-06 21:18:51 -04:00
#blobs=$blobs"|msm_irqbalance";
2017-06-21 00:33:29 -04:00
#Devices utilizing perfd won't hotplug cores without it
#Attempted to replace this with showp1984's msm_mpdecision, but the newer kernels simply don't have the mach_msm dependencies that are needed
2017-06-02 00:45:21 -04:00
#blobs=$blobs"|mpdecision|libqti-perfd-client.so|perfd|perf-profile0.conf|perf-profile1.conf|perf-profile2.conf|perf-profile3.conf|perf-profile4.conf|perf-profile5.conf";
2017-05-05 19:54:06 -04:00
#Playready (DRM) [Microsoft]
blobs = $blobs "|playread.b00|playread.b01|playread.b02|playread.b03|playread.mdt" ;
2017-02-21 12:58:19 -05:00
2017-05-05 19:54:06 -04:00
#Project Fi [Google]
blobs = $blobs "|Tycho.apk" ;
2017-05-05 20:01:29 -04:00
#Quickboot [Qualcomm]
blobs = $blobs "|QuickBoot.apk" ;
2017-05-05 19:54:06 -04:00
#QTI (Tethering Extensions) [Qualcomm]
2017-02-19 18:16:41 -05:00
blobs = $blobs "|libQtiTether.so|QtiTetherService.apk" ;
2017-02-15 17:06:25 -05:00
2017-06-05 23:30:53 -04:00
#RCS (Proprietary messaging protocol)
blobs = $blobs "|rcsimssettings.jar|rcsimssettings.xml|rcsservice.jar|rcsservice.xml|lib-imsrcscmclient.so|lib-ims-rcscmjni.so|lib-imsrcscmservice.so|lib-imsrcscm.so|lib-imsrcs.so|lib-rcsimssjni.so|lib-rcsjni.so" ; #RCS
2017-05-31 16:18:43 -04:00
#SecProtect [Qualcomm]
blobs = $blobs "|SecProtect.apk" ;
2017-11-05 18:39:54 -05:00
#SecureUI Frontends
blobs = $blobs "|libHealthAuthClient.so|libHealthAuthJNI.so|libSampleAuthJNI.so|libSampleAuthJNIv1.so|libSampleExtAuthJNI.so|libSecureExtAuthJNI.so|libSecureSampleAuthClient.so" ;
2017-05-05 19:54:06 -04:00
#SoundFX [Sony]
blobs = $blobs "|libsonypostprocbundle.so|libsonysweffect.so" ;
#[Sprint]
2017-02-15 17:06:25 -05:00
blobs = $blobs "|com.android.omadm.service.xml|ConnMO.apk|CQATest.apk|DCMO.apk|DiagMon.apk|DMConfigUpdate.apk|DMService.apk|GCS.apk|HiddenMenu.apk|libdmengine.so|libdmjavaplugin.so|LifetimeData.apk|SprintDM.apk|SprintHM.apk|whitelist_com.android.omadm.service.xml" ;
2017-05-05 19:54:06 -04:00
#Thermal Throttling [Qualcomm]
2017-02-21 12:58:19 -05:00
#blobs=$blobs"|libthermalclient.so|libthermalioctl.so|thermal-engine";
2017-06-01 16:44:52 -04:00
#Time Service [Qualcomm]
2017-06-06 21:48:32 -04:00
#Requires that https://github.com/LineageOS/android_hardware_sony_timekeep be included in repo manifest
2017-06-01 16:44:52 -04:00
#blobs=$blobs"|libtime_genoff.so"; #XXX: Breaks radio
2017-07-01 19:54:38 -04:00
#blobs=$blobs"|libTimeService.so|time_daemon|TimeService.apk";
2017-02-15 17:06:25 -05:00
2017-05-05 19:54:06 -04:00
#Venus (Hardware Video Decoding) [Qualcomm]
2017-02-19 18:46:42 -05:00
#blobs=$blobs"|venus.b00|venus.b01|venus.b02|venus.b03|venus.b04|venus.mbn|venus.mdt";
2017-05-05 19:54:06 -04:00
#[Verizon]
2017-06-05 23:04:51 -04:00
blobs = $blobs "|com.qualcomm.location.vzw_library.jar|com.qualcomm.location.vzw_library.xml|com.verizon.apn.xml|com.verizon.embms.xml|com.verizon.hardware.telephony.ehrpd.jar|com.verizon.hardware.telephony.ehrpd.xml|com.verizon.hardware.telephony.lte.jar|com.verizon.hardware.telephony.lte.xml|com.verizon.ims.jar|com.verizon.ims.xml|com.verizon.provider.xml|com.vzw.vzwapnlib.xml|qti-vzw-ims-internal.jar|qti-vzw-ims-internal.xml|VerizonUnifiedSettings.jar|VZWAPNLib.apk|VZWAPNService.apk|VZWAVS.apk|VzwLcSilent.apk|vzw_msdc_api.apk|VzwOmaTrigger.apk|vzw_sso_permissions.xml" ;
2017-02-15 17:06:25 -05:00
#Voice Recognition
2017-10-04 08:15:36 -04:00
blobs = $blobs "|aonvr1.bin|aonvr2.bin|audiomonitor|es305_fw.bin|HotwordEnrollment.apk|HotwordEnrollmentRT5677.apk|libadpcmdec.so|liblistenhardware.so|liblistenjni.so|liblisten.so|liblistensoundmodel.so|libqvop-service.so|librecoglib.so|libsmwrapper.so|libsupermodel.so|libtrainingcheck.so|qvop-daemon|sound_trigger.primary.msm8916.so|sound_trigger.primary.msm8996.so" ;
2017-02-15 17:06:25 -05:00
2017-05-05 19:54:06 -04:00
#Vulkan [Qualcomm]
#blobs=$blobs"|libllvm-qgl.so|vulkan.msm*.so";
2017-05-31 16:18:43 -04:00
#Wfd (Wireless Display) [Qualcomm]
blobs = $blobs "|libmmparser_lite.so|libmmrtpdecoder.so|libmmrtpencoder.so|libmmwfdinterface.so|libmmwfdsinkinterface.so|libmmwfdsrcinterface.so|libwfdavenhancements.so|libwfdcommonutils.so|libwfdhdcpcp.so|libwfdmmsink.so|libwfdmmsrc.so|libwfdmmutils.so|libwfdnative.so|libwfdrtsp.so|libwfdservice.so|libwfdsm.so|libwfduibcinterface.so|libwfduibcsinkinterface.so|libwfduibcsink.so|libwfduibcsrcinterface.so|libwfduibcsrc.so|WfdCommon.jar|wfdconfigsink.xml|wfdconfig.xml|wfdservice|WfdService.apk" ;
2017-05-05 19:54:06 -04:00
#Widevine (DRM) [Google]
2017-07-05 07:29:04 -04:00
blobs = $blobs "|com.google.widevine.software.drm.jar|com.google.widevine.software.drm.xml|libdrmclearkeyplugin.so|libdrmwvmplugin.so|libmarlincdmplugin.so|libwvdrmengine.so|libwvdrm_L1.so|libwvdrm_L3.so|libwvm.so|libWVphoneAPI.so|libWVStreamControlAPI_L1.so|libWVStreamControlAPI_L3.so" ;
blobs = $blobs "|tzwidevine.b00|tzwidevine.b01|tzwidevine.b02|tzwidevine.b03|tzwidevine.mdt|tzwvcpybuf.b00|tzwvcpybuf.b01|tzwvcpybuf.b02|tzwvcpybuf.b03|tzwvcpybuf.flist|tzwvcpybuf.mdt|widevine.b00|widevine.b01|widevine.b02|widevine.b03|widevine.b04|widevine.b05|widevine.b06|widevine.mbn|widevine.mdt" ;
2017-05-13 13:43:00 -04:00
makes = $makes "|libshim_wvm" ;
2017-05-05 19:54:06 -04:00
#WiPower (Wireless Charging) [Qualcomm]
blobs = $blobs "|a4wpservice.apk|com.quicinc.wbc.jar|com.quicinc.wbcserviceapp.apk|com.quicinc.wbcservice.jar|com.quicinc.wbcservice.xml|com.quicinc.wbc.xml|libwbc_jni.so|wbc_hal.default.so" ;
2017-05-31 23:57:26 -04:00
makes = $makes "|android.wipower|android.wipower.xml|com.quicinc.wbcserviceapps|libwipower_jni|wipowerservice" ;
2017-05-05 19:54:06 -04:00
2017-02-15 17:06:25 -05:00
export blobs;
2017-05-31 23:57:26 -04:00
export makes;
2017-06-23 15:44:33 -04:00
export overlay;
2017-06-05 22:52:42 -04:00
export kernels;
2017-02-15 17:06:25 -05:00
#
#END OF BLOBS ARRAY
#
#
#START OF FUNCTIONS
#
deblobDevice( ) {
devicePath = $1 ;
cd $base $devicePath ;
2017-06-30 13:01:10 -04:00
if [ " ${ PWD ##*/ } " = = "flo" ] || [ " ${ PWD ##*/ } " = = "mako" ] || [ " ${ PWD ##*/ } " = = "kona-common" ] || [ " ${ PWD ##*/ } " = = "n5110" ] || [ " ${ PWD ##*/ } " = = "smdk4412-common" ] || [ " ${ PWD ##*/ } " = = "hdx-common" ] || [ " ${ PWD ##*/ } " = = "thor" ] || [ " ${ PWD ##*/ } " = = "flounder" ] ; then #Some devices don't need/like TimeKeep
2017-06-01 16:44:52 -04:00
replaceTime = "false" ;
fi ;
2017-07-01 19:54:38 -04:00
replaceTime = "false" ; #Temp disable replacement
2017-03-15 06:22:24 -04:00
if [ -f Android.mk ] ; then
2017-06-21 18:53:55 -04:00
#Some devices store these in a dedicated firmware partition, others in /system/vendor/firmware, either way the following are just symlinks
2017-06-28 22:17:21 -04:00
#sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(CMN_SYMLINKS)//' Android.mk; #Remove CMN firmware
2017-03-15 10:29:38 -04:00
sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(DXHDCP2_SYMLINKS)//' Android.mk; #Remove Discretix firmware
2017-06-05 23:16:35 -04:00
#sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(IMS_SYMLINKS)//' Android.mk; #Remove IMS firmware
2017-03-15 10:29:38 -04:00
sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(PLAYREADY_SYMLINKS)//' Android.mk; #Remove Microsoft Playready firmware
sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(WIDEVINE_SYMLINKS)//' Android.mk; #Remove Google Widevine firmware
sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(WV_SYMLINKS)//' Android.mk; #Remove Google Widevine firmware
2017-03-15 06:22:24 -04:00
fi ;
2017-02-15 17:06:25 -05:00
if [ -f BoardConfig.mk ] ; then
2017-06-01 16:44:52 -04:00
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
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 ;
2017-02-15 17:15:00 -05:00
sed -i 's/BOARD_USES_QCNE := true/BOARD_USES_QCNE := false/' BoardConfig.mk; #Disable CNE
2017-05-05 20:01:29 -04:00
sed -i 's/BOARD_USES_WIPOWER := true/BOARD_USES_WIPOWER := false/' BoardConfig.mk; #Disable WiPower
2017-02-15 17:06:25 -05:00
fi ;
2017-05-31 23:57:26 -04:00
if [ -f device.mk ] ; then
awk -i inplace '!/' $makes '/' device.mk; #Remove all shim references from device makefile
2017-06-01 16:44:52 -04:00
if [ -z " $replaceTime " ] ; then
#Switch to Sony TimeKeep
echo "PRODUCT_PACKAGES += \\" >> device.mk;
echo " timekeep \\" >> device.mk;
echo " TimeKeep" >> device.mk;
fi ;
2017-05-31 23:57:26 -04:00
fi ;
2017-06-01 00:57:19 -04:00
if [ -f " ${ PWD ##*/ } " .mk ] && [ " ${ PWD ##*/ } " .mk != "sepolicy" ] ; then
2017-05-31 23:57:26 -04:00
awk -i inplace '!/' $makes '/' " ${ PWD ##*/ } " .mk; #Remove all shim references from device makefile
2017-06-01 16:44:52 -04:00
if [ -z " $replaceTime " ] ; then
#Switch to Sony TimeKeep
echo "PRODUCT_PACKAGES += \\" >> " ${ PWD ##*/ } " .mk;
echo " timekeep \\" >> " ${ PWD ##*/ } " .mk;
echo " TimeKeep" >> " ${ PWD ##*/ } " .mk;
fi ;
2017-05-31 23:57:26 -04:00
fi ;
2017-02-15 17:06:25 -05:00
if [ -f system.prop ] ; then
2017-06-23 15:44:33 -04:00
awk -i inplace '!/persist.loc.nlp_name/' system.prop; #Disable QC Location Provider
2017-05-29 22:38:33 -04:00
sed -i 's/drm.service.enabled=true/drm.service.enabled=false/' system.prop;
2017-05-05 20:01:29 -04:00
if ! grep -q "drm.service.enabled=false" system.prop; then echo "drm.service.enabled=false" >> system.prop; fi ; #Disable DRM server
2017-02-19 18:46:42 -05:00
sed -i 's/persist.bt.enableAptXHD=true/persist.bt.enableAptXHD=false/' system.prop; #Disable aptX
2017-02-15 17:15:00 -05:00
sed -i 's/persist.cne.feature=./persist.cne.feature=0/' system.prop; #Disable CNE
sed -i 's/persist.dpm.feature=./persist.dpm.feature=0/' system.prop; #Disable DPM
2017-06-01 16:44:52 -04:00
sed -i 's/persist.gps.qc_nlp_in_use=./persist.gps.qc_nlp_in_use=0/' system.prop; #Disable QC Location Provider
2017-05-17 14:32:43 -04:00
sed -i 's/persist.sys.dpmd.nsrm=./persist.sys.dpmd.nsrm=0/' system.prop; #Disable DPM
2017-06-05 23:30:53 -04:00
sed -i 's/persist.rcs.supported=./persist.rcs.supported=0/' system.prop; #Disable RCS
2017-05-05 20:01:29 -04:00
sed -i 's/ro.bluetooth.emb_wp_mode=true/ro.bluetooth.emb_wp_mode=false/' system.prop; #Disable WiPower
sed -i 's/ro.bluetooth.wipower=true/ro.bluetooth.wipower=false/' system.prop; #Disable WiPower
2017-05-01 13:42:43 -04:00
#Disable IMS
2017-06-05 23:16:35 -04:00
#sed -i 's/persist.data.iwlan.enable=true/persist.data.iwlan.enable=false/' system.prop;
#sed -i 's/persist.ims.volte=true/persist.ims.volte=false/' system.prop;
#sed -i 's/persist.ims.vt=true/persist.ims.vt=false/' system.prop;
#sed -i 's/persist.radio.calls.on.ims=true/persist.radio.calls.on.ims=false/' system.prop;
#sed -i 's/persist.radio.hw_mbn_update=./persist.radio.hw_mbn_update=0/' system.prop;
#sed -i 's/persist.radio.jbims=./persist.radio.jbims=0/' system.prop;
#sed -i 's/persist.radio.sw_mbn_update=./persist.radio.sw_mbn_update=0/' system.prop;
#sed -i 's/persist.radio.sw_mbn_volte=./persist.radio.sw_mbn_volte=0/' system.prop;
#sed -i 's/persist.radio.VT_ENABLE=./persist.radio.VT_ENABLE=0/' system.prop;
#sed -i 's/persist.radio.VT_HYBRID_ENABLE=./persist.radio.VT_HYBRID_ENABLE=0/' system.prop;
#sed -i 's/persist.volte_enabled_by_hw=./persist.volte_enabled_by_hw=0/' system.prop;
2017-02-15 17:06:25 -05:00
fi ;
2017-06-25 11:24:45 -04:00
if [ -f configs/qmi_config.xml ] ; then
sed -i 's|name="dpm_enabled" type="int"> 1 <|name="dpm_enabled" type="int"> 0 <|' configs/qmi_config.xml; #Disable DPM
fi ;
2017-05-01 19:20:20 -04:00
if [ -f init/init_*.cpp ] ; then
2017-06-05 23:54:15 -04:00
sed -i 's/property_set("persist.rcs.supported", ".");/property_set("persist.rcs.supported", "0");/' init/init_*.cpp; #Disable RCS
2017-05-01 19:20:20 -04:00
#Disable IMS
2017-06-05 23:16:35 -04:00
#sed -i 's/property_set("persist.ims.volte", "true");/property_set("persist.ims.volte", "false");/' init/init_*.cpp;
#sed -i 's/property_set("persist.ims.vt", "true");/property_set("persist.ims.vt", "false");/' init/init_*.cpp;
#sed -i 's/property_set("persist.radio.calls.on.ims", "true");/property_set("persist.radio.calls.on.ims", "false");/' init/init_*.cpp;
#sed -i 's/property_set("persist.radio.jbims", ".");/property_set("persist.radio.jbims", "0");/' init/init_*.cpp;
#sed -i 's/property_set("persist.radio.VT_ENABLE", ".");/property_set("persist.radio.VT_ENABLE", "0");/' init/init_*.cpp;
#sed -i 's/property_set("persist.radio.VT_HYBRID_ENABLE", ".");/property_set("persist.radio.VT_HYBRID_ENABLE", "0");/' init/init_*.cpp;
2017-05-01 19:20:20 -04:00
fi ;
2017-05-13 13:43:00 -04:00
if [ -f overlay/frameworks/base/core/res/res/values/config.xml ] ; then
2017-06-23 15:44:33 -04:00
awk -i inplace '!/' $overlay '/' overlay/frameworks/base/core/res/res/values/config.xml;
2017-06-05 22:52:42 -04:00
#sed -i 's|<bool name="config_enableWifiDisplay">true</bool>|<bool name="config_enableWifiDisplay">false</bool>|' overlay/frameworks/base/core/res/res/values/config.xml;
2017-05-13 13:43:00 -04:00
sed -i 's|<bool name="config_uiBlurEnabled">true</bool>|<bool name="config_uiBlurEnabled">false</bool>|' overlay/frameworks/base/core/res/res/values/config.xml; #Disable UIBlur
#Disable IMS
2017-06-05 23:16:35 -04:00
#sed -i 's|<bool name="config_carrier_volte_available">true</bool>|<bool name="config_carrier_volte_available">false</bool>|' overlay/frameworks/base/core/res/res/values/config.xml;
#sed -i 's|<bool name="config_carrier_vt_available">true</bool>|<bool name="config_carrier_vt_available">false</bool>|' overlay/frameworks/base/core/res/res/values/config.xml;
#sed -i 's|<bool name="config_device_volte_available">true</bool>|<bool name="config_device_volte_available">false</bool>|' overlay/frameworks/base/core/res/res/values/config.xml;
#sed -i 's|<bool name="config_device_vt_available">true</bool>|<bool name="config_device_vt_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;
2017-05-13 13:43:00 -04:00
fi ;
2017-06-01 16:44:52 -04:00
if [ -d sepolicy ] ; then
if [ -z " $replaceTime " ] ; then
#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:file create_file_perms;" >> sepolicy/system_app.te;
fi ;
2017-06-01 00:24:16 -04:00
fi ;
2017-06-01 16:44:52 -04:00
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
2017-06-23 15:44:33 -04:00
rm -f board/qcom-cne.mk product/qcom-cne.mk; #Remove CNE
2017-06-01 16:44:52 -04:00
rm -f rootdir/etc/init.qti.ims.sh rootdir/init.qti.ims.sh init.qti.ims.sh; #Remove IMS startup script
2017-05-04 21:42:25 -04:00
rm -rf IMSEnabler; #Remove IMS compatibility module
2017-06-05 23:30:53 -04:00
#rm -rf data-ipa-cfg-mgr; #Remove IPA
2017-06-20 16:44:48 -04:00
rm -rf libshimwvm libshims/wvm_shim.cpp; #Remove Google Widevine compatibility module
2017-05-05 19:54:06 -04:00
rm -rf board/qcom-wipower.mk product/qcom-wipower.mk; #Remove WiPower makefiles
2017-05-02 19:07:26 -04:00
if [ -f setup-makefiles.sh ] ; then #FIXME: This breaks some devices using shared device trees (eg. osprey) when removing blobs that are listed in Android.mk of vendor repositories
2017-02-15 17:06:25 -05:00
awk -i inplace '!/' $blobs '/' *proprietary*.txt; #Remove all blob references from blob manifest
sh -c " cd $base $devicePath && ./setup-makefiles.sh " ; #Update the makefiles
fi ;
cd $base ;
}
export -f deblobDevice;
2017-06-05 22:52:42 -04:00
deblobKernel( ) {
kernelPath = $1 ;
cd $base $kernelPath ;
rm -rf $kernels ;
cd $base ;
}
export -f deblobKernel;
2017-02-15 17:06:25 -05:00
deblobVendors( ) {
cd $base ;
2017-02-15 17:15:00 -05:00
find vendor -regextype posix-extended -regex '.*(' $blobs ')' -type f -delete; #Delete all blobs
2017-02-15 17:06:25 -05:00
}
2017-06-05 22:52:42 -04:00
export -f deblobVendors;
2017-02-15 17:06:25 -05:00
deblobVendor( ) {
makefile = $1 ;
cd $base ;
awk -i inplace '!/' $blobs '/' $makefile ; #Remove all blob references from makefile
}
export -f deblobVendor;
#
#END OF FUNCTIONS
#
2017-06-05 22:52:42 -04:00
#
#START OF DEBLOBBING
#
2017-02-15 17:06:25 -05:00
find device -maxdepth 2 -mindepth 2 -type d -exec bash -c 'deblobDevice "$0"' { } \; #Deblob all device directories
2017-06-05 22:52:42 -04:00
#find kernel -maxdepth 2 -mindepth 2 -type d -exec bash -c 'deblobKernel "$0"' {} \; #Deblob all kernel directories
2017-02-15 17:06:25 -05:00
find vendor -name "*vendor*.mk" -type f -exec bash -c 'deblobVendor "$0"' { } \; #Deblob all makefiles
deblobVendors; #Deblob entire vendor directory
2017-03-19 13:19:51 -04:00
rm -rf frameworks/av/drm/mediadrm/plugins/clearkey; #Remove Clearkey
2017-06-29 16:57:23 -04:00
rm -rf vendor/samsung/nodevice;
2017-05-01 17:02:37 -04:00
#
#END OF DEBLOBBING
#
2017-03-31 10:21:05 -04:00
2017-06-05 22:52:42 -04:00
#Fixes marlin building, really janky (recursive symlinks) and probably not the best place for it [LAOS SPECIFIC]
2017-03-31 10:21:05 -04:00
cd vendor/google/marlin/proprietary;
ln -s . vendor;
ln -s . lib/lib;
ln -s . lib64/lib64;
ln -s . app/app;
ln -s . bin/bin;
ln -s . etc/etc;
ln -s . framework/framework;
ln -s . priv-app/priv-app;
2017-04-04 13:12:11 -04:00
cd $base ;
2017-10-21 09:10:23 -04:00
echo "Deblobbing complete!"