0

Objective: I want to automate call related scenario using android uiautomator in android 6.0.1 devices. But not able to get UI hierarchy in incall screen (Mute, Spearker On, Keypad, Addcall etc.)

Note: I am not using any appium server

Error: "Error obtaining UI hierarchy" Reason: Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist!

Observations:

  1. adb devices is listing the device and we can access /data/local/tmp/ directory
  2. restarted device, restarted pc, relaunch of uiautomatorviewer
  3. adb shell input tap x y is working (but don't want to use co-ordinates in scripts files)

please assist in finding a solution in order to automate phone app incall scenarios like "mute" , "unmute" , "dtmf pressing keypad numbers", "speaker on" speaker off".

Is there any way to perform such actions via adb ?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
  • Possible duplicate of [How to make a call via pc by ADB command on android?](http://stackoverflow.com/questions/4923550/how-to-make-a-call-via-pc-by-adb-command-on-android) – Rajeev Dixit Sep 16 '16 at 09:31

1 Answers1

0

You can simply call adb command to invoke the caller service.

To dial (not call) a number from ADB, run the following ADB shell command:

$ adb shell service call phone 1 s16 "9302939203"
Result: Parcel(00000000    '....')

To make a call from ADB, we just need to change the way we call the service command:

$ adb shell service call phone 2 s16 "1" s16 "9302939203"
Result: Parcel(00000000    '....')

An alternative command is also there to make a phone call from ADB:

$ adb shell am start -a android.intent.action.CALL -d tel:9302939203
Starting: Intent { act=android.intent.action.CALL dat=tel:xxxxxxxxxxx }
Rajeev Dixit
  • 1,533
  • 2
  • 16
  • 25