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

时间:2017-10-18 12:45:09

标签: android adb android-espresso

如何在espresso测试中更改不要保持活动?我需要在adb中知道这个命令的名称。如何从adb访问所有可用的开发人员设置命令?

我需要以下命令;

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

$ adb shell settings put global wifi_on 0

2 个答案:

答案 0 :(得分:4)

您可以使用:

adb shell settings put global always_finish_activities 1 

要激活设置,请0将其禁用。

您可以找到android here的其他可用设置的正式列表。

答案 1 :(得分: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