diff options
6 files changed, 30 insertions, 26 deletions
diff --git a/src/java/com/android/internal/telephony/cdma/CdmaCall.java b/src/java/com/android/internal/telephony/cdma/CdmaCall.java index 4ad61bb..08d10ec 100644 --- a/src/java/com/android/internal/telephony/cdma/CdmaCall.java +++ b/src/java/com/android/internal/telephony/cdma/CdmaCall.java @@ -115,7 +115,7 @@ public final class CdmaCall extends Call { /** * Called by CdmaConnection when it has disconnected */ - void + boolean connectionDisconnected(CdmaConnection conn) { if (state != State.DISCONNECTED) { /* If only disconnected connections remain, we are disconnected*/ @@ -133,8 +133,11 @@ public final class CdmaCall extends Call { if (hasOnlyDisconnectedConnections) { state = State.DISCONNECTED; + return true; } } + + return false; } diff --git a/src/java/com/android/internal/telephony/cdma/CdmaCallTracker.java b/src/java/com/android/internal/telephony/cdma/CdmaCallTracker.java index ad671d3..6b93561 100644 --- a/src/java/com/android/internal/telephony/cdma/CdmaCallTracker.java +++ b/src/java/com/android/internal/telephony/cdma/CdmaCallTracker.java @@ -497,6 +497,7 @@ public final class CdmaCallTracker extends CallTracker { Connection newRinging = null; //or waiting boolean hasNonHangupStateChanged = false; // Any change besides // a dropped connection + boolean hasAnyCallDisconnected = false; boolean needsPollDelay = false; boolean unknownConnectionAppeared = false; @@ -687,14 +688,11 @@ public final class CdmaCallTracker extends CallTracker { log("setting cause to " + cause); } droppedDuringPoll.remove(i); - conn.onDisconnect(cause); - } else if (conn.cause == Connection.DisconnectCause.LOCAL) { - // Local hangup + hasAnyCallDisconnected |= conn.onDisconnect(cause); + } else if (conn.cause == Connection.DisconnectCause.LOCAL + || conn.cause == Connection.DisconnectCause.INVALID_NUMBER) { droppedDuringPoll.remove(i); - conn.onDisconnect(Connection.DisconnectCause.LOCAL); - } else if (conn.cause == Connection.DisconnectCause.INVALID_NUMBER) { - droppedDuringPoll.remove(i); - conn.onDisconnect(Connection.DisconnectCause.INVALID_NUMBER); + hasAnyCallDisconnected |= conn.onDisconnect(conn.cause); } } @@ -713,7 +711,7 @@ public final class CdmaCallTracker extends CallTracker { // 1) the phone has started to ring // 2) A Call/Connection object has changed state... // we may have switched or held or answered (but not hung up) - if (newRinging != null || hasNonHangupStateChanged) { + if (newRinging != null || hasNonHangupStateChanged || hasAnyCallDisconnected) { internalClearDisconnected(); } @@ -723,7 +721,7 @@ public final class CdmaCallTracker extends CallTracker { phone.notifyUnknownConnection(); } - if (hasNonHangupStateChanged || newRinging != null) { + if (hasNonHangupStateChanged || newRinging != null || hasAnyCallDisconnected) { phone.notifyPreciseCallStateChanged(); } diff --git a/src/java/com/android/internal/telephony/cdma/CdmaConnection.java b/src/java/com/android/internal/telephony/cdma/CdmaConnection.java index de5053b..07be405 100755 --- a/src/java/com/android/internal/telephony/cdma/CdmaConnection.java +++ b/src/java/com/android/internal/telephony/cdma/CdmaConnection.java @@ -446,8 +446,9 @@ public class CdmaConnection extends Connection { } /** Called when the radio indicates the connection has been disconnected */ - /*package*/ void + /*package*/ boolean onDisconnect(DisconnectCause cause) { + boolean changed = false; this.cause = cause; if (!disconnected) { @@ -458,10 +459,11 @@ public class CdmaConnection extends Connection { owner.phone.notifyDisconnect(this); if (parent != null) { - parent.connectionDisconnected(this); + changed = parent.connectionDisconnected(this); } } releaseWakeLock(); + return changed; } /** Called when the call waiting connection has been hung up */ diff --git a/src/java/com/android/internal/telephony/gsm/GsmCall.java b/src/java/com/android/internal/telephony/gsm/GsmCall.java index 58124a2..a0de7cf 100644 --- a/src/java/com/android/internal/telephony/gsm/GsmCall.java +++ b/src/java/com/android/internal/telephony/gsm/GsmCall.java @@ -111,7 +111,7 @@ class GsmCall extends Call { /** * Called by GsmConnection when it has disconnected */ - void + boolean connectionDisconnected(GsmConnection conn) { if (state != State.DISCONNECTED) { /* If only disconnected connections remain, we are disconnected*/ @@ -129,10 +129,12 @@ class GsmCall extends Call { if (hasOnlyDisconnectedConnections) { state = State.DISCONNECTED; + return true; } } - } + return false; + } /*package*/ void detach(GsmConnection conn) { diff --git a/src/java/com/android/internal/telephony/gsm/GsmCallTracker.java b/src/java/com/android/internal/telephony/gsm/GsmCallTracker.java index 1ebc902..3af3881 100644 --- a/src/java/com/android/internal/telephony/gsm/GsmCallTracker.java +++ b/src/java/com/android/internal/telephony/gsm/GsmCallTracker.java @@ -432,6 +432,7 @@ public final class GsmCallTracker extends CallTracker { Connection newRinging = null; //or waiting boolean hasNonHangupStateChanged = false; // Any change besides // a dropped connection + boolean hasAnyCallDisconnected = false; boolean needsPollDelay = false; boolean unknownConnectionAppeared = false; @@ -595,15 +596,11 @@ public final class GsmCallTracker extends CallTracker { log("setting cause to " + cause); } droppedDuringPoll.remove(i); - conn.onDisconnect(cause); - } else if (conn.cause == Connection.DisconnectCause.LOCAL) { - // Local hangup + hasAnyCallDisconnected |= conn.onDisconnect(cause); + } else if (conn.cause == Connection.DisconnectCause.LOCAL + || conn.cause == Connection.DisconnectCause.INVALID_NUMBER) { droppedDuringPoll.remove(i); - conn.onDisconnect(Connection.DisconnectCause.LOCAL); - } else if (conn.cause == - Connection.DisconnectCause.INVALID_NUMBER) { - droppedDuringPoll.remove(i); - conn.onDisconnect(Connection.DisconnectCause.INVALID_NUMBER); + hasAnyCallDisconnected |= conn.onDisconnect(conn.cause); } } @@ -622,7 +619,7 @@ public final class GsmCallTracker extends CallTracker { // 1) the phone has started to ring // 2) A Call/Connection object has changed state... // we may have switched or held or answered (but not hung up) - if (newRinging != null || hasNonHangupStateChanged) { + if (newRinging != null || hasNonHangupStateChanged || hasAnyCallDisconnected) { internalClearDisconnected(); } @@ -632,7 +629,7 @@ public final class GsmCallTracker extends CallTracker { phone.notifyUnknownConnection(); } - if (hasNonHangupStateChanged || newRinging != null) { + if (hasNonHangupStateChanged || newRinging != null || hasAnyCallDisconnected) { phone.notifyPreciseCallStateChanged(); } diff --git a/src/java/com/android/internal/telephony/gsm/GsmConnection.java b/src/java/com/android/internal/telephony/gsm/GsmConnection.java index 59aa12a..eb85a21 100644 --- a/src/java/com/android/internal/telephony/gsm/GsmConnection.java +++ b/src/java/com/android/internal/telephony/gsm/GsmConnection.java @@ -411,8 +411,9 @@ public class GsmConnection extends Connection { } /** Called when the radio indicates the connection has been disconnected */ - /*package*/ void + /*package*/ boolean onDisconnect(DisconnectCause cause) { + boolean changed = false; this.cause = cause; if (!disconnected) { @@ -428,10 +429,11 @@ public class GsmConnection extends Connection { owner.phone.notifyDisconnect(this); if (parent != null) { - parent.connectionDisconnected(this); + changed = parent.connectionDisconnected(this); } } releaseWakeLock(); + return changed; } // Returns true if state has changed, false if nothing changed |