Android设备连接PC后,我们可以通过adb命令完成绝大多数工作。下面借助getprop、dumpsys来了解一些系统相关信息。
一、getprop
此命令的原理很简单,就是从系统的各种配置文件中读取信息。那么这些文件在你用adb shell进入设备内部后很容易找到,它们是:
init.rc
default.prop
/system/build.prop
此时直接使用cat命令也是可以把这些信息显示出来的。
下面列出比较常用的信息
1.获得IP
$ adb shell getprop dhcp.wlan0.ipaddress
192.168.0.107
2.手机名称
$ adb shell getprop ro.product.device
Ulike2
$ adb shell getprop ro.product.model
U705T
$ adb shell getprop ro.product.name
oppo17_12035
3.serial number
$ adb shell getprop ro.serialno
0000012035ABCXXX
4.屏幕密度
$ adb shell getprop ro.sf.lcd_density
240
好了,只要使用adb shell getprop就可以把所有的信息都打印出来。而使用setprop命令就可以进行相对应的设置啦。
二、dumpsys
Android系统启动时会有大批的服务随之启动,那么我们就可以用dumpsys命令来查看每个服务的运行情况。作为一名Android开发者,我们至少要了解这些Service的存在:
Currently running services:
DMAgent
NvRAMAgent
SurfaceFlinger
accessibility
account
activity
alarm
appwidget
audio
audioprofile
backup
battery
batteryinfo
bluetooth
bluetooth_a2dp
bluetooth_profile_manager
bluetooth_socket
clipboard
connectivity
content
country_detector
cpuinfo
device_policy
devicestoragemonitor
diskstats
drm.drmManager
dropbox
entropy
gfxinfo
hardware
input_method
iphonesubinfo
isms
location
media.audio_flinger
media.audio_policy
media.camera
media.mdp_service
media.player
meminfo
memory.dumper
mount
mtk-agps
mtk-epo-client
netpolicy
netstats
network_management
notification
oppo.com.IRUtils
package
permission
phone
power
samplingprofiler
search
sensorservice
simphonebook
statusbar
telephony.registry
telephony.registry2
textservices
throttle
uimode
usagestats
usb
vibrator
wallpaper
wifi
wifip2p
window
当我们需要知道设备的分辨率时,可以使用如下命令:
$ adb shell dumpsys window displays
WINDOW MANAGER DISPLAY CONTENTS (dumpsys window displays)
Display: mDisplayId=0
init=720x1280 320dpi cur=720x1280 app=720x1280 rng=720x670-1280x1230
layoutNeeded=false
or
$ adb shell dumpsys window
...
Display: init=540x960 base=540x960 cur=540x960 app=540x888 raw=540x960
Refer to :
http://blog.csdn.net/wangjia55/article/details/7446772
http://blog.csdn.net/kevinx_xu/article/details/11846289
http://blog.csdn.net/z_guijin/article/details/8203028
<script type="text/javascript">
$(function () {
$('pre.prettyprint code').each(function () {
var lines = $(this).text().split('\n').length;
var $numbering = $('<ul/>').addClass('pre-numbering').hide();
$(this).addClass('has-numbering').parent().append($numbering);
for (i = 1; i <= lines; i++) {
$numbering.append($('<li/>').text(i));
};
$numbering.fadeIn(1700);
});
});
</script>
分享到:
相关推荐
Android 中build.prop 文件与 getprop 命令 在android系统中,它的根文件系统下有几个用于启动系统时需要的配置文件: /init.rc /default.prop /system/build.prop 我们先看看 build.prop 里面到底有些什么东西:...
清除应用数据与缓存: adb shell pm clear 查看详细应用信息: adb shell dumpsys package 查看应用安装路径: adb shell pm path 强制停止应用: adb shell am force-stop 复制设备里的文件到电脑上面:adb pull ...
Android测试中常用的命令,以及常用命令的常用选项解释和实例。adb、logcat、monkey、getprop、setprop、dumpsys、am、pm、aapt...
第一步:拷贝mprop 到/data/目录下; 第二步:./mprop ro.debuggable 1; 第三步:getprop ro.debuggable;(查看此时ro.debuggable在内存中的值) 第四步:stop;start(重启adbd进程);
Ø 提供了一些Android所需要的重要函数,如”getprop”, “LOGI”等; Ø 不完全支持POSIX标准,比如C++ exceptions,wide chars等; Ø 不提供libthread_db 和 libm的实现 0. 下载arm-eabi-4.4.0.tgz,解压,路径加...
DEPRECATED ...android_emulator_hacks We run android espresso instrumentation tests on bamboo....We wait for the devices to be booted (right now we check shell getprop init.svc.bootanim, which is suboptim
2、获取所有模拟器 adb devices 3、获取模拟器所有属性状态值 adb shell getprop ...此命令能够得出很多属性值,修改不同的属性值会达到意想不到的效果哦 4、获取模拟器某属性状态值 adb shell getprop 属性名
根据android的官方文档,如果调试一个APK,必须满足以下两个条件中的任何一个: 1.APK的AndroidManifest.xml文件中的Application标签包含android:debuggable="true"; 2./default.prop中的ro.debuggable的值为1; ...
if(::GetProp(pPrevWnd->GetSafeHwnd(),m_pszExeName)) { if(pPrevWnd->IsIconic()) pPrevWnd->ShowWindow(SW_RESTORE); pPrevWnd->SetForegroundWindow(); pPrevWnd->GetLastActivePopup()-...
Minicap_flaskpython for minicapminicap的使用:准备对应文件:a、查看CPU架构(adb shell getprop ro.product.cpu.abi)及查看android版本level(adb shell getprop ro.build.version.sdk)b、根据获取的CPU和版本...
本文实例讲述了Android编程之防止反编译的实现方法。分享给大家供大家参考,具体如下: 1. 判断程序是否运行在模拟器上 boolean isRunningInEmualtor() { boolean qemuKernel = false; Process process = null; ...
base.getProp([obj, props, dft]) 概述 getProp() 函数按照一组键值的顺序去查询对象中的键值。 参数 obj 待查询的对象(或数组),如果传入非对象(也不是数组),那么返回 dft 默认值,如果默认值不存在,则返回空...
Android系统测试过程中, ...adb shell getprop命令,可以获取到Android设备iccid, imei,emmc磁盘容量等 adb shell wm size 可以读取到分辨率 adb shell cat /proc/cpuinfo 可以读取到cpu相关的信息 adb s
[GetProp] Caption=引用字典 Argument1=参数1:字典属性(字段类型为ItemProp)字段或字典(字段类型为ItemID)字段;第二个参数不添时为其它属性的Key. Argument2=参数2:如参数1为字典字段,表示字典属性(即字典服务中定义...
GetParent GetProp GetTopWindow GetWindow GetWindowLong GetWindowRect GetWindowText GetWindowTextLength IsChild IsIconic IsWindow IsWindowEnabled IsWindowUnicode ...
伊莱特 对于Golang API ... GetProp ( "power" ) checkError ( err ) fmt . Printf ( "Power is %s" , on [ 0 ].( string )) notifications , done , err := y . Listen () checkError ( err ) go func ()
代理与记者的不可知模拟对象。 $ npm install noo --save 如何使用 Noo 需要--harmony选项 $ node --harmony main.js $ coffee --nodejs --harmony main.js var Noo = require ( 'noo' ) ; var mock = Noo . ...
java 读取properties文件代码