adb command to set voice assistant

Viewed 337

I'm working on a voice assistant, and every time the app is deployed on the phone, I need to change again the default assistant to my app. Just a few clicks, but 100 times a day, that's some time gone !!

Something similar exists for setting the default launcher

adb shell cmd package set-home-activity "the.package/.TheLauncherActivity"

So I tried

adb shell cmd package set-assistant "the.package/.TheLauncherActivity"
adb shell cmd package set-voice-assistant "the.package/.TheLauncherActivity"
adb shell cmd package set-assist "the.package/.TheLauncherActivity"
adb shell cmd package set-voice-assist "the.package/.TheLauncherActivity"

It's weird because the assistant itself is more a service than an activity, but anyways, all I got is:

Unknown command: set-voice-assist (and the others)

So I guess I'm not even close.

1 Answers

I'm not sure if you were looking for something like this:

$ adb shell cmd role remove-role-holder --user 10 android.app.role.ASSISTANT com.google.android.carassistant

$ adb shell cmd role add-role-holder --user 10 android.app.role.ASSISTANT CUSTOM.PACKAGE.NAME

Good information about Role managing can be found here: http://aospxref.com/android-12.0.0_r3/xref/packages/modules/Permission/PermissionController/src/com/android/permissioncontroller/role/Role.md and list of the roles: http://aospxref.com/android-12.0.0_r3/xref/packages/modules/Permission/framework-s/api/current.txt#8

If your device contains custom build of AOSP and you have the platform key you are able write own app which will change role holders with method RoleManager.addRoleHolderAsUser.

Related