从构建中删除 AOSP 应用程序

问题描述 投票:0回答:2

首先,我尝试从 Android 源代码构建一个 Android 平台,而不使用 LiveWallpapers、日历、联系人、计算器、电话、设置等库存应用程序。

为了做到这一点,我正在修改 /build/target/product/ 中的 make 文件,特别是变量 PRODUCT_PACKAGES,其中包含需要构建的所有应用程序和库。

例如,我删除了以下几行:

DeskClock \
Bluetooth \
Calculator \
Calendar \

来自文件

generic_no_telephony.mk
. 中的 PRODUCT_PACKAGES :=

但是,当我刷新后运行平板电脑时,我仍然发现电子邮件、声音和语音录音机等应用程序。我在重建之前已经清理过。 我需要删除其他 make 文件中的更多条目吗?

在这里你可以看到我对 build/target/product/:

中的 make 文件所做的所有修改
diff --git a/target/product/core.mk b/target/product/core.mk
index 1d62eb8..5474f6a 100644
--- a/target/product/core.mk
+++ b/target/product/core.mk
@@ -25,23 +25,13 @@ PRODUCT_PROPERTY_OVERRIDES := \
 PRODUCT_PACKAGES += \
     ApplicationsProvider \
     BackupRestoreConfirmation \
-    BasicDreams \
     Browser \
-    Contacts \
-    ContactsProvider \
     DefaultContainerService \
-    DownloadProvider \
-    DownloadProviderUi \
-    HTMLViewer \
     Home \
     KeyChain \
-    MediaProvider \
     PackageInstaller \
-    PicoTts \
     SettingsProvider \
     SharedStorageBackup \
-    TelephonyProvider \
-    UserDictionaryProvider \
     VpnDialogs \
     abcc \
     apache-xml \
diff --git a/target/product/full_base.mk b/target/product/full_base.mk
index b2e3189..94d6d48 100644
--- a/target/product/full_base.mk
+++ b/target/product/full_base.mk
@@ -21,24 +21,10 @@

 PRODUCT_PACKAGES := \
     libfwdlockengine \
-    OpenWnn \
-    PinyinIME \
     libWnnEngDic \
     libWnnJpnDic \
     libwnndict \
-    VideoEditor \
-    WAPPushManager
-
-PRODUCT_PACKAGES += \
-    Galaxy4 \
-    HoloSpiralWallpaper \
-    LiveWallpapers \
-    LiveWallpapersPicker \
-    MagicSmokeWallpapers \
-    NoiseField \
-    PhaseBeam \
-    VisualizationWallpapers \
-    PhotoTable
+

 # Additional settings used in all AOSP builds
 PRODUCT_PROPERTY_OVERRIDES := \
diff --git a/target/product/full_base_telephony.mk b/target/product       /full_base_telephony.mk
index 5899c8c..8c8c7c3 100644
--- a/target/product/full_base_telephony.mk
+++ b/target/product/full_base_telephony.mk
@@ -19,9 +19,6 @@
 # build quite specifically for the emulator, and might not be
 # entirely appropriate to inherit from for on-device configurations.

-PRODUCT_PACKAGES := \
-    VoiceDialer
-
 PRODUCT_PROPERTY_OVERRIDES := \
     keyguard.no_require_sim=true \
     ro.com.android.dataroaming=true
diff --git a/target/product/generic_no_telephony.mk b/target/product/generic_no_telephony.mk
index f139cbd..5f544b2 100644
--- a/target/product/generic_no_telephony.mk
+++ b/target/product/generic_no_telephony.mk
@@ -20,27 +20,16 @@
 PRODUCT_POLICY := android.policy_phone

 PRODUCT_PACKAGES := \
-    DeskClock \
     Bluetooth \
-    Calculator \
-    Calendar \
     CertInstaller \
     DrmProvider \
-    Email2 \
-    Exchange2 \
     FusedLocation \
-    Gallery2 \
     InputDevices \
     LatinIME \
     Launcher2 \
-    Music \
-    MusicFX \
     Provision \
-    Phone \
-    QuickSearchBox \
     Settings \
     SystemUI \
-    CalendarProvider \
     bluetooth-health \
     hostapd \
     wpa_supplicant.conf
diff --git a/target/product/large_emu_hw.mk b/target/product/large_emu_hw.mk
index 27ebc96..54c53ca 100644
--- a/target/product/large_emu_hw.mk
+++ b/target/product/large_emu_hw.mk
@@ -20,25 +20,14 @@
 PRODUCT_POLICY := android.policy_mid

 PRODUCT_PACKAGES := \
-    CarHome \
-    DeskClock \
     Bluetooth \
-    Calculator \
-    Calendar \
     CertInstaller \
     DrmProvider \
-    Email2 \
-    Exchange2 \
-    Gallery2 \
-    LatinIME \
     Launcher2 \
