adb 以编程方式更改开发人员设置选项

新手上路,请多包涵

如何改变 Do not keep activity in espresso testing?我需要知道 adb 中这个命令的名称。如何从 adb 访问所有可用的开发人员设置命令?

我需要类似以下命令的东西;

 getInstrumentation().getUiAutomation().executeShellCommand("settings put global window_animation_scale 0.0");

要么

$ adb shell settings put global wifi_on 0

原文由 DiRiNoiD 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 549
2 个回答

您可以使用:

 adb shell settings put global always_finish_activities 1

激活设置和 0 禁用它。

您可以 在此处 找到适用于 Android 的其他可用设置的官方列表。

原文由 stamanuel 发布,翻译遵循 CC BY-SA 3.0 许可协议

以下命令将列出所有可用设置:

  • adb shell 设置列表系统
  • adb shell 设置列表全局
  • adb shell 设置列表安全
$ adb shell settings
Settings provider (settings) commands:
  help
      Print this help text.
  get [--user <USER_ID> | current] NAMESPACE KEY
      Retrieve the current value of KEY.
  put [--user <USER_ID> | current] NAMESPACE KEY VALUE [TAG] [default]
      Change the contents of KEY to VALUE.
      TAG to associate with the setting.
      {default} to set as the default, case-insensitive only for global/secure namespace
  delete [--user <USER_ID> | current] NAMESPACE KEY
      Delete the entry for KEY.
  reset [--user <USER_ID> | current] NAMESPACE {PACKAGE_NAME | RESET_MODE}
      Reset the global/secure table for a package with mode.
      RESET_MODE is one of {untrusted_defaults, untrusted_clear, trusted_defaults}, case-insensitive
  list [--user <USER_ID> | current] NAMESPACE
      Print all defined keys.
      NAMESPACE is one of {system, secure, global}, case-insensitive

原文由 Lam Das 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题