@act262
2017-02-03T08:50:19.000000Z
字数 378
阅读 1435
Mine
SystemProperties
系统隐藏类,用于设置系统相关的属性值,
在API19以前有权限限制,所以只能通过setprop方式修改属性;
在此之后可以直接用.
参考:SystemProperties系统属性使用
获取Settings.Global的属性
i.e.
Settings.Global.getInt(context.getContentResolver(), Settings.Global.ADB_ENABLED)
等同于下面的shell命令
adb shell settings get global adb_enabled
在Settings.Global.get/put
中获取属性不需要权限,但是设置属性需要特殊的权限,如和系统相同的UID以及相应的permission等.
故此在设置时采用命令行的方式去设置,需要有root权限.