From 07502ed69e6d6a1830c168aada4c59ab0220bd24 Mon Sep 17 00:00:00 2001 From: Matt Porter Date: Sun, 21 May 2017 08:16:20 -0400 Subject: Add incoming call rejection to telephony binding and phone UI Adds support for disconnection of an alerting incoming call to the telephony binding via the hangup verb. This is support in the phone UI by an additional button being loaded in the incoming call state allowing the user to decline to answer the call or use the already present answer call button to accept it. AGL-Bug: SPEC-601 Change-Id: I56ad0b813c0f1f24688709d180c3c061d7511651 Signed-off-by: Matt Porter --- app/Dialer.qml | 18 +++++++++++++++++- telephony-binding/telephony-binding.c | 4 ++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/app/Dialer.qml b/app/Dialer.qml index 51f6a53..be13ec5 100644 --- a/app/Dialer.qml +++ b/app/Dialer.qml @@ -54,14 +54,18 @@ Item { onCallStatusChanged: { if (callStatus == "incoming") { ringtone.active = true + rejectButton.active = true callStatusLabel.text = "Incoming call from " + callClipColp } else if (callStatus == "dialing") { callStatusLabel.text = "Dialing " + callClipColp } else if (callStatus == "active") { + rejectButton.active = false callTimer.startTime = getTime() callTimer.restart() } else if (callStatus == "disconnected") { ringtone.active = false + rejectButton.active = false + callButton.checked = false callTimer.stop() callStatusLabel.text = "" } @@ -167,7 +171,7 @@ Item { Layout.alignment: Qt.AlignHCenter onImage: './images/HMI_Phone_Hangup.svg' offImage: './images/HMI_Phone_Call.svg' - property var active: (number.text.length > 0) || (telephony.callStatus == "incoming") + property var active: (number.text.length > 0) || (telephony.callStatus == "incoming") || (telephony.callStatus == "active") opacity: active ? 1 : 0.25 onCheckedChanged: { @@ -195,6 +199,18 @@ Item { } } + Loader { + id: rejectButton + Layout.alignment: Qt.AlignHCenter + active: false + sourceComponent: ImageButton { + offImage: './images/HMI_Phone_Hangup.svg' + onClicked: { + telephony.hangup() + } + } + } + ListView { Layout.fillWidth: true Layout.preferredHeight: 130 diff --git a/telephony-binding/telephony-binding.c b/telephony-binding/telephony-binding.c index 41164f0..e3c6d2f 100644 --- a/telephony-binding/telephony-binding.c +++ b/telephony-binding/telephony-binding.c @@ -64,6 +64,10 @@ static void hangup(struct afb_req request) DEBUG(interface, "Hangup voice call\n"); ofono_voicecall_hangup(voice_call); afb_req_success(request, NULL, NULL); + } else if (incoming_call) { + DEBUG(interface, "Reject incoming call\n"); + ofono_voicecall_hangup(incoming_call); + afb_req_success(request, NULL, NULL); } else { ERROR(interface, "Hangup: no active call"); afb_req_fail(request, "failed hangup", NULL); -- cgit 1.2.3-korg