Bug 860660 - Content process support for display of PIN/PUK retry count. r=vyang

This commit is contained in:
Michael Vines 2013-05-06 14:03:00 -07:00
Родитель 5671477fbd
Коммит 99b4773ed1
6 изменённых файлов: 30 добавлений и 0 удалений

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

@ -41,6 +41,14 @@ interface nsIDOMMozMobileConnection : nsIDOMEventTarget
*/
readonly attribute DOMString cardState;
/**
* Indicates the number of retries remaining when cardState equals 'pinRequired'
* or 'pukRequired'. 0 denotes the retry count is unavailable.
*
* Value is undefined for other cardState values.
*/
readonly attribute long retryCount;
/**
* Information stored in the device's ICC card.
*/

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

@ -47,6 +47,7 @@ interface nsIMobileConnectionProvider : nsISupports
void unregisterMobileConnectionMsg(in nsIMobileConnectionListener listener);
readonly attribute DOMString cardState;
readonly attribute long retryCount;
readonly attribute nsIDOMMozMobileICCInfo iccInfo;
readonly attribute nsIDOMMozMobileConnectionInfo voiceConnectionInfo;
readonly attribute nsIDOMMozMobileConnectionInfo dataConnectionInfo;

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

@ -185,6 +185,17 @@ MobileConnection::GetCardState(nsAString& cardState)
return mProvider->GetCardState(cardState);
}
NS_IMETHODIMP
MobileConnection::GetRetryCount(int32_t* retryCount)
{
*retryCount = 0;
if (!mProvider || !CheckPermission("mobileconnection")) {
return NS_OK;
}
return mProvider->GetRetryCount(retryCount);
}
NS_IMETHODIMP
MobileConnection::GetIccInfo(nsIDOMMozMobileICCInfo** aIccInfo)
{

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

@ -314,6 +314,7 @@ CellBroadcastEtwsInfo.prototype = {
function RILContentHelper() {
this.rilContext = {
cardState: RIL.GECKO_CARDSTATE_UNKNOWN,
retryCount: 0,
networkSelectionMode: RIL.GECKO_NETWORK_SELECTION_UNKNOWN,
iccInfo: new MobileICCInfo(),
voiceConnectionInfo: new MobileConnectionInfo(),
@ -406,6 +407,7 @@ RILContentHelper.prototype = {
return;
}
this.rilContext.cardState = rilContext.cardState;
this.rilContext.retryCount = rilContext.retryCount;
this.rilContext.networkSelectionMode = rilContext.networkSelectionMode;
this.updateInfo(rilContext.iccInfo, this.rilContext.iccInfo);
this.updateConnectionInfo(rilContext.voice, this.rilContext.voiceConnectionInfo);
@ -430,6 +432,10 @@ RILContentHelper.prototype = {
return this.getRilContext().cardState;
},
get retryCount() {
return this.getRilContext().retryCount;
},
get networkSelectionMode() {
return this.getRilContext().networkSelectionMode;
},
@ -1037,6 +1043,7 @@ RILContentHelper.prototype = {
debug("Received message '" + msg.name + "': " + JSON.stringify(msg.json));
switch (msg.name) {
case "RIL:CardStateChanged":
this.rilContext.retryCount = msg.json.retryCount;
if (this.rilContext.cardState != msg.json.cardState) {
this.rilContext.cardState = msg.json.cardState;
this._deliverEvent("_mobileConnectionListeners",

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

@ -229,6 +229,7 @@ function RadioInterfaceLayer() {
this.rilContext = {
radioState: RIL.GECKO_RADIOSTATE_UNAVAILABLE,
cardState: RIL.GECKO_CARDSTATE_UNKNOWN,
retryCount: 0, // TODO: Please see bug 868896
networkSelectionMode: RIL.GECKO_NETWORK_SELECTION_UNKNOWN,
iccInfo: null,
imsi: null,

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

@ -66,6 +66,8 @@ interface nsIRilContext : nsISupports
readonly attribute DOMString cardState;
readonly attribute long retryCount;
readonly attribute DOMString imsi;
readonly attribute DOMString networkSelectionMode;