mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 1110619 - Part 2: Implementation Changes. r=echen
--HG-- extra : rebase_source : 1b6e744494e8831826d45fef5ec4a48ffdc8841c
This commit is contained in:
parent
686572f7d9
commit
e8573be274
@ -1127,6 +1127,13 @@ MobileConnection::NotifyNetworkSelectionModeChanged()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileConnection::NotifyDeviceIdentitiesChanged()
|
||||
{
|
||||
// To be supported when bug 1222870 is required in m-c.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIIccListener
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -462,6 +462,22 @@ CdmaCellInfo.prototype = {
|
||||
evdoSnr: UNKNOWN_VALUE
|
||||
};
|
||||
|
||||
function MobileDeviceIdentities(aImei, aImeisv, aEsn, aMeid) {
|
||||
this.imei = aImei;
|
||||
this.imeisv = aImeisv;
|
||||
this.esn = aEsn;
|
||||
this.meid = aMeid;
|
||||
}
|
||||
MobileDeviceIdentities.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIMobileDeviceIdentities]),
|
||||
|
||||
// nsIMobileDeviceIdentities
|
||||
imei: null,
|
||||
imeisv: null,
|
||||
esn: null,
|
||||
meid: null
|
||||
};
|
||||
|
||||
function MobileConnectionProvider(aClientId, aRadioInterface) {
|
||||
this._clientId = aClientId;
|
||||
this._radioInterface = aRadioInterface;
|
||||
@ -501,6 +517,7 @@ MobileConnectionProvider.prototype = {
|
||||
lastKnownNetwork: null,
|
||||
lastKnownHomeNetwork: null,
|
||||
supportedNetworkTypes: null,
|
||||
deviceIdentities: null,
|
||||
|
||||
/**
|
||||
* A utility function to dump debug message.
|
||||
@ -961,6 +978,17 @@ MobileConnectionProvider.prototype = {
|
||||
aServiceClass]);
|
||||
},
|
||||
|
||||
notifyDeviceIdentitiesChanged: function(aImei, aImeisv, aEsn, aMeid) {
|
||||
if (this.deviceIdentities) {
|
||||
if (DEBUG) this._debug("deviceIdentities shall not be changed once being updated.");
|
||||
return;
|
||||
}
|
||||
|
||||
this.deviceIdentities =
|
||||
new MobileDeviceIdentities(aImei, aImeisv, aEsn, aMeid);
|
||||
this.deliverListenerEvent("notifyDeviceIdentitiesChanged");
|
||||
},
|
||||
|
||||
getSupportedNetworkTypes: function(aTypes) {
|
||||
aTypes.value = this.supportedNetworkTypes.slice();
|
||||
return aTypes.value.length;
|
||||
@ -1693,6 +1721,12 @@ MobileConnectionService.prototype = {
|
||||
.notifyCdmaInfoRecAudioControl(aClientId, aUpLink, aDownLink);
|
||||
},
|
||||
|
||||
notifyDeviceIdentitiesChanged: function(aClientId, aImei, aImeisv,
|
||||
aEsn, aMeid) {
|
||||
this.getItemByServiceId(aClientId)
|
||||
.notifyDeviceIdentitiesChanged(aImei, aImeisv, aEsn, aMeid);
|
||||
},
|
||||
|
||||
/**
|
||||
* nsIObserver interface.
|
||||
*/
|
||||
|
@ -107,6 +107,12 @@ MobileConnectionChild::GetRadioState(int32_t* aRadioState)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileConnectionChild::GetDeviceIdentities(nsIMobileDeviceIdentities** aIdentities)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileConnectionChild::GetSupportedNetworkTypes(int32_t** aTypes,
|
||||
uint32_t* aLength)
|
||||
|
@ -288,6 +288,13 @@ MobileConnectionParent::NotifyNetworkSelectionModeChanged()
|
||||
return SendNotifyNetworkSelectionModeChanged(mode) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileConnectionParent::NotifyDeviceIdentitiesChanged()
|
||||
{
|
||||
// To be supported when bug 1222870 is required in m-c.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* PMobileConnectionRequestParent
|
||||
******************************************************************************/
|
||||
|
@ -1410,7 +1410,9 @@ SmsSendingScheduler.prototype = {
|
||||
notifyClirModeChanged: function(mode) {},
|
||||
notifyLastKnownNetworkChanged: function() {},
|
||||
notifyLastKnownHomeNetworkChanged: function() {},
|
||||
notifyNetworkSelectionModeChanged: function() {}
|
||||
notifyNetworkSelectionModeChanged: function() {},
|
||||
notifyDeviceIdentitiesChanged: function() {}
|
||||
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SmsService]);
|
||||
|
@ -941,7 +941,9 @@ DataCallHandler.prototype = {
|
||||
|
||||
notifyLastKnownHomeNetworkChanged: function() {},
|
||||
|
||||
notifyNetworkSelectionModeChanged: function() {}
|
||||
notifyNetworkSelectionModeChanged: function() {},
|
||||
|
||||
notifyDeviceIdentitiesChanged: function() {}
|
||||
};
|
||||
|
||||
function DataCall(aClientId, aApnSetting, aDataCallHandler) {
|
||||
|
@ -768,6 +768,13 @@ RadioInterface.prototype = {
|
||||
case "otastatuschange":
|
||||
gMobileConnectionService.notifyOtaStatusChanged(this.clientId, message.status);
|
||||
break;
|
||||
case "deviceidentitieschange":
|
||||
gMobileConnectionService.notifyDeviceIdentitiesChanged(this.clientId,
|
||||
message.deviceIdentities.imei,
|
||||
message.deviceIdentities.imeisv,
|
||||
message.deviceIdentities.esn,
|
||||
message.deviceIdentities.meid);
|
||||
break;
|
||||
case "radiostatechange":
|
||||
// gRadioEnabledController should know the radio state for each client,
|
||||
// so notify gRadioEnabledController here.
|
||||
|
@ -164,12 +164,9 @@ RilObject.prototype = {
|
||||
this.cardState = GECKO_CARDSTATE_UNINITIALIZED;
|
||||
|
||||
/**
|
||||
* Strings
|
||||
* Device Identities including IMEI, IMEISV, ESN and MEID.
|
||||
*/
|
||||
this.IMEI = null;
|
||||
this.IMEISV = null;
|
||||
this.ESN = null;
|
||||
this.MEID = null;
|
||||
this.deviceIdentities = null;
|
||||
|
||||
/**
|
||||
* ICC information that is not exposed to Gaia.
|
||||
@ -1166,25 +1163,8 @@ RilObject.prototype = {
|
||||
this.context.Buf.simpleRequest(REQUEST_SIGNAL_STRENGTH);
|
||||
},
|
||||
|
||||
getIMEI: function(options) {
|
||||
// A device's IMEI can't change, so we only need to request it once.
|
||||
if (this.IMEI) {
|
||||
if (options && options.rilMessageType) {
|
||||
options.imei = this.IMEI;
|
||||
this.sendChromeMessage(options);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
this.context.Buf.simpleRequest(REQUEST_GET_IMEI, options);
|
||||
},
|
||||
|
||||
getIMEISV: function() {
|
||||
this.context.Buf.simpleRequest(REQUEST_GET_IMEISV);
|
||||
},
|
||||
|
||||
getDeviceIdentity: function() {
|
||||
this.context.Buf.simpleRequest(REQUEST_DEVICE_IDENTITY);
|
||||
this.deviceIdentities || this.context.Buf.simpleRequest(REQUEST_DEVICE_IDENTITY);
|
||||
},
|
||||
|
||||
getBasebandVersion: function() {
|
||||
@ -3137,12 +3117,6 @@ RilObject.prototype = {
|
||||
if (this._waitingRadioTech || isCdma != this._isCdma) {
|
||||
this._isCdma = isCdma;
|
||||
this._waitingRadioTech = false;
|
||||
if (this._isCdma) {
|
||||
this.getDeviceIdentity();
|
||||
} else {
|
||||
this.getIMEI();
|
||||
this.getIMEISV();
|
||||
}
|
||||
this.getICCStatus();
|
||||
}
|
||||
},
|
||||
@ -4369,28 +4343,8 @@ RilObject.prototype[REQUEST_SET_CALL_WAITING] = function REQUEST_SET_CALL_WAITIN
|
||||
this.sendChromeMessage(options);
|
||||
};
|
||||
RilObject.prototype[REQUEST_SMS_ACKNOWLEDGE] = null;
|
||||
RilObject.prototype[REQUEST_GET_IMEI] = function REQUEST_GET_IMEI(length, options) {
|
||||
this.IMEI = this.context.Buf.readString();
|
||||
|
||||
// If the request wasn't made by ril_worker itself, we send the IMEI back to
|
||||
// chrome.
|
||||
if (options.rilMessageType) {
|
||||
if (options.errorMsg) {
|
||||
this.sendChromeMessage(options);
|
||||
return;
|
||||
}
|
||||
|
||||
options.imei = this.IMEI;
|
||||
this.sendChromeMessage(options);
|
||||
}
|
||||
};
|
||||
RilObject.prototype[REQUEST_GET_IMEISV] = function REQUEST_GET_IMEISV(length, options) {
|
||||
if (options.errorMsg) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.IMEISV = this.context.Buf.readString();
|
||||
};
|
||||
RilObject.prototype[REQUEST_GET_IMEI] = null;
|
||||
RilObject.prototype[REQUEST_GET_IMEISV] = null;
|
||||
RilObject.prototype[REQUEST_ANSWER] = function REQUEST_ANSWER(length, options) {
|
||||
this.sendDefaultResponse(options);
|
||||
};
|
||||
@ -4806,16 +4760,22 @@ RilObject.prototype[REQUEST_CDMA_WRITE_SMS_TO_RUIM] = null;
|
||||
RilObject.prototype[REQUEST_CDMA_DELETE_SMS_ON_RUIM] = null;
|
||||
RilObject.prototype[REQUEST_DEVICE_IDENTITY] = function REQUEST_DEVICE_IDENTITY(length, options) {
|
||||
if (options.errorMsg) {
|
||||
this.context.debug("Failed to get device identities:" + options.errorMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
let result = this.context.Buf.readStringList();
|
||||
this.deviceIdentities = {
|
||||
imei: result[0] || null,
|
||||
imeisv: result[1] || null,
|
||||
esn: result[2] || null,
|
||||
meid: result[3] || null,
|
||||
};
|
||||
|
||||
// The result[0] is for IMEI. (Already be handled in REQUEST_GET_IMEI)
|
||||
// The result[1] is for IMEISV. (Already be handled in REQUEST_GET_IMEISV)
|
||||
// They are both ignored.
|
||||
this.ESN = result[2];
|
||||
this.MEID = result[3];
|
||||
this.sendChromeMessage({
|
||||
rilMessageType: "deviceidentitieschange",
|
||||
deviceIdentities: this.deviceIdentities
|
||||
});
|
||||
};
|
||||
RilObject.prototype[REQUEST_EXIT_EMERGENCY_CALLBACK_MODE] = function REQUEST_EXIT_EMERGENCY_CALLBACK_MODE(length, options) {
|
||||
if (options.internal) {
|
||||
@ -5061,6 +5021,11 @@ RilObject.prototype[UNSOLICITED_RESPONSE_RADIO_STATE_CHANGED] = function UNSOLIC
|
||||
return;
|
||||
}
|
||||
|
||||
if (radioState !== RADIO_STATE_UNAVAILABLE) {
|
||||
// Retrieve device identities once radio is available.
|
||||
this.getDeviceIdentity();
|
||||
}
|
||||
|
||||
if (radioState == RADIO_STATE_ON) {
|
||||
// This value is defined in RIL v7, we will retrieve radio tech by another
|
||||
// request. We leave _isCdma untouched, and it will be set once we get the
|
||||
@ -5073,14 +5038,6 @@ RilObject.prototype[UNSOLICITED_RESPONSE_RADIO_STATE_CHANGED] = function UNSOLIC
|
||||
this.radioState == GECKO_RADIOSTATE_DISABLED) &&
|
||||
newState == GECKO_RADIOSTATE_ENABLED) {
|
||||
// The radio became available, let's get its info.
|
||||
if (!this._waitingRadioTech) {
|
||||
if (this._isCdma) {
|
||||
this.getDeviceIdentity();
|
||||
} else {
|
||||
this.getIMEI();
|
||||
this.getIMEISV();
|
||||
}
|
||||
}
|
||||
this.getBasebandVersion();
|
||||
this.updateCellBroadcastConfig();
|
||||
if ((RILQUIRKS_DATA_REGISTRATION_ON_DEMAND ||
|
||||
|
@ -359,7 +359,8 @@ MobileConnectionListener.prototype = {
|
||||
notifyClirModeChanged: function(mode) {},
|
||||
notifyLastKnownNetworkChanged: function() {},
|
||||
notifyLastKnownHomeNetworkChanged: function() {},
|
||||
notifyNetworkSelectionModeChanged: function() {}
|
||||
notifyNetworkSelectionModeChanged: function() {},
|
||||
notifyDeviceIdentitiesChanged: function() {}
|
||||
};
|
||||
|
||||
function TelephonyService() {
|
||||
@ -1230,22 +1231,13 @@ TelephonyService.prototype = {
|
||||
* A nsITelephonyDialCallback object.
|
||||
*/
|
||||
_getImeiMMI: function(aClientId, aMmi, aCallback) {
|
||||
this._sendToRilWorker(aClientId, "getIMEI", {}, aResponse => {
|
||||
if (aResponse.errorMsg) {
|
||||
aCallback.notifyDialMMIError(aResponse.errorMsg);
|
||||
return;
|
||||
}
|
||||
let connection = gGonkMobileConnectionService.getItemByServiceId(aClientId);
|
||||
if (!connection.deviceIdentities || !connection.deviceIdentities.imei) {
|
||||
aCallback.notifyDialMMIError(RIL.GECKO_ERROR_GENERIC_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
||||
// We expect to have an IMEI at this point if the request was supposed
|
||||
// to query for the IMEI, so getting a successful reply from the RIL
|
||||
// without containing an actual IMEI number is considered an error.
|
||||
if (!aResponse.imei) {
|
||||
aCallback.notifyDialMMIError(RIL.GECKO_ERROR_GENERIC_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
||||
aCallback.notifyDialMMISuccess(aResponse.imei);
|
||||
});
|
||||
aCallback.notifyDialMMISuccess(connection.deviceIdentities.imei);
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user