summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2013-08-02 09:56:31 +0200
committerEthan Chen <intervigil@gmail.com>2013-08-03 16:12:38 -0700
commit332fb18bd27c07c5d50ba1e0e5880e730a240c1b (patch)
tree743546be6ee48941c81926abcddc01d6e2756e61
parent61aa925f47e4d0970739855236d91b2491f76ece (diff)
downloadframeworks_opt_telephony-332fb18bd27c07c5d50ba1e0e5880e730a240c1b.zip
frameworks_opt_telephony-332fb18bd27c07c5d50ba1e0e5880e730a240c1b.tar.gz
frameworks_opt_telephony-332fb18bd27c07c5d50ba1e0e5880e730a240c1b.tar.bz2
Properly notify of precise call state change after connection hangup.
When disconnecting connections via Connection.hangup(), previously no precise call state notification was sent out. This change should fix BT headsets ringing indefinitely after a blacklisted call came in, as BluetoothPhoneService can now update the headset state properly. Change-Id: I4439d7d8ed47e72da9d061b885ec9a0e6e1b784d
-rw-r--r--src/java/com/android/internal/telephony/cdma/CdmaCall.java5
-rw-r--r--src/java/com/android/internal/telephony/cdma/CdmaCallTracker.java16
-rwxr-xr-xsrc/java/com/android/internal/telephony/cdma/CdmaConnection.java6
-rw-r--r--src/java/com/android/internal/telephony/gsm/GsmCall.java6
-rw-r--r--src/java/com/android/internal/telephony/gsm/GsmCallTracker.java17
-rw-r--r--src/java/com/android/internal/telephony/gsm/GsmConnection.java6
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