Add a check to see if a call has been disconnected
Previously, we would retrieve the currently active Foreground call to
determine whether or not it is a an emergency call. The utility for
finding the currently active call includes calls in the DISCONNECTED
state, however, which would keep Airplane mode from turning on even if
the call was ended.
This change adds an additional check to be sure that the call is not in the
DISCONNECTED state before determining whether or not the call was an
emergency call.
Change-Id: Id694d8b8ef66845c834e37dba5f0077c7f145b67
Fix: 27942284
diff --git a/src/com/android/phone/PhoneUtils.java b/src/com/android/phone/PhoneUtils.java
index aa62575..e87b9a7 100644
--- a/src/com/android/phone/PhoneUtils.java
+++ b/src/com/android/phone/PhoneUtils.java
@@ -1853,10 +1853,14 @@
}
static boolean isInEmergencyCall(CallManager cm) {
- for (Connection cn : cm.getActiveFgCall().getConnections()) {
- if (PhoneNumberUtils.isLocalEmergencyNumber(PhoneGlobals.getInstance(),
- cn.getAddress())) {
- return true;
+ Call fgCall = cm.getActiveFgCall();
+ // isIdle includes checks for the DISCONNECTING/DISCONNECTED state.
+ if(!fgCall.isIdle()) {
+ for (Connection cn : fgCall.getConnections()) {
+ if (PhoneNumberUtils.isLocalEmergencyNumber(PhoneGlobals.getInstance(),
+ cn.getAddress())) {
+ return true;
+ }
}
}
return false;