5

Before API 29, we can remove the launcher icon in the device by removing

<intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

in the manifest file.

As stated here

As of Android Q, at least one of the app's activities or synthesized activities appears in the returned list unless the app satisfies at least one of the following conditions:

  • The app is a system app.

  • The app doesn't request any permissions.

  • The app doesn't have a launcher activity that is enabled by default. A launcher activity has an intent containing the ACTION_MAIN action and the CATEGORY_LAUNCHER category.

  • Additionally, the system hides synthesized activities for some or all apps in the following enterprise-related cases:

    If the device is a fully managed device, no synthesized activities for any app appear in the returned list. If the current user has a work profile, no synthesized activities for the user's work apps appear in the returned list.

The third condition states as the same as not to have a launcher activity that is enabled.

How to achieve this in android 10?

4

1 回答 1

0

我认为第三个条件是错误的或过时的。

Google 当前的 Android 10 模拟器映像(Google APIs Intel x86 Atom System Image 29_r09)上的行为与文档不同:

getActivityList()总是返回至少一项活动,除非应用程序至少满足一项:

  • 系统应用
  • <application> 标记完全为空,即没有活动、服务……声明
  • 没有声明权限

此行为对应于Android Q Beta的发行说明:

启动器图标可见性

在 Android Q Beta 2 中,未在其各自的清单文件中声明任何权限的软件包会从所有应用托盘中隐藏,以下类型的应用也是如此:

  • 系统应用
  • 在其各自清单的 <application> 标记内不包含任何组件的应用
于 2020-05-05T11:49:48.353 回答