Cropping apk in Android system

1. Environment

Qualcomm 865 Android 10

2. Crop the apk

Delete unnecessary items in the configuration file (.mk), so that these items will not be compiled when compiling. Then find the compiled APK in the out\ file and delete it, so that the APK will not be packaged into the image. If you want to delete it completely, you can delete the corresponding source code in the source code directory (generally not recommended).

For example: remove the dialer apk, the application name is Dialer, and remove it directly in the mk file

1. Remove Dialer from the mk file

The mk file on the blogger's side is build/make/target/product/handheld_product.mk

PRODUCT_PACKAGES += \
    Browser2 \
    Calendar \
    Camera2 \
    Contacts \
    DeskClock \
    Gallery2 \
    LatinIME \
    Launcher3QuickStep \
    Music \
    OneTimeInitializer \
    Provision \
    QuickSearchBox \
    Settings \
    SettingsIntelligence \
    StorageManager \
    SystemUI \
    Email \
    Dialer \ 
    WallpaperCropper \
    frameworks-base-overlays

PRODUCT_PACKAGES_DEBUG += \
    frameworks-base-overlays-debug

2. If there is a whitelist, remove Dialer from the whitelist (if not, ignore it)

device/qcom/kona/apps_white_list.txt

ExtShared
CertInstaller
MediaProvider
SettingsProvider
Provision
SystemUI
InputDevices
Settings
PackageInstaller
SharedStorageBackup
DefaultContainerService
ExtServices
Shell
ExternalStorageProvider
StorageManager
DocumentsUI
Launcher3QuickStep
DownloadProvider
DownloadProviderUi
PermissionController
PlatformNetworkPermissionConfig
PlatformCaptivePortalLogin
InProcessNetworkStack
webview
ModuleMetadata
PrintSpooler
UserDictionaryProvider
NetworkSetting
TelephonyProvider
qcrilmsgtunnel
OsuLogin
tslogger
FusedLocation
VpnDialogs
Dialer

device/qcom/kona/apps_white_list.txt

ExtShared
CertInstaller
MediaProvider
SettingsProvider
Provision
SystemUI
InputDevices
Settings
PackageInstaller
SharedStorageBackup
DefaultContainerService
ExtServices
Shell
ExternalStorageProvider
StorageManager
DocumentsUI
Launcher3QuickStep
DownloadProvider
DownloadProviderUi
PermissionController
PlatformNetworkPermissionConfig
PlatformCaptivePortalLogin
InProcessNetworkStack
webview
ModuleMetadata
PrintSpooler
UserDictionaryProvider
NetworkSetting
TelephonyProvider
qcrilmsgtunnel
OsuLogin
tslogger
VpnDialogs
Dialer

3. Compile and verify whether the corresponding apk has been removed from the system

1. You can view all apk verifications currently installed

pm list packages

2. Brush system verification

The comparison before and after cropping is as follows:

 

 Note: The compiled apk is generally in the following directory

out\target\product\qssi\obj\PACKAGING\target_files_intermediates\qssi-target_files-eng.xxx\PRODUCT\priv-app
out\target\product\qssi\product\priv-app

The principle of adding and cutting is the same, just add it in the configuration file above

Guess you like

Origin blog.csdn.net/banzhuantuqiang/article/details/131521025