Merge "Update showCallScreen to use Telecomm (3/6) Remove unused methods." into lmp-preview-dev
diff --git a/src/com/android/services/telephony/PstnConnection.java b/src/com/android/services/telephony/PstnConnection.java
index 8157fca..1ad9b48 100644
--- a/src/com/android/services/telephony/PstnConnection.java
+++ b/src/com/android/services/telephony/PstnConnection.java
@@ -16,6 +16,8 @@
package com.android.services.telephony;
+import android.telephony.DisconnectCause;
+
import com.android.internal.telephony.Call;
import com.android.internal.telephony.CallStateException;
import com.android.internal.telephony.Connection;
@@ -55,11 +57,7 @@
protected void onReject() {
Log.i(this, "Reject call.");
if (isValidRingingCall(getOriginalConnection())) {
- try {
- mPhone.rejectCall();
- } catch (CallStateException e) {
- Log.e(this, e, "Failed to reject call.");
- }
+ hangup(DisconnectCause.INCOMING_REJECTED);
}
super.onReject();
}
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 5f2de83..0d84134 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -50,13 +50,13 @@
@Override
protected void onAbort() {
- hangup();
+ hangup(DisconnectCause.LOCAL);
super.onAbort();
}
@Override
protected void onDisconnect() {
- hangup();
+ hangup(DisconnectCause.LOCAL);
super.onDisconnect();
}
@@ -123,13 +123,16 @@
super.onSetAudioState(audioState);
}
- private void hangup() {
+ protected void hangup(int disconnectCause) {
if (mOriginalConnection != null) {
try {
- mOriginalConnection.hangup();
+ Call call = mOriginalConnection.getCall();
+ if (call != null) {
+ call.hangup();
+ }
// Set state deliberately since we are going to close() and will no longer be
// listening to state updates from mOriginalConnection
- setDisconnected(DisconnectCause.NORMAL, null);
+ setDisconnected(disconnectCause, null);
} catch (CallStateException e) {
Log.e(this, e, "Call to Connection.hangup failed with exception");
}