Permalink
Browse files

Fix call forwarding indication.

The actual call reference is the Connection object, which is passed
around the call objects. Previously, it might have happened that a call
stayed in the forwarded call list because the connection owner at
disconnection time wasn't the same as at connection time. Avoid this by
managing the connections instead of the calls in the forwarded calls
list.

Change-Id: I02491773f8a1b154974b83f984e5aa16f535e35f
  • Loading branch information...
1 parent f928662 commit 13b0aa1e61319e127789468164593e4e6db70dcb @maniac103 committed Apr 24, 2012
Showing with 15 additions and 9 deletions.
  1. +15 −9 src/com/android/phone/CallNotifier.java
@@ -168,7 +168,7 @@
private boolean mHasRingingCall;
private boolean mNextGsmCallIsForwarded;
- private Set<Call> mForwardedCalls;
+ private Set<Connection> mForwardedCalls;
private Set<Call> mWaitingCalls;
// ToneGenerator instance for playing SignalInfo tones
@@ -209,7 +209,7 @@ public CallNotifier(PhoneApp app, Phone phone, Ringer ringer,
mCM = app.mCM;
mCallLog = callLog;
- mForwardedCalls = new HashSet<Call>();
+ mForwardedCalls = new HashSet<Connection>();
mWaitingCalls = new HashSet<Call>();
mAudioManager = (AudioManager) mApplication.getSystemService(Context.AUDIO_SERVICE);
@@ -242,7 +242,13 @@ public CallNotifier(PhoneApp app, Phone phone, Ringer ringer,
}
public boolean isCallForwarded(Call call) {
- return mForwardedCalls.contains(call);
+ for (Connection c : mForwardedCalls) {
+ if (call.hasConnection(c)) {
+ return true;
+ }
+ }
+
+ return false;
}
public boolean isCallHeldRemotely(Call call) {
@@ -412,7 +418,7 @@ private void onNewRingingConnection(AsyncResult r) {
Phone phone = ringing.getPhone();
if (phone.getPhoneType() == Phone.PHONE_TYPE_GSM && mNextGsmCallIsForwarded) {
- mForwardedCalls.add(ringing);
+ mForwardedCalls.add(c);
mNextGsmCallIsForwarded = false;
}
@@ -994,9 +1000,8 @@ private void onDisconnect(AsyncResult r) {
}
if (c != null) {
- Call call = c.getCall();
- mForwardedCalls.remove(call);
- mWaitingCalls.remove(call);
+ mForwardedCalls.remove(c);
+ mWaitingCalls.remove(c.getCall());
}
mCdmaVoicePrivacyState = false;
@@ -2047,9 +2052,10 @@ private void onSuppServiceNotification(AsyncResult r) {
if (notification.notificationType == SuppServiceNotification.NOTIFICATION_TYPE_MT) {
if (notification.code == SuppServiceNotification.MT_CODE_FORWARDED_CALL
|| notification.code == SuppServiceNotification.MT_CODE_DEFLECTED_CALL) {
- Call ringing = PhoneUtils.getGsmPhone(mCM).getRingingCall();
+ Phone gsmPhone = PhoneUtils.getGsmPhone(mCM);
+ Call ringing = gsmPhone.getRingingCall();
if (ringing.getState().isRinging()) {
- mForwardedCalls.add(ringing);
+ mForwardedCalls.add(PhoneUtils.getConnection(gsmPhone, ringing));
} else {
mNextGsmCallIsForwarded = true;
}

0 comments on commit 13b0aa1

Please sign in to comment.