52-Android之内置应用

时间:2025-01-27 17:08:04

52-Android之内置应用


平台: Android10 MTK6739

内置不带so库的应用,如:

WhatsApp # WhatsApp是带so库,此处只是举例
build/make/target/product/base_system.mk
PRODUCT_PACKAGES += \
    WhatsApp \
    
vendor/mediatek/proprietary/packages/apps/WhatsApp目录:
vendor/mediatek/proprietary/packages/apps/WhatsApp/
vendor/mediatek/proprietary/packages/apps/WhatsApp/

文件内容:
###################################
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := WhatsApp
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := APPS
LOCAL_BUILT_MODULE_STEM := 
# PRESIGNED: 表示APK签名使用原来签名,即第三方签名;
# platform: 表示APK使用系统签名, APK获得系统权限 
LOCAL_CERTIFICATE := PRESIGNED 
# 表示编译后APK放在/system/vendor/operator/app目录下面, 用户可以卸载, 如果不加这句, 则会放在/system/app/下面, 用户不可以卸载
LOCAL_MODULE_PATH := $(TARGET_OUT)/vendor/operator/app
LOCAL_DEX_PREOPT := false
LOCAL_MODULE_TARGET_ARCH := arm
LOCAL_SRC_FILES_arm := $(LOCAL_MODULE).apk
include $(BUILD_PREBUILT)
######################################

内置带so库的应用,如:

Opera
build/make/target/product/base_system.mk
PRODUCT_PACKAGES += \
    Opera \
    
vendor/mediatek/proprietary/packages/apps/Opera 目录:
vendor/mediatek/proprietary/packages/apps/Opera/
vendor/mediatek/proprietary/packages/apps/Opera/
vendor/mediatek/proprietary/packages/apps/Opera/libchrome_crashpad_handler.so
vendor/mediatek/proprietary/packages/apps/Opera/libcrashpad_handler_trampoline.so
vendor/mediatek/proprietary/packages/apps/Opera/

文件内容:
###################################
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := Opera
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := APPS
LOCAL_BUILT_MODULE_STEM := 
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_DEX_PREOPT := false
LOCAL_MODULE_TARGET_ARCH := arm
LOCAL_SRC_FILES_arm := $(LOCAL_MODULE).apk
# SO库的处理
LOCAL_PREBUILT_JNI_LIBS:= \
    libchrome_crashpad_handler.so \
    libcrashpad_handler_trampoline.so \
    

include $(BUILD_PREBUILT)
###################################

平台: Android4.4 SPRD SC9820E

内置带so库的应用,如:

SipHome
device/sprd/sharkle/common/common_packages.mk
PRODUCT_PACKAGES += \
    libpj_opensl_dev \
    libpjsipjni \
    libstlport_shared \ 
    SipHome \

packages/apps/SipHome目录:
packages/apps/SipHome/
packages/apps/SipHome/源码
packages/apps/SipHome/libs/armeabi-v7a/libpj_opensl_dev.so
packages/apps/SipHome/libs/armeabi-v7a/
packages/apps/SipHome/libs/armeabi-v7a/libstlport_shared.so

文件内容:
###################################
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_AAPT_FLAGS := --auto-add-overlay
LOCAL_AAPT_FLAGS += --extra-packages .v4
LOCAL_AAPT_FLAGS += --extra-packages 
LOCAL_SRC_FILES := \
     $(call all-java-files-under, src)  
LOCAL_SRC_FILES += $(call all-Iaidl-files-under, src/com/csipsimple/api)
LOCAL_SRC_FILES += $(call all-Iaidl-files-under, src/android/app/sip)
LOCAL_JNI_SHARED_LIBRARIES :=  \
        libpj_opensl_dev \
        libpjsipjni \
        libstlport_shared 
LOCAL_PACKAGE_NAME := SipHome
LOCAL_CERTIFICATE := platform
LOCAL_PROGUARD_ENABLED := disabled
include $(wildcard vendor/sprd/platform/frameworks/support/ActionBarSherlock/apply_actionbar_sherlock.mk)
include $(wildcard vendor/sprd/platform/frameworks/support/featurebar/apply_featurebar.mk)
include $(BUILD_PACKAGE)

#====================================================
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MODULE_SUFFIX := .so
LOCAL_MODULE := libpj_opensl_dev
LOCAL_SRC_FILES := libs/armeabi-v7a/$(LOCAL_MODULE).so
LOCAL_MODULE_PATH := $(TARGET_OUT)/lib
LOCAL_MULTILIB := 32
include $(BUILD_PREBUILT)
#====================================================

#====================================================
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MODULE_SUFFIX := .so
LOCAL_MODULE := libpjsipjni
LOCAL_SRC_FILES := libs/armeabi-v7a/$(LOCAL_MODULE).so
LOCAL_MODULE_PATH := $(TARGET_OUT)/lib
LOCAL_MULTILIB := 32
include $(BUILD_PREBUILT)

#====================================================
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MODULE_SUFFIX := .so
LOCAL_MODULE := libstlport_shared
LOCAL_SRC_FILES := libs/armeabi-v7a/$(LOCAL_MODULE).so
LOCAL_MODULE_PATH := $(TARGET_OUT)/lib
LOCAL_MULTILIB := 32
include $(BUILD_PREBUILT)
###################################