-    Music \
     Provision \
-    QuickSearchBox \
     Settings \
     Sync \
     Updater \
-    CalendarProvider \
     SyncProvider \
     bluetooth-health \
     hostapd \
diff --git a/target/product/mini.mk b/target/product/mini.mk
index b69c917..9486c50 100644
--- a/target/product/mini.mk
+++ b/target/product/mini.mk
@@ -54,15 +54,11 @@ PRODUCT_PROPERTY_OVERRIDES += \
 # Please keep this list sorted alphabetically
 PRODUCT_PACKAGES += \
     ApplicationsProvider \
-    ContactsProvider \
     DefaultContainerService \
     DownloadProvider \
     DownloadProviderUi \
-    MediaProvider \
     PackageInstaller \
     SettingsProvider \
-    TelephonyProvider \
-    UserDictionaryProvider \
     abcc \
     apache-xml \
     audio \
@@ -161,8 +157,6 @@ PRODUCT_PACKAGES += \
     Bluetooth \
     FusedLocation \
     InputDevices \
-    LatinIME \
-    Phone \
     Provision \
     hostapd \
     wpa_supplicant.conf
diff --git a/target/product/sdk.mk b/target/product/sdk.mk
index 1edff57..294b9d8 100644
--- a/target/product/sdk.mk
+++ b/target/product/sdk.mk
@@ -18,40 +18,23 @@ PRODUCT_POLICY := android.policy_phone
 PRODUCT_PROPERTY_OVERRIDES :=

 PRODUCT_PACKAGES := \
-   Calculator \
-   DeskClock \
-   Exchange2 \
    FusedLocation \
-   Gallery \
-   Music \
-   Mms \
-   OpenWnn \
    libWnnEngDic \
    libWnnJpnDic \
    libwnndict \
-   Phone \
-   PinyinIME \
    Protips \
    SoftKeyboard \
    SystemUI \
    Launcher2 \
-   Development \
-   DevelopmentSettings \
-   DrmProvider \
    Fallback \
    Settings \
    SdkSetup \
    CustomLocale \
    sqlite3 \
    InputDevices \
-   LatinIME \
    CertInstaller \
-   LiveWallpapersPicker \
    ApiDemos \
    GestureBuilder \
-   CubeLiveWallpapers \
-   QuickSearchBox \
-   WidgetPreview \
    monkeyrunner \
    guavalib \
    jsr305lib \
@@ -59,13 +42,7 @@ PRODUCT_PACKAGES := \
jsilver \
librs_jni \
    ConnectivityTest \
-   GpsLocationTest \
-   CalendarProvider \
-   Calendar \
-   SmokeTest \
-   SmokeTestApp \
-   rild \
-   LegacyCamera
+   rild


 # Define the host tools and libs that are parts of the SDK.
diff --git a/target/product/telephony.mk b/target/product/telephony.mk
index 89ed20a..a92ed03 100644
--- a/target/product/telephony.mk
+++ b/target/product/telephony.mk
@@ -18,7 +18,6 @@
 # to products that have telephony hardware.

 PRODUCT_PACKAGES := \
-    Mms \
     rild

 PRODUCT_COPY_FILES := \
android android-source android-build
2个回答
11
投票

我认为这些模块(包)可能被其他应用程序包含,在 .mk 文件中的

LOCAL_REQUIRED_MODULES
中指定。我会尝试找出模块的包名称,然后搜索所有 .mk 文件。

您可以添加一个新模块、一个存根,并使用

LOCAL_OVERRIDES_PACKAGES
在其 Android.mk 中禁用模块,而不是在许多文件夹中修改 AOSP 中的一堆 .mk 文件。如果某个模块仍然出现在目标中,您可能需要添加到
LOCAL_OVERRIDES_PACKAGES
另一个通过
LOCAL_REQUIRED_MODULES
添加不需要的包的模块。

抱歉,我不知道更好的方法。

packages/apps 文件夹包含大多数应用程序 .mk 文件,但在一般情况下,您可能还需要检查 devicevendorhardware 文件夹。

添加:我刚刚发现

envsetup.sh
提供了
mgrep
命令来搜索makefile(包括*.mk),所以你可以尝试这个来查找引用DeskClock包的.mk:

build@1c1b9d217b9d:~/android/cm12.1$ mgrep DeskClock
./packages/apps/DeskClock/Android.mk:20:LOCAL_PACKAGE_NAME := DeskClock
./packages/apps/DeskClock/tests/Android.mk:12:LOCAL_PACKAGE_NAME := DeskClockTests
./packages/apps/DeskClock/tests/Android.mk:14:LOCAL_INSTRUMENTATION_FOR := DeskClock
./build/target/product/core.mk:26:    DeskClock \

因此您会看到 DeskClock 已包含在构建中

core.mk

