Android4.2的源码android-17\com\android\commands目录下较之前的版本多了一个settings命令,查看其中的SettingsCmd.java文件,末尾有命令的帮助信息:

private static void printUsage() {

System.err.println("usage:  settings [--user NUM] get namespace key");

System.err.println("        settings [--user NUM] put namespace key value");

System.err.println("\n'namespace' is one of {system, secure, global}, case-insensitive");

System.err.println("If '--user NUM' is not given, the operations are performed on the owner user.");

}

选项中的key为什么值,很难从帮助信息中看出,从代码中查看该key值是在android.provider.Settings中定义了。

http://developer.android.com/reference/android/provider/Settings.System.html

该命令可以很方便的更改系统设置中的参数(如修改系统默认输入法),给出几个使用该命令的例子:

#获取系统默认输入法

#默认搜狗输入法

C:\Users\Administrator>adb shell settings get secure default_input_method

com.sohu.inputmethod.sogouoem/.SogouIME

#默认为Appium使用中文输入时安装的输入法

C:\Users\Administrator>adb shell settings get secure default_input_method

io.appium.android.ime/.UnicodeIME

#put命令更改默认输入法(将io.appium.android.ime/.UnicodeIME改为com.sohu.inputmethod.sogouoem/.SogouIME)

C:\Users\Administrator>adb shell settings put secure default_input_method com.sohu.inputmethod.sogouoem/.SogouIME

#获取亮度是否为自动获取

C:\Users\Administrator>adb shell settings get system screen_brightness_mode

1

#获取当前亮度值

C:\Users\Administrator>adb shell settings get system screen_brightness

30

#更改亮度值(亮度值在0—255之间)

C:\Users\Administrator>adb shell settings put system screen_brightness 150

#获取屏幕休眠时间

C:\Users\Administrator>adb shell settings get system screen_off_timeout

15000

#更改休眠时间,10分钟

C:\Users\Administrator>adb shell settings put system screen_off_timeout 600000

#获取日期时间选项中通过网络获取时间的状态,1为允许、0为不允许

C:\Users\Administrator>adb shell settings get global auto_time

1

#更改该状态,从1改为0

C:\Users\Administrator>adb shell settings put global auto_time 0

以及获取、修改wifi状态(wifi_on)、飞行模式(airlpane_mode_on)等,这里也是appium中getNetworkConnection获得设备网络状态的方法。

adb shell settings ....的更多相关文章

  1. adb shell settings 控制安卓系统设置(转)

    Android4.2的源码android-17\com\android\commands目录下较之前的版本多了一个settings命令,查看其中的SettingsCmd.java文件,末尾有命令的帮助 ...

  2. adb shell 命令详解(转)

    adb介绍 SDK的Tools文件夹下包含着Android模拟器操作的重要命令adb,adb的全称为(Android Debug Bridge就是调试桥的作用.通过adb我们可以在Eclipse中方面 ...

  3. adb shell input keyevent code详解

    adb shell input keyevent 7 # for key '0' adb shell input keyevent 8 # for key '1' adb shell input ke ...

  4. Android系统在超级终端下必会的命令大全(adb shell命令大全)

    . 显示系统中全部Android平台: android list targets . 显示系统中全部AVD(模拟器): android list avd . 创建AVD(模拟器): android c ...

  5. Android adb shell命令大全

    1. 显示系统中全部Android平台: android list targets 2. 显示系统中全部AVD(模拟器): android list avd 3. 创建AVD(模拟器): androi ...

  6. Android成长记(1)-----android环境搭建与adb shell 命令

    整理一下学习android一步一步存下来的自己总结或是从网上摘抄的比较不错的文档,电脑要上交了,最舍不得的就是自己积累的这么点东西了,所以决定发布到黎梓小站,以供大家一起学习以及自己日后忘记了也有地方 ...

  7. android adb shell 命令大全

    1. 显示系统中全部Android平台: android list targets 2. 显示系统中全部AVD(模拟器): android list avd 3. 创建AVD(模拟器): androi ...

  8. adb shell 命令详解,android

    http://www.miui.com/article-275-1.html http://noobjava.iteye.com/blog/1914348 adb shell 命令详解,android ...

  9. 【安卓手机通用】android adb shell 命令大全

    浏览:3116 | 更新:2013-10-17 17:05 | 标签:安卓 android 一.[什么是shell] Linux系统的shell作为操作系统的外壳,为用户提供使用操作系统的接口.它是命 ...

随机推荐

  1. bzoj 4010: [HNOI2015]菜肴制作 拓扑排序

    题目链接: 题目 4010: [HNOI2015]菜肴制作 Time Limit: 5 Sec Memory Limit: 512 MB 问题描述 知名美食家小 A被邀请至ATM 大酒店,为其品评菜肴 ...

  2. HDU 4587 TWO NODES 割点

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4587 题意: 删除两个点,使连通块的数目最大化 题解: 枚举删除第一个点,然后对删除了第一个点的图跑 ...

  3. linux使用:vi编辑器

    初学linux,目前是概念多于操作,所以记录下一些操作: 编辑某个文件():vi 文件名 编辑后保存退出::wq 编辑后不保存退出: :q! 参数:-R 只读模式 -x 文件加密(vim命令下使用) ...

  4. C++字符串分割

    //字符串分割函数 std::vector<std::string> split(std::string str,std::string pattern) { std::string::s ...

  5. [转载]淘宝API调用 申请 获取session key

    http://www.cnblogs.com/zknu/archive/2013/06/14/3135527.html 在调用淘宝的API时,我们都会用到appkey,appsecret,appses ...

  6. Ajax出入江湖

    window.onload = initAll; var xhr = false; function initAll() { if (window.XMLHttpRequest) { xhr = ne ...

  7. Class Object

    java.lang Class Object java.lang.Object public class Object Class Object is the root of the class hi ...

  8. hdoj 1596 find the safest road

    题目传送:http://acm.hdu.edu.cn/showproblem.php?pid=1596 分析:Dijkstra变体,最短路径判断计算方式:Safe(P) = s(e1)*s(e2)…* ...

  9. ZOJ 2724 Windows Message Queue (优先级队列,水题,自己动手写了个最小堆)

    #include <iostream> #include <stdio.h> #include <string.h> #include <algorithm& ...

  10. javascript中li标签的排序和数组sort的用法

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...