Skip to content

Commit 0f780bb

Browse files
committed
Handle held calls correctly
1 parent fd272ec commit 0f780bb

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

app/src/main/java/com/huawei/ims/HwImsCallSession.kt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class HwImsCallSession// For outgoing (MO) calls
109109
mState = ImsCallSessionImplBase.State.ESTABLISHED
110110
if (listener != null)
111111
listener!!.callSessionInitiated(mProfile)
112-
} else if (rilImsCall!!.state == 1 && !confInProgress) { // HOLDING
112+
} else if (rilImsCall!!.state == 1 /* HOLDING */ && !confInProgress) { // HOLDING
113113
if (listener != null)
114114
listener!!.callSessionResumed(mProfile)
115115
} else {
@@ -258,14 +258,12 @@ class HwImsCallSession// For outgoing (MO) calls
258258
awaitingIdFromRIL[mCallee] = this // Do it sooner rather than later so that this call is not seen as a phantom
259259
RilHolder.getRadio(mSlotId)!!.imsDial(RilHolder.callback({ radioResponseInfo, _ ->
260260
if (radioResponseInfo.error == 0) {
261-
Rlog.e(tag, "MADE AN IMS CALL OMG WOW")
262-
Log.e(tag, "MADE AN IMS CALL OMG WOW")
261+
Rlog.d(tag, "successfully placed call")
263262
mInCall = true
264263
mState = ImsCallSessionImplBase.State.ESTABLISHED
265264
listener!!.callSessionInitiated(profile)
266265
} else {
267-
Rlog.e(tag, "Failed to make ims call :(")
268-
Log.e(tag, "failed to make ims call :(")
266+
Rlog.e(tag, "call failed")
269267
mState = ImsCallSessionImplBase.State.TERMINATED
270268
awaitingIdFromRIL.remove(callee, this)
271269
listener!!.callSessionInitiatedFailed(ImsReasonInfo())
@@ -324,7 +322,7 @@ class HwImsCallSession// For outgoing (MO) calls
324322
Rlog.e(tag, "Error listing ims calls!");
325323
}
326324
*/
327-
// The above doesn't work. So, we do it the huawei way, which is to hangup the call.
325+
// The above doesn't work. So, we do it the huawei way, which is to hangup the call. Reeee.
328326
mState = ImsCallSessionImplBase.State.TERMINATING
329327
try {
330328
getRilCallId()

app/src/main/java/com/huawei/ims/HwImsRadioIndication.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import android.telephony.Rlog
2323
import android.util.Log
2424
import vendor.huawei.hardware.radio.V1_0.*
2525
import vendor.huawei.hardware.radio.V1_0.IRadioIndication
26-
import java.util.*
2726

2827
class HwImsRadioIndication internal constructor(private val mSlotId: Int) : IRadioIndication.Stub() {
2928

@@ -34,6 +33,7 @@ class HwImsRadioIndication internal constructor(private val mSlotId: Int) : IRad
3433
// Huawei
3534
when (msgId) {
3635
1079 -> imsCallStateChanged(indicationType)
36+
1122 -> imsCallHeldChange(indicationType)
3737
else -> Log.w(tag, "Unknown indication type!")
3838
}
3939
}
@@ -51,6 +51,12 @@ class HwImsRadioIndication internal constructor(private val mSlotId: Int) : IRad
5151

5252
}
5353

54+
private fun imsCallHeldChange(indicationType: Int) {
55+
imsCallStateChanged(indicationType)
56+
// We can probably optimise this somehow but I don't know how. CallSession checks the status
57+
// If its held, it will send the correct notifications.
58+
}
59+
5460
override fun apDsFlowInfoReport(indicationType: Int, rapDsFlowInfoReport: RILAPDsFlowInfoReport) {
5561
// Huawei not needed
5662
}

0 commit comments

Comments
 (0)