Backout cfba38edc205, cec9aff342dc, a154933f2bef (bug 780558) for mochitest-3 bustage

This commit is contained in:
Phil Ringnalda 2012-08-14 22:19:28 -07:00
Родитель 198da91dc6
Коммит 4ebf706d08
7 изменённых файлов: 60 добавлений и 139 удалений

Просмотреть файл

@ -8,7 +8,6 @@ interface nsIDOMEventListener;
interface nsIDOMDOMRequest;
interface nsIDOMMozMobileConnectionInfo;
interface nsIDOMMozMobileNetworkInfo;
interface nsIDOMMozMobileCellInfo;
[scriptable, builtinclass, uuid(e7309c47-9a2e-4e12-84ab-f8f39214eaba)]
interface nsIDOMMozMobileConnection : nsIDOMEventTarget
@ -223,7 +222,7 @@ interface nsIDOMMozMobileConnection : nsIDOMEventTarget
attribute nsIDOMEventListener onussdreceived;
};
[scriptable, uuid(5ea0e4a9-4684-40da-9930-8ebb61d187f3)]
[scriptable, uuid(6601c20e-337f-4286-8d6e-0990fc1c2372)]
interface nsIDOMMozMobileConnectionInfo : nsISupports
{
/**
@ -277,11 +276,6 @@ interface nsIDOMMozMobileConnectionInfo : nsISupports
*/
readonly attribute jsval relSignalStrength;
/**
* Cell location.
*/
readonly attribute nsIDOMMozMobileCellInfo cell;
};
[scriptable, uuid(3bd866c7-98a5-4ef4-a464-c22d8cc6b992)]
@ -314,17 +308,3 @@ interface nsIDOMMozMobileNetworkInfo: nsISupports
*/
readonly attribute DOMString state;
};
[scriptable, uuid(aa546788-4f34-488b-8c3e-2786e02ab992)]
interface nsIDOMMozMobileCellInfo: nsISupports
{
/**
* Mobile Location Area Code (LAC) for GSM/WCDMA networks.
*/
readonly attribute unsigned short gsmLocationAreaCode;
/**
* Mobile Cell ID for GSM/WCDMA networks.
*/
readonly attribute unsigned long gsmCellId;
};

Просмотреть файл

