列出 android 设备上安装的所有浏览器的 adb 命令是什么?

What is adb command to list all the browsers installed on android device?

我想列出来自 android 设备

的所有浏览器包名称

赞(chrome、Mozilla 和 UC 浏览器)

是否有任何通用的 adb 命令?

Is there any generalized adb command ?

简短的回答是:否

目前,ADB shell 仅支持它自己的可用命令列表,您无法将它们过滤到应用程序类型中,例如浏览器。

adb shell pm list packages [options]

命令列表

adb shell pm list packages
adb shell pm list packages -f See their associated file.
adb shell pm list packages -d Filter to only show disabled packages.
adb shell pm list packages -e Filter to only show enabled packages.
adb shell pm list packages -s Filter to only show system packages.
adb shell pm list packages -3 Filter to only show third party packages.
adb shell pm list packages -i See the installer for the packages.
adb shell pm list packages -u Also include uninstalled packages.
adb shell pm list packages --user <USER_ID> The user space to query.

取决于你对browser的定义。如果它是在 android.intent.category.APP_BROWSER 类别中注册了意图过滤器的应用程序 - 您可以使用以下 adb shell 命令获取列表:

for P in $(pm list packages); do test -n "$(dumpsys package ${P#package:} | grep APP_BROWSER)" && echo ${P#package:}; done