如何从adb shell触发“ Ok google”?

问题描述 投票:1回答:1

我正在尝试从Android O(8.0)上的adb shell模拟“ Ok google”,但我找不到解决方案。

我发现在“ Ok google”之后显示的应用具有cmp=com.google.android.googlequicksearchbox/com.google.android.apps.gsa.staticplugins.opa.OpaActivity。但是,由于出现以下错误,我无法通过adb启动它。

$adb shell am start -n com.google.android.googlequicksearchbox/com.google.android.apps.gsa.staticplugins.opa.OpaActivity
Starting: Intent { cmp=com.google.android.googlequicksearchbox/com.google.android.apps.gsa.staticplugins.opa.OpaActivity }
Security exception: Permission Denial: starting Intent { flg=0x10000000 cmp=com.google.android.googlequicksearchbox/com.google.android.apps.gsa.staticplugins.opa.OpaActivity } from null (pid=29706, uid=2000) not exported from uid 10044

java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.google.android.googlequicksearchbox/com.google.android.apps.gsa.staticplugins.opa.OpaActivity } from null (pid=29706, uid=2000) not exported from uid 10044
    at com.android.server.am.ActivityStackSupervisor.checkStartAnyActivityPermission(ActivityStackSupervisor.java:1688)
    at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:460)
    at com.android.server.am.ActivityStarter.startActivityLocked(ActivityStarter.java:277)
    at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:920)
    at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:4693)
    at com.android.server.am.ActivityManagerShellCommand.runStartActivity(ActivityManagerShellCommand.java:410)
    at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:141)
    at android.os.ShellCommand.exec(ShellCommand.java:96)
    at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:15401)
    at android.os.Binder.shellCommand(Binder.java:576)
    at android.os.Binder.onTransact(Binder.java:476)
    at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:4341)
    at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3040)
    at android.os.Binder.execTransact(Binder.java:681)

我希望有一些解决方案可以通过adb启动上述应用。

  • 避免$adb shell am start -n com.google.android.googlequicksearchbox/com.google.android.apps.gsa.staticplugins.opa.OpaActivity的安全异常
  • 通过另一个adb命令
android adb voice
1个回答
0
投票

可能首先需要运行adb root

> adb root
> adb shell am start -n com.google.android.googlequicksearchbox/com.google.android.apps.gsa.staticplugins.opa.OpaActivity
© www.soinside.com 2019 - 2024. All rights reserved.