@ -17,12 +17,6 @@ function setEmulatorVoiceState(state) {
});
}
function setEmulatorGsmLocation(lac, cid) {
runEmulatorCmd("gsm location " + lac + " " + cid, function (result) {
is(result[0], "OK");
});
}
function testConnectionInfo() {
let voice = connection.voice;
is(voice.connected, true);
@ -30,31 +24,7 @@ function testConnectionInfo() {
is(voice.emergencyCallsOnly, false);
is(voice.roaming, false);
testCellLocation();
}
function testCellLocation() {
let voice = connection.voice;
// Emulator always reports valid lac/cid value because its AT command parser
// insists valid value for every complete response. See source file
// hardare/ril/reference-ril/at_tok.c, function at_tok_nexthexint().
ok(voice.cell, "location available");
// Initial LAC/CID. Android emulator initializes both value to -1.
is(voice.cell.gsmLocationAreaCode, 65535);
is(voice.cell.gsmCellId, 268435455);
connection.addEventListener("voicechange", function onvoicechange() {
connection.removeEventListener("voicechange", onvoicechange);
is(voice.cell.gsmLocationAreaCode, 100);
is(voice.cell.gsmCellId, 100);
testUnregistered();
});
setEmulatorGsmLocation(100, 100);
}
function testUnregistered() {

Просмотреть файл

@ -24,7 +24,6 @@
#include "nsIInterfaceRequestorUtils.h"
#include "nsINetworkManager.h"
#include "nsIRadioInterfaceLayer.h"
#include "nsIDOMMobileConnection.h"
#include "nsThreadUtils.h"
#ifdef AGPS_TYPE_INVALID
@ -372,15 +371,11 @@ GonkGPSGeolocationProvider::SetReferenceLocation()
icc->GetMcc(&location.u.cellID.mcc);
icc->GetMnc(&location.u.cellID.mnc);
}
nsCOMPtr<nsIDOMMozMobileConnectionInfo> voice;
rilCtx->GetVoice(getter_AddRefs(voice));
if (voice) {
nsCOMPtr<nsIDOMMozMobileCellInfo> cell;
voice->GetCell(getter_AddRefs(cell));
nsCOMPtr<nsICellLocation> cell;
rilCtx->GetCell(getter_AddRefs(cell));
if (cell) {
cell->GetGsmLocationAreaCode(&location.u.cellID.lac);
cell->GetGsmCellId(&location.u.cellID.cid);
}
cell->GetLac(&location.u.cellID.lac);
cell->GetCid(&location.u.cellID.cid);
}
if (mAGpsRilInterface) {
mAGpsRilInterface->set_ref_location(&location, sizeof(location));

Просмотреть файл

@ -33,8 +33,6 @@ const MOBILECONNECTIONINFO_CID =
Components.ID("{a35cfd39-2d93-4489-ac7d-396475dacb27}");
const MOBILENETWORKINFO_CID =
Components.ID("{a6c8416c-09b4-46d1-bf29-6520d677d085}");
const MOBILECELLINFO_CID =
Components.ID("{5e809018-68c0-4c54-af0b-2a9b8f748c45}");
const VOICEMAILSTATUS_CID=
Components.ID("{5467f2eb-e214-43ea-9b89-67711241ec8e}");
@ -91,7 +89,6 @@ MobileConnectionInfo.prototype = {
emergencyCallsOnly: false,
roaming: false,
network: null,
cell: null,
type: null,
signalStrength: null,
relSignalStrength: null
@ -117,23 +114,6 @@ MobileNetworkInfo.prototype = {
state: null
};
function MobileCellInfo() {}
MobileCellInfo.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMMozMobileCellInfo]),
classID: MOBILECELLINFO_CID,
classInfo: XPCOMUtils.generateCI({
classID: MOBILECELLINFO_CID,
classDescription: "MobileCellInfo",
flags: Ci.nsIClassInfo.DOM_OBJECT,
interfaces: [Ci.nsIDOMMozMobileCellInfo]
}),
// nsIDOMMozMobileCellInfo
gsmLocationAreaCode: null,
gsmCellId: null
};
function VoicemailStatus() {}
VoicemailStatus.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMMozVoicemailStatus]),
@ -188,24 +168,11 @@ RILContentHelper.prototype = {
updateConnectionInfo: function updateConnectionInfo(srcInfo, destInfo) {
for (let key in srcInfo) {
if ((key != "network") && (key != "cell")) {
if (key != "network") {
destInfo[key] = srcInfo[key];
}
}
let srcCell = srcInfo.cell;
if (!srcCell) {
destInfo.cell = null;
} else {
let cell = destInfo.cell;
if (!cell) {
cell = destInfo.cell = new MobileCellInfo();
}
cell.gsmLocationAreaCode = srcCell.gsmLocationAreaCode;
cell.gsmCellId = srcCell.gsmCellId;
}
let srcNetwork = srcInfo.network;
if (!srcNetwork) {
destInfo.network= null;

Просмотреть файл

@ -151,16 +151,14 @@ function RadioInterfaceLayer() {
radioState: RIL.GECKO_RADIOSTATE_UNAVAILABLE,
cardState: RIL.GECKO_CARDSTATE_UNAVAILABLE,
icc: null,
cell: null,
// These objects implement the nsIDOMMozMobileConnectionInfo interface,
// although the actual implementation lives in the content process. So are
// the child attributes `network` and `cell`, which implement
// nsIDOMMozMobileNetworkInfo and nsIDOMMozMobileCellInfo respectively.
// although the actual implementation lives in the content process.
voice: {connected: false,
emergencyCallsOnly: false,
roaming: false,
network: null,
cell: null,
type: null,
signalStrength: null,
relSignalStrength: null},
@ -168,7 +166,6 @@ function RadioInterfaceLayer() {
emergencyCallsOnly: false,
roaming: false,
network: null,
cell: null,
type: null,
signalStrength: null,
relSignalStrength: null},
@ -423,6 +420,9 @@ RadioInterfaceLayer.prototype = {
case "iccmbdn":
ppmm.sendAsyncMessage("RIL:VoicemailNumberChanged", message);
break;
case "celllocationchanged":
this.rilContext.cell = message;
break;
case "ussdreceived":
debug("ussdreceived " + JSON.stringify(message));
this.handleUSSDReceived(message);
@ -506,13 +506,6 @@ RadioInterfaceLayer.prototype = {
voiceInfo.relSignalStrength = null;
}
let newCell = newInfo.cell;
if ((newCell.gsmLocationAreaCode < 0) || (newCell.gsmCellId < 0)) {
voiceInfo.cell = null;
} else {
voiceInfo.cell = newCell;
}
if (!newInfo.batch) {
ppmm.sendAsyncMessage("RIL:VoiceInfoChanged", voiceInfo);
}
@ -536,13 +529,6 @@ RadioInterfaceLayer.prototype = {
dataInfo.relSignalStrength = null;
}
let newCell = newInfo.cell;
if ((newCell.gsmLocationAreaCode < 0) || (newCell.gsmCellId < 0)) {
dataInfo.cell = null;
} else {
dataInfo.cell = newCell;
}
if (!newInfo.batch) {
ppmm.sendAsyncMessage("RIL:DataInfoChanged", dataInfo);
}

Просмотреть файл

@ -217,7 +217,21 @@ interface nsIICCRecords : nsISupports
readonly attribute jsval fdn;
};
[scriptable, uuid(e6dc89f2-0d4e-46fc-902c-cfeeaee15e40)]
[scriptable, uuid(1b47459d-d0bc-4e91-8509-cc106054b9ee)]
interface nsICellLocation : nsISupports
{
/**
* Location Area Code
*/
readonly attribute unsigned short lac;
/**
* Cell Identity
*/
readonly attribute unsigned long cid;
};
[scriptable, uuid(a6f6977e-f4ee-42b4-ae79-798c8c47c360)]
interface nsIRilContext : nsISupports
{
readonly attribute DOMString radioState;
@ -226,6 +240,8 @@ interface nsIRilContext : nsISupports
readonly attribute nsIICCRecords icc;
readonly attribute nsICellLocation cell;
readonly attribute nsIDOMMozMobileConnectionInfo voice;
readonly attribute nsIDOMMozMobileConnectionInfo data;

Просмотреть файл

@ -623,6 +623,11 @@ let RIL = {
voiceRegistrationState: {},
dataRegistrationState: {},
/**
* The cell location on a phone, such as LAC, CID.
*/
cellLocation: {},
/**
* List of strings identifying the network operator.
*/
@ -693,13 +698,11 @@ let RIL = {
*
* @param string
* String to be parsed.
* @param defaultValue [optional]
* @param defaultValue
* Default value to be used.
* @param radix [optional]
* A number that represents the numeral system to be used. Default 10.
*/
parseInt: function RIL_parseInt(string, defaultValue, radix) {
let number = parseInt(string, radix || 10);
parseInt: function RIL_parseInt(string, defaultValue) {
let number = parseInt(string, 10);
if (!isNaN(number)) {
return number;
}
@ -2183,24 +2186,6 @@ let RIL = {
}
}
if (!curState.cell) {
curState.cell = {};
}
// From TS 23.003, 0000 and 0xfffe are indicated that no valid LAI exists
// in MS. So we still need to report the '0000' as well.
let lac = RIL.parseInt(newState[1], -1, 16);
if (curState.cell.gsmLocationAreaCode !== lac) {
curState.cell.gsmLocationAreaCode = lac;
changed = true;
}
let cid = RIL.parseInt(newState[2], -1, 16);
if (curState.cell.gsmCellId !== cid) {
curState.cell.gsmCellId = cid;
changed = true;
}
let radioTech = RIL.parseInt(newState[3], NETWORK_CREG_TECH_UNKNOWN);
if (curState.radioTech != radioTech) {
changed = true;
@ -2217,6 +2202,28 @@ let RIL = {
RIL.getSMSCAddress();
}
let cell = this.cellLocation;
let cellChanged = false;
// From TS 23.003, 0000 and 0xfffe are indicated that no valid LAI exists
// in MS. So we still need to report the '0000' as well.
let lac = parseInt(state[1], 16);
if (cell.lac !== lac) {
cell.lac = lac;
cellChanged = true;
}
let cid = parseInt(state[2], 16);
if (cell.cid !== cid) {
cell.cid = cid;
cellChanged = true;
}
if (cellChanged) {
cell.rilMessageType = "celllocationchanged";
this.sendDOMMessage(cell);
}
// TODO: This zombie code branch that will be raised from the dead once
// we add explicit CDMA support everywhere (bug 726098).
let cdma = false;