Skip to content

Instantly share code, notes, and snippets.

@Kethen
Last active May 26, 2021 15:39
Show Gist options
  • Save Kethen/12f5bcd43b7d1a726fa51012404ab95e to your computer and use it in GitHub Desktop.
Save Kethen/12f5bcd43b7d1a726fa51012404ab95e to your computer and use it in GitHub Desktop.
Android module for disabling.. modules?
# found on http://qiushao.net/2019/12/12/Android%E7%B3%BB%E7%BB%9F%E5%BC%80%E5%8F%91%E5%85%A5%E9%97%A8/6-%E5%88%A0%E9%99%A4%E5%8E%9F%E7%94%9F%E5%86%85%E7%BD%AEAPK/
# creating a fake module that does nothing but overrides modules that are unwanted, a snipplet for docker-lineage-cicd build.sh
if ! [ -z "$REMOVE_PACKAGES" ]; then
mkdir -p vendor/remove_unused_module
echo '
include $(CLEAR_VARS)
LOCAL_MODULE := remove_unused_module
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := FAKE
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_OVERRIDES_PACKAGES +='" $REMOVE_PACKAGES"'
include $(BUILD_SYSTEM)/base_rules.mk
$(LOCAL_BUILT_MODULE):
$(hide) echo "Fake: $@"
$(hide) mkdir -p $(dir $@)
$(hide) touch $@
PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
' > vendor/remove_unused_module/Android.mk
echo "PRODUCT_PACKAGES += remove_unused_module" >> "vendor/$vendor/config/common.mk"
else
if [ -d vendor/remove_unused_module ]
then
rm -r vendor/remove_unused_module
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment