有没有办法在 AOSP 中设置默认启动器应用程序而不排除其他启动器

问题描述

我知道 LOCAL_OVERRIDES_PACKAGES 但我想将 Launcher3 设置为我的认启动器而不覆盖我已安装的其他应用程序。

所以我希望应用程序存在于系统上但不设置为认值,LOCAL_OVERRIDES_PACKAGES 不允许我这样做。

解决方法

您可以设置意图过滤器的优先级。此优先级应高于 0,小于 Provision 的优先级。 https://developer.android.com/guide/topics/manifest/intent-filter-element#priority

<intent-filter android:priority="1">
     <action android:name="android.intent.action.MAIN" />
     <category android:name="android.intent.category.HOME" />
     <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

Provision(或 SetupWizard)应该具有最高优先级。它将在第一次启动时启动。一旦完成,它将被禁用。然后将启动普通启动器。

因此您可以设置优先级以覆盖 Launcher3。