Adb shell命令打电话测试4G

Adb shell命令打电话测试4G


在没有显示屏的情况下,怎么测试4G的打电话和上网功能:


1.上网功能测试

route命令看路由信息

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

10.157.91.16 * 255.255.255.252 U 0 0 0 rmnet_d0

ifconfig命令获取到相关的信息:

rmnet_data0 Link encap:UNSPEC

inet addr:10.157.91.17 Mask:255.255.255.252

inet6 addr:fe80::87df:218e:da9f:bc8e/64 Scope: Link

UP RUNNING MTU:1500 Metric:1

RX packets:44 errors:0dropped:0 overruns:0 frame:0

TX packets:56 errors:0dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:33661 TX bytes:4928 

这里的inet addr:10.157.91.17ip地址


然后pingwww.baidu.com

PING www.a.shifen.com (163.177.151.110)56(84) bytes of data.

64 bytes from 163.177.151.110:icmp_seq=1 ttl=51 time=197 ms

64 bytes from 163.177.151.110:icmp_seq=2 ttl=51 time=43.3 ms

64 bytes from 163.177.151.110:icmp_seq=3 ttl=51 time=47.4 ms 

根据上面的测试结果,表示上网功能ok


2.打电话测试

要测试这个功能,需要用adbshell service listandroid系统中有哪些service

Found134 services:

0 qtitetherservice:[com.qualcomm.qti.tetherstatsextension.ITetherService]

1 AtCmdFwd:[com.qualcomm.atfwd.IAtCmdFwd]

2 dpmservice:[com.qti.dpm.IDpmService]

3 qti.ims.ext:[org.codeaurora.ims.internal.IQtiImsExt]

4 ims:[com.android.ims.internal.IImsService]

5 sip:[android.net.sip.ISipService]

6 com.qualcomm.location.izat.IzatService:[com.qualcomm.location.izat.IIzatService]

7 nfc:[android.nfc.INfcAdapter]

8 carrier_config:[com.android.internal.telephony.ICarrierConfigLoader]

9 phone:[com.android.internal.telephony.Itelephony]

…………..

phoneservice提供一些接口供其他进程调用。PhoneInterfaceManager是一个Service,在被创建时通过ServiceManager注册自己,他作为Telephony对外的接口,可以接受其他进程向Telephony的请求,我们通过该Service所继承的AIDL文件就能看到他所提供的具体功能:


frameworks/base/telephony/java/com/android/internal/telephony

/**

* Interface used to interact with the phone. Mostly this is used bythe

* TelephonyManager class. A few places are still using thisdirectly.

* Please clean them up if possible and use TelephonyManager instead.

*

* {@hide}

*/

interfaceITelephony {


/**

* Dial a number. This doesn't place the call. It displays

* the Dialer screen.

* @param number the number to be dialed. If null, this

* would display the Dialer screen with no number pre-filled.

*/

void dial(String number);


/**

* Place a call to the specified number.

* @param callingPackage The package making the call.

* @param number the number to be called.

*/

void call(String callingPackage, String number);


/**

* End call if there is a call in progress, otherwise doesnothing.

*

* @return whether it hung up

*/

boolean en3dCall();

…

}

具体怎么用呢.adbshell service call phone

service:No service specified for call

Usage:service [-h|-?]

service list

service check SERVICE

service call SERVICE CODE [i32 N | i64 N | f N | d N | s16 STR] ...

Options:

i32: Write the 32-bit integer N into the send parcel.

i64: Write the 64-bit integer N into the send parcel.

f: Write the 32-bit single-precision number N into the sendparcel.

d: Write the 64-bit double-precision number N into the sendparcel.

s16: Write the UTF-16 string STR into the send parcel.

SERVICE: 执行的service名称
CODE: 执行的方法id

i32INT | s16 STR:参数类型以及紧跟参数值,i32代表int类型,s16代表String类型。


比如ITelephony的第1个方法dial用法

adbshell service call phone 1 s16 "10000"

Result:Parcel(00000000 '.…')

此方法只是显示拨号界面,还需要点击拨号图标才会拨号.


我们可以通过手机往设备打电话.然后通过113方法来判断.11方法是isIdle(),3方法是en3dCall().

root@xxx:~#adb shell service call phone 11---------------此时手机给设备打电话,查询状态结果为1

Result:Parcel(00000000 00000001 '........')

root@xxx:~#adb shell service call phone 3-----------------挂断电话

Result:Parcel(00000000 00000001 '........')

root@xxx:~#adb shell service call phone 11------------再查询状态为0

Result:Parcel(00000000 00000000 '........')


找到另一种方法

adbshell am start -a android.intent.action.CALL -d tel:10010

挂断:adbshell service call phone 3


参考:

adb操作手机打电话、发短信

http://blog.csdn.net/jethai/article/details/52345081


adbshell命令整理之service

http://blog.csdn.net/mr_oldcold/article/details/53761759


你可能感兴趣的:(Android调试工具)