Bug 1000705 - Fix fail cause of local hang up. r=hsinyi
authorSzu-Yu Chen [:aknow] <szchen@mozilla.com>
Fri, 25 Apr 2014 03:05:00 -0400
changeset 180835 e0d492d43a5e4ae72c9aaf4fcb4b047ef68b7987
parent 180834 d353282fc0a6f001e30003c136ede5525dd03f87
child 180836 dffd1ba94ac6450777dfab8f77b6139b900247d1
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewershsinyi
bugs1000705
milestone31.0a1
Bug 1000705 - Fix fail cause of local hang up. r=hsinyi
dom/system/gonk/ril_worker.js
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -1546,16 +1546,18 @@ RilObject.prototype = {
 
     let callIndex = call.callIndex;
     if (callIndex === OUTGOING_PLACEHOLDER_CALL_INDEX) {
       if (DEBUG) this.context.debug("Hang up pending outgoing call.");
       this._removeVoiceCall(call, GECKO_CALL_ERROR_NORMAL_CALL_CLEARING);
       return;
     }
 
+    call.hangUpLocal = true;
+
     if (call.state === CALL_STATE_HOLDING) {
       this.sendHangUpBackgroundRequest(callIndex);
     } else {
       this.sendHangUpRequest(callIndex);
     }
   },
 
   sendHangUpRequest: function(callIndex) {
@@ -1624,16 +1626,18 @@ RilObject.prototype = {
     // notification the incoming/waiting call may have changed. The main
     // thread thinks that it is rejecting the call with the given index,
     // so only reject if that is still incoming/waiting.
     let call = this.currentCalls[options.callIndex];
     if (!call) {
       return;
     }
 
+    call.hangUpLocal = true;
+
     let Buf = this.context.Buf;
     if (this._isCdma) {
       // AT+CHLD=0 means "release held or UDUB."
       Buf.simpleRequest(REQUEST_HANGUP_WAITING_OR_BACKGROUND);
       return;
     }
 
     switch (call.state) {
@@ -3757,17 +3761,19 @@ RilObject.prototype = {
       }
 
       // Call is no longer reported by the radio. Remove from our map and send
       // disconnected state change.
       if (!newCall) {
         if (this.currentConference.participants[currentCall.callIndex]) {
           conferenceChanged = true;
         }
-        this._removeVoiceCall(currentCall);
+        this._removeVoiceCall(currentCall,
+                              currentCall.hangUpLocal ?
+                                GECKO_CALL_ERROR_NORMAL_CALL_CLEARING : null);
         continue;
       }
 
       // Call is still valid.
       if (newCall.state == currentCall.state &&
           newCall.isMpty == currentCall.isMpty) {
         continue;
       }