Bug 1000705 - Fix fail cuase of local hang up. r=hsinyi a=1.3t+
authorSzu-Yu Chen [:aknow] <szchen@mozilla.com>
Tue, 29 Apr 2014 13:48:23 -0700
changeset 171833 bc5f0e461c9ecd6df64f4129dc804578a395abd2
parent 171832 3c5c7e61b5895156d68b4a478b0185cb37755fbe
child 171834 ed8eaa49ac4f53920d2071396a598333c51789a3
push id389
push userfdesre@mozilla.com
push dateTue, 29 Apr 2014 20:48:34 +0000
reviewershsinyi, 1.3t
bugs1000705
milestone28.1
Bug 1000705 - Fix fail cuase of local hang up. r=hsinyi a=1.3t+
dom/system/gonk/ril_worker.js
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -1527,16 +1527,18 @@ RilObject.prototype = {
     let callIndex = call.callIndex;
     if (callIndex === OUTGOING_PLACEHOLDER_CALL_INDEX) {
       if (DEBUG) this.context.debug("Hang up pending outgoing call.");
       this._hasHangUpPendingOutgoingCall = true;
       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) {
@@ -1605,16 +1607,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) {
@@ -3616,17 +3620,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;
       }