I meanwhile found a partly resolve working with Android 7/8 and up (when the cmd package
command was added):
- Default dialer:
cmd package resolve-activity tel://123456
- Default mail:
cmd package resolve-activity mailto:[email protected]
- Default browser:
cmd package resolve-activity http://www.example.com/
- Default messenging:
cmd package resolve-activity sms://123456
- Default homescreen launcher:
cmd package resolve-activity -c android.intent.category.HOME -a android.intent.action.MAIN
In the output, then grep
for packageName=
(e.g. packageName=com.android.messaging
for the default SMS app). If a given action has no default set (e.g. multiple browsers are installed but none was declared to be "always used"), the action will resolve to the OS (packageName=android
) to prompt the user. Side-note: if you want to check for available alternatives, just replace resolve-activity
with query-activities
(note it might also return a one-liner like "No activities found", especially on Android < 8).
I call this a "partly resolve" as it lacks several default apps I've no idea what activity to ask for – like the default homescreen launcher (note: just figured) or the assistant app (hints welcome!).
Thanks to Irfan Latif for pointing out a solution for Android 10 and up. Here, the role manager was added which I had already found but didn't figure how to call it via ADB. Turns out that was because all my devices are running Android < 10 (and as just said, role manager was added with Android 10), and the command would be dumpsys role
(but not availabe before Android 10).
/data/system/users/<user_id>/roles.xml
which can be dumped usingdumpsys role
.role
was added only with Q (and up), as it's not available on the Oreo or lower devices I've got here for testing (did not yet check with the Pie one as it's currently "occupied"). Any clue for what would work at least with Oreo, and ideally also below? I mean, the concept of "default apps" goes back at least to 2.x IIRC – so the system must remember them somewhere there as well. I've combed dumpsys up and down, didn't find a hint./data/system/users/0/package-restrictions.xml
and/data/system/users/0/settings_secure.xml
. So the respective CLI tools (pm
andsettings
) might dump the required info. Or may see the files directly if root access is available.settings
doesn't show them, and forpm
I didn't see a corresponding parameter. What sounded close wascmd package resolve-activity -c android.intent.category.LAUNCHER
– but that returns nada ("No activity found") for all I tried. I was able to identify the dialer usingcmd package resolve-activity tel://123456
; similarly the browser with a http URL (yields the OS (packageandroid
) if no default set, interesting) and the mail app with amailto:[email protected]
. But what actions to attempt for homescreen, assistant etc?