diff options
author | Danny Baumann <dannybaumann@web.de> | 2013-08-06 07:33:02 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2013-08-06 07:33:02 +0000 |
commit | 0ae5729a428a0e472835139e0ae89f713cc35d21 (patch) | |
tree | 5c130532f88b8fdd85d95fa265c2bc896fd00b0e | |
parent | 23bd60795611ebf0f81489bd153db959a0caf0a0 (diff) | |
parent | 332fb18bd27c07c5d50ba1e0e5880e730a240c1b (diff) | |
download | frameworks_opt_telephony-0ae5729a428a0e472835139e0ae89f713cc35d21.zip frameworks_opt_telephony-0ae5729a428a0e472835139e0ae89f713cc35d21.tar.gz frameworks_opt_telephony-0ae5729a428a0e472835139e0ae89f713cc35d21.tar.bz2 |
Merge "Properly notify of precise call state change after connection hangup." into cm-10.1
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 |