Bug 1070831 - Part 4: Internal architecture changes. r=aknow

This commit is contained in:
Ben Hsu 2014-12-21 17:35:00 +01:00
parent dfcee8ee7a
commit 4a272ff44b
4 changed files with 9 additions and 105 deletions

View File

@ -27,8 +27,6 @@ const MOBILECELLINFO_CID =
Components.ID("{0635d9ab-997e-4cdf-84e7-c1883752dff3}");
const MOBILECALLFORWARDINGOPTIONS_CID =
Components.ID("{e0cf4463-ee63-4b05-ab2e-d94bf764836c}");
const TELEPHONYDIALCALLBACK_CID =
Components.ID("{c2af1a5d-3649-44ef-a1ff-18e9ac1dec51}");
const NEIGHBORINGCELLINFO_CID =
Components.ID("{6078cbf1-f34c-44fa-96f8-11a88d4bfdd3}");
const GSMCELLINFO_CID =
@ -280,62 +278,6 @@ CdmaCellInfo.prototype = {
evdoSnr: INT32_MAX
};
/**
* Wrap a MobileConnectionCallback to a TelephonyDialCallback.
*/
function TelephonyDialCallback(aCallback) {
this.callback = aCallback;
}
TelephonyDialCallback.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsITelephonyDialCallback]),
classID: TELEPHONYDIALCALLBACK_CID,
notifyDialMMI: function(mmiServiceCode) {
this.serviceCode = mmiServiceCode;
},
notifyDialMMISuccess: function(statusMessage) {
this.callback.notifySendCancelMmiSuccess(this.serviceCode, statusMessage);
},
notifyDialMMISuccessWithInteger: function(statusMessage, additionalInfo) {
this.callback.notifySendCancelMmiSuccessWithInteger(this.serviceCode,
statusMessage,
additionalInfo);
},
notifyDialMMISuccessWithStrings: function(statusMessage, count, additionalInfo) {
this.callback.notifySendCancelMmiSuccessWithStrings(this.serviceCode,
statusMessage,
count,
additionalInfo);
},
notifyDialMMISuccessWithCallForwardingOptions: function(statusMessage, count, additionalInfo) {
this.callback.notifySendCancelMmiSuccessWithCallForwardingOptions(
this.serviceCode,
statusMessage,
count,
additionalInfo);
},
notifyDialMMIError: function(error) {
this.callback.notifyError(error, "", this.serviceCode);
},
notifyDialMMIErrorWithInfo: function(error, info) {
this.callback.notifyError(error, "", this.serviceCode, info);
},
notifyDialError: function() {
throw Cr.NS_ERROR_UNEXPECTED;
},
notifyDialSuccess: function() {
throw Cr.NS_ERROR_UNEXPECTED;
},
};
function MobileConnectionProvider(aClientId, aRadioInterface) {
this._clientId = aClientId;
this._radioInterface = aRadioInterface;
@ -833,24 +775,6 @@ MobileConnectionProvider.prototype = {
}).bind(this));
},
sendMMI: function(aMmi, aCallback) {
let callback = new TelephonyDialCallback(aCallback);
gGonkTelephonyService.dialMMI(this._clientId, aMmi, callback);
},
cancelMMI: function(aCallback) {
this._radioInterface.sendWorkerMessage("cancelUSSD", null,
(function(aResponse) {
if (aResponse.errorMsg) {
aCallback.notifyError(aResponse.errorMsg);
return false;
}
aCallback.notifySuccess();
return false;
}).bind(this));
},
setCallForwarding: function(aAction, aReason, aNumber, aTimeSeconds,
aServiceClass, aCallback) {
let options = {
@ -1190,18 +1114,6 @@ MobileConnectionService.prototype = {
this.getItemByServiceId(aClientId).updateDataInfo(aDataInfo);
},
notifyUssdReceived: function(aClientId, aMessage, aSessionEnded) {
if (DEBUG) {
debug("notifyUssdReceived for " + aClientId + ": " +
aMessage + " (sessionEnded : " + aSessionEnded + ")");
}
gMobileConnectionMessenger.notifyUssdReceived(aClientId, aMessage, aSessionEnded);
this.getItemByServiceId(aClientId)
.deliverListenerEvent("notifyUssdReceived", [aMessage, aSessionEnded]);
},
notifyDataError: function(aClientId, aMessage) {
if (DEBUG) {
debug("notifyDataError for " + aClientId + ": " + aMessage);

View File

@ -73,6 +73,10 @@ RILSystemMessengerHelper.prototype = {
aDuration, aOutgoing, aHangUpLocal);
},
notifyUssdReceived: function(aServiceId, aMessage, aSessionEnded) {
this.messenger.notifyUssdReceived(aServiceId, aMessage, aSessionEnded);
},
/**
* nsISmsMessenger API
*/
@ -100,10 +104,6 @@ RILSystemMessengerHelper.prototype = {
/**
* nsIMobileConnectionMessenger API
*/
notifyUssdReceived: function(aServiceId, aMessage, aSessionEnded) {
this.messenger.notifyUssdReceived(aServiceId, aMessage, aSessionEnded);
},
notifyCdmaInfoRecDisplay: function(aServiceId, aDisplay) {
this.messenger.notifyCdmaInfoRecDisplay(aServiceId, aDisplay);
},

View File

@ -2655,7 +2655,7 @@ RilObject.prototype = {
options.ussd = mmi.fullMMI;
if (options.startNewSession && this._ussdSession) {
if (this._ussdSession) {
if (DEBUG) this.context.debug("Cancel existing ussd session.");
this.cachedUSSDRequest = options;
this.cancelUSSD({});

View File

@ -566,7 +566,7 @@ TelephonyService.prototype = {
return;
}
this._dialMMI(aClientId, mmi, aCallback, true);
this._dialMMI(aClientId, mmi, aCallback);
}
}
},
@ -664,15 +664,14 @@ TelephonyService.prototype = {
* @param aStartNewSession
* True to start a new session for ussd request.
*/
_dialMMI: function(aClientId, aMmi, aCallback, aStartNewSession) {
_dialMMI: function(aClientId, aMmi, aCallback) {
let mmiServiceCode = aMmi ?
this._serviceCodeToKeyString(aMmi.serviceCode) : RIL.MMI_KS_SC_USSD;
aCallback.notifyDialMMI(mmiServiceCode);
this._sendToRilWorker(aClientId, "sendMMI",
{ mmi: aMmi,
startNewSession: aStartNewSession }, response => {
{ mmi: aMmi }, response => {
if (DEBUG) debug("MMI response: " + JSON.stringify(response));
if (!response.success) {
@ -1304,13 +1303,7 @@ TelephonyService.prototype = {
aMessage + " (sessionEnded : " + aSessionEnded + ")");
}
gGonkMobileConnectionService.notifyUssdReceived(aClientId, aMessage,
aSessionEnded);
},
dialMMI: function(aClientId, aMmiString, aCallback) {
let mmi = this._parseMMI(aMmiString, this._hasCalls(aClientId));
this._dialMMI(aClientId, mmi, aCallback, false);
gTelephonyMessenger.notifyUssdReceived(aClientId, aMessage, aSessionEnded);
},
/**
@ -1357,7 +1350,6 @@ USSDReceivedWrapper.prototype = {
let event = new aWindow.USSDReceivedEvent("ussdreceived", {
serviceId: aMessage.serviceId,
message: aMessage.message,
sessionEnded: aMessage.sessionEnded,
session: session
});