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

DiR*_*oiD 3 android adb android-espresso

如何更改不要在浓缩咖啡测试中保留活动?我需要知道adb中此命令的名称。如何从adb访问所有可用的开发人员设置命令?

我需要类似以下命令的内容;

getInstrumentation().getUiAutomation().executeShellCommand("settings put global window_animation_scale 0.0");
Run Code Online (Sandbox Code Playgroud)

要么

$ adb shell settings put global wifi_on 0
Run Code Online (Sandbox Code Playgroud)

小智 7

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

  • 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
Run Code Online (Sandbox Code Playgroud)


sta*_*uel 6

您可以使用:

adb shell settings put global always_finish_activities 1 
Run Code Online (Sandbox Code Playgroud)

激活设置并0禁用它。

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