虽然

mgrep
的帮助部分中没有提到
envsetup.sh
命令,但它是通过 'hmm' 命令报告的(envsetup.sh 的帮助) - 我在这里引用它是为了激励我们更深入地学习 AOSP 工具)):

build@1c1b9d217b9d:~/android/cm12.1$ hmm
Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
- lunch:   lunch <product_name>-<build_variant>
- tapas:   tapas [<App1> <App2> ...] [arm|x86|mips|armv5|arm64|x86_64|mips64] [eng|userdebug|user]
- croot:   Changes directory to the top of the tree.
- cout:    Changes directory to out.
- m:       Makes from the top of the tree.
- mm:      Builds all of the modules in the current directory, but not their dependencies.
- mmm:     Builds all of the modules in the supplied directories, but not their dependencies.
           To limit the modules being built use the syntax: mmm dir/:target1,target2.
- mma:     Builds all of the modules in the current directory, and their dependencies.
- mmp:     Builds all of the modules in the current directory and pushes them to the device.
- mmmp:    Builds all of the modules in the supplied directories and pushes them to the device.
- mmma:    Builds all of the modules in the supplied directories, and their dependencies.
- mms:     Short circuit builder. Quickly re-build the kernel, rootfs, boot and system images
           without deep dependencies. Requires the full build to have run before.
- cgrep:   Greps on all local C/C++ files.
- ggrep:   Greps on all local Gradle files.
- jgrep:   Greps on all local Java files.
- resgrep: Greps on all local res / *.xml files.
- sgrep:   Greps on all local source files.
- godir:   Go to the directory containing a file.
- cmremote: Add git remote for CM Gerrit Review
- cmgerrit: A Git wrapper that fetches/pushes patch from/to CM Gerrit Review
- cmrebase: Rebase a Gerrit change and push it again
- aospremote: Add git remote for matching AOSP repository
- cafremote: Add git remote for matching CodeAurora repository.
- mka:      Builds using SCHED_BATCH on all processors
- mkap:     Builds the module(s) using mka and pushes them to the device.
- cmka:     Cleans and builds using mka.
- repolastsync: Prints date and time of last repo sync.
- reposync: Parallel repo sync using ionice and SCHED_BATCH
- repopick: Utility to fetch changes from Gerrit.
- installboot: Installs a boot.img to the connected device.
- installrecovery: Installs a recovery.img to the connected device.

Look at the source to view more functions. The complete list is:
mgrep                           cmka                            get_symbols_directory           lunch                           repopick
sgrep                           cmrebase                        getbugreports                   m                               reposync
treegrep                        cmremote                        getdriver                       make                            resgrep
_lunch                          core                            getlastscreenshot               makerecipe                      runhat
adb_get_product_device          coredump_enable                 getprebuilt                     mangrep                         runtest
adb_get_traced_by               coredump_setup                  getscreenshotpath               mk_timer                        sepgrep
add_lunch_combo                 cout                            getsdcardpath                   mka                             set_java_home
aospremote                      cproj                           gettargetarch                   mm                              set_sequence_number
breakfast                       croot                           gettop                          mma                             set_stuff_for_environment
brunch                          dddclient                       ggrep                           mmm                             setpaths
cafremote                       dopush                          godir                           mmma                            settitle
cgrep                           eat                             hmm                             mms                             smoketest
check_bash_version              findmakefile                    installboot                     omnom                           stacks
check_product                   fixup_common_out_dir            installrecovery                 pez                             startviewserver
check_variant                   gdbclient                       is                              pid                             stopviewserver
choosecombo                     gdbclient_old                   isviewserverstarted             print_lunch_menu                systemstack
chooseproduct                   gdbwrapper                      jgrep                           printconfig                     tapas
choosetype                      get_abs_build_var               key_back                        qpid                            tracedmdump
choosevariant                   get_build_var                   key_home                        repodiff
cmgerrit                        get_make_command                key_menu                        repolastsync

您可以在

mgrep
中检查
envsetup.sh
的实现,以获取新 grep 搜索的想法 ))


0
投票

这是很久以前的帖子,但这是我发现的可能对其他人有帮助的内容。 这里提到的许多软件包都是预安装的软件包。要完全删除它们的预安装,需要完成两件事:

  1. 找到
    PRODUCT_PACKAGES
    并删除相应的包。前任。在
    /build/make/target/product/handheld_product.mk
    中删除
    Camera2
  2. 在上面提到的
    handheld_product.mk
    中,你可以发现它也有对
    preinstalled-packages-platform-handheld-product.xml
    的引用。找到这个文件(在我的例子中它位于
    /build/make/target/product/sysconfig
    ),并删除与
    Camera2
  3. 相关的整个代码块

重新构建,预装的相机App应该被删除。

© www.soinside.com 2019 - 2024. All rights reserved.