0

I would like to get an adb command with a response of a code that map to current call state

the call state I mean are those in following link

https://developer.android.com/reference/android/telecom/Call.html#STATE_ACTIVE

those values are more representative and getting those values in command shell upon executing the adb command will be very helpful for me

I have only managed to get them on a log as per following command

adb logcat -d | findstr -i InCallFragment.setCallState

but I couldnot get the state value as a response of any adb command

Any help will be much appreciated Thanks

for more illustration please connect a phone to the PC , do a phone call and end it use the above command to dump the buffer refer to the state value

3 Answers3

1

You can use adb shell service call telecom [code] command. The codes for getCallState() will be different depending on the Android version:

6.0.1: 26
7.0.0: 27
7.1.0: 27
7.1.2: 27
8.0.0: 29
8.1.0: 29
Alex P.
  • 30,437
  • 17
  • 118
  • 169
  • thanks for the reply , I have tried your solution yet I don't think it gives me what I want , it returns only zero for idle and 2 for active call ... please correct me if I am wrong – Mohamed Heiba Jan 25 '18 at 12:16
  • Please take a look at the link in the topic , you will find that the state of call while change to around 10 different states depending on call state , I would like to get those value in the shell as I pass an ADB command – Mohamed Heiba Jan 25 '18 at 12:18
0

I have achieved what you want to do by modifying a custom ROM (LineageOS) and adding an android.util.Log line to print every state.

In my case I modified class:

Call

frameworks/opt/telephony/src/java/com/android/internal/telephony/Call.java

And what I did is inside getState(...) method, adding this line:

Log.i(myTAG, "getState state->" + mState.name());

With this what I have to do is search for myTAG in adb logcat.

I think otherwise you wont be able to do it...

barbudito
  • 548
  • 1
  • 6
  • 16
  • Thanks for the reply , but I think that getting a new ROM will change my test environment , which is not what I intend to do at all . – Mohamed Heiba Jan 24 '18 at 12:44
  • Adding this method , Do we have the permission to add such code to the android OS , How to do so ?? – Mohamed Heiba Jan 24 '18 at 12:46
  • I sync lineage os repo and made my changes... After that I had to compile that ROM. No permissions were necessary because every state is written in logcat – barbudito Jan 24 '18 at 12:53
0

You can dumpsys telecomm service:

adb shell dumpsys telecom
CallsManager: 
mCalls:
[TC@7, ACTIVE, com.android.phone/com.android.services.telephony.TelephonyConnectionService, tel:***, A, childs(0), has_parent(false), [Capabilities: CAPABILITY_HOLD CAPABILITY_SUPPORT_HOLD CAPABILITY_MUTE CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO], [Properties:]]
mCallAudioManager:
All calls:
  TC@7
Active dialing, or connecting calls:
  TC@7
Ringing calls:
Holding calls:
Foreground call:
[TC@7, ACTIVE, com.android.phone/com.android.services.telephony.TelephonyConnectionService, tel:***, A, childs(0), has_parent(false), [Capabilities: CAPABILITY_HOLD CAPABILITY_SUPPORT_HOLD CAPABILITY_MUTE CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO], [Properties:]]
mTtyManager:
mCurrentTtyMode: 0
mInCallController:
mInCallServices (InCalls registered):
.
.
Call TC@7 [2018-06-05 14:38:41.505](MO - outgoing)
  To address: tel:***
  14:38:41.508 - CREATED:PCR.oR@DMA
  14:38:41.511 - SET_CONNECTING (ComponentInfo{com.android.phone/com.android.services.telephony.TelephonyConnectionService}, [8c3d1caa626a79d75b154221ea94852a62fee7b3], UserHandle{0}):PCR.oR@DMA
  14:38:41.847 - AUDIO_ROUTE (Leaving state QuiescentEarpieceRoute):PCR.oR->CAMSM.pM_2001->CARSM.pM_SWITCH_FOCUS@DMA_2_2
  14:38:41.847 - AUDIO_ROUTE (Entering state ActiveEarpieceRoute):PCR.oR->CAMSM.pM_2001->CARSM.pM_SWITCH_FOCUS@DMA_2_2
  14:38:43.442 - BIND_CS (ComponentInfo{com.android.phone/com.android.services.telephony.TelephonyConnectionService}):NOCBIR.oR@DMU
  14:38:43.519 - CS_BOUND (ComponentInfo{com.android.phone/com.android.services.telephony.TelephonyConnectionService}):SBC.oSC@DMY
  14:38:43.519 - START_CONNECTION (tel:***):SBC.oSC@DMY
  14:38:43.703 - CAPABILITY_CHANGE (Current: [[ sup_hld mut !v2a]], Removed [[]], Added [[ sup_hld mut !v2a]]):CSW.hCCC@DMg
  14:38:43.706 - SET_DIALING (successful outgoing call):CSW.hCCC@DMg
  14:38:47.560 - SET_ACTIVE (active set explicitly):CSW.sA@DNM
  14:38:47.639 - CAPABILITY_CHANGE (Current: [[ hld sup_hld mut !v2a]], Removed [[]], Added [[ hld]]):CSW.sCC@DNY
  Timings (average for this call, milliseconds):
    bind_cs: 77.00
    outgoing_time_to_dialing: 187.00
You Kim
  • 2,355
  • 1
  • 10
  • 11