mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 875710: Added getCardLockRetryCount to nsIIccProvider, r=vyang, sr=mounir
This patch adds getCardLockRetryCount to nsIIccProvider and its implementations. This method allows callers to query the number of remaining tries for unlocking a SIM-card lock. Supported locks are 'pin', 'puk', 'pin2', 'puk2', 'nck', 'cck', and 'spck'. The call returns a DOM request that returns the retry count in its success handler, or signals an appropriate error. Reading the retry count is an optional feature and may not be supported for all lock types. In this case the DOM request receives and error with the name GECKO_ERROR_NOT_SUPPORTED. For an invalid lock type, the error name is GECKO_ERROR_GENERIC_FAILURE. getCardLockRetryCount replaces retryCount in nsIDOMMobileConnection, which is now deprecated. --HG-- extra : rebase_source : d1d11612f836652dca85f7c701f09e7af962e3b7
This commit is contained in:
parent
5749f1cd33
commit
f2d4199d6b
@ -9,7 +9,7 @@ interface nsIDOMEventListener;
|
||||
interface nsIDOMDOMRequest;
|
||||
interface nsIDOMContact;
|
||||
|
||||
[scriptable, builtinclass, uuid(d21b7070-c2bc-11e2-8b8b-0800200c9a66)]
|
||||
[scriptable, builtinclass, uuid(5f405112-4da9-4d4d-942c-4da3cb7928e1)]
|
||||
interface nsIDOMMozIccManager : nsIDOMEventTarget
|
||||
{
|
||||
/**
|
||||
@ -432,6 +432,20 @@ interface nsIDOMMozIccManager : nsIDOMEventTarget
|
||||
*/
|
||||
[implicit_jscontext] attribute jsval onicccardlockerror;
|
||||
|
||||
/**
|
||||
* Retrieve the number of remaining tries for unlocking the card.
|
||||
*
|
||||
* @param lockType
|
||||
* Identifies the lock type, e.g. "pin" for the PIN lock, "puk" for
|
||||
* the PUK lock.
|
||||
*
|
||||
* @return a DOM Request.
|
||||
* If the lock type is "pin", or "puk", the request's result will be
|
||||
* an object containing the number of retries for the specified
|
||||
* lock. For any other lock type, the result is undefined.
|
||||
*/
|
||||
nsIDOMDOMRequest getCardLockRetryCount(in DOMString lockType);
|
||||
|
||||
// UICC Phonebook Interfaces.
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,7 @@ interface nsIIccListener : nsISupports
|
||||
/**
|
||||
* XPCOM component (in the content process) that provides the ICC information.
|
||||
*/
|
||||
[scriptable, uuid(77487bf0-c2be-11e2-8b8b-0800200c9a66)]
|
||||
[scriptable, uuid(7131dfbe-9a2c-434d-b6b8-3eebf491ce1a)]
|
||||
interface nsIIccProvider : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -57,6 +57,7 @@ interface nsIIccProvider : nsISupports
|
||||
nsIDOMDOMRequest getCardLockState(in nsIDOMWindow window, in DOMString lockType);
|
||||
nsIDOMDOMRequest unlockCardLock(in nsIDOMWindow window, in jsval info);
|
||||
nsIDOMDOMRequest setCardLock(in nsIDOMWindow window, in jsval info);
|
||||
nsIDOMDOMRequest getCardLockRetryCount(in nsIDOMWindow window, in DOMString lockType);
|
||||
|
||||
/**
|
||||
* Phonebook interfaces.
|
||||
|
@ -170,6 +170,16 @@ IccManager::UnlockCardLock(const JS::Value& aInfo, nsIDOMDOMRequest** aDomReques
|
||||
return mProvider->UnlockCardLock(GetOwner(), aInfo, aDomRequest);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
IccManager::GetCardLockRetryCount(const nsAString& aLockType, nsIDOMDOMRequest** aDomRequest)
|
||||
{
|
||||
if (!mProvider) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return mProvider->GetCardLockRetryCount(GetOwner(), aLockType, aDomRequest);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
IccManager::IccOpenChannel(const nsAString& aAid, nsIDOMDOMRequest** aRequest)
|
||||
{
|
||||
|
@ -79,6 +79,7 @@ const RIL_IPC_MSG_NAMES = [
|
||||
"RIL:VoicemailInfoChanged",
|
||||
"RIL:CallError",
|
||||
"RIL:CardLockResult",
|
||||
"RIL:CardLockRetryCount",
|
||||
"RIL:USSDReceived",
|
||||
"RIL:SendMMI:Return:OK",
|
||||
"RIL:SendMMI:Return:KO",
|
||||
@ -123,6 +124,17 @@ MobileIccCardLockResult.prototype = {
|
||||
success: 'r'}
|
||||
};
|
||||
|
||||
function MobileIccCardLockRetryCount(options) {
|
||||
this.lockType = options.lockType;
|
||||
this.retryCount = options.retryCount;
|
||||
this.success = options.success;
|
||||
}
|
||||
MobileIccCardLockRetryCount.prototype = {
|
||||
__exposedProps__ : {lockType: 'r',
|
||||
retryCount: 'r',
|
||||
success: 'r'}
|
||||
};
|
||||
|
||||
function MobileICCInfo() {}
|
||||
MobileICCInfo.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMMozMobileICCInfo]),
|
||||
@ -650,6 +662,23 @@ RILContentHelper.prototype = {
|
||||
return request;
|
||||
},
|
||||
|
||||
getCardLockRetryCount: function getCardLockRetryCount(window, lockType) {
|
||||
if (window == null) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
Cr.NS_ERROR_UNEXPECTED);
|
||||
}
|
||||
let request = Services.DOMRequest.createRequest(window);
|
||||
let requestId = this.getRequestId(request);
|
||||
cpmm.sendAsyncMessage("RIL:GetCardLockRetryCount", {
|
||||
clientId: 0,
|
||||
data: {
|
||||
lockType: lockType,
|
||||
requestId: requestId
|
||||
}
|
||||
});
|
||||
return request;
|
||||
},
|
||||
|
||||
sendMMI: function sendMMI(window, mmi) {
|
||||
// We need to save the global window to get the proper MMIError
|
||||
// constructor once we get the reply from the parent process.
|
||||
@ -1378,6 +1407,14 @@ RILContentHelper.prototype = {
|
||||
this.fireRequestError(msg.json.requestId, msg.json.errorMsg);
|
||||
}
|
||||
break;
|
||||
case "RIL:CardLockRetryCount":
|
||||
if (msg.json.success) {
|
||||
let result = new MobileIccCardLockRetryCount(msg.json);
|
||||
this.fireRequestSuccess(msg.json.requestId, result);
|
||||
} else {
|
||||
this.fireRequestError(msg.json.requestId, msg.json.errorMsg);
|
||||
}
|
||||
break;
|
||||
case "RIL:USSDReceived": {
|
||||
let data = msg.json.data;
|
||||
this._deliverEvent("_mobileConnectionListeners",
|
||||
|
@ -115,6 +115,7 @@ const RIL_IPC_ICCMANAGER_MSG_NAMES = [
|
||||
"RIL:GetCardLockState",
|
||||
"RIL:UnlockCardLock",
|
||||
"RIL:SetCardLock",
|
||||
"RIL:GetCardLockRetryCount",
|
||||
"RIL:IccOpenChannel",
|
||||
"RIL:IccExchangeAPDU",
|
||||
"RIL:IccCloseChannel",
|
||||
@ -826,6 +827,10 @@ RadioInterface.prototype = {
|
||||
gMessageManager.saveRequestTarget(msg);
|
||||
this.setCardLock(msg.json.data);
|
||||
break;
|
||||
case "RIL:GetCardLockRetryCount":
|
||||
gMessageManager.saveRequestTarget(msg);
|
||||
this.getCardLockRetryCount(msg.json.data);
|
||||
break;
|
||||
case "RIL:SendMMI":
|
||||
gMessageManager.saveRequestTarget(msg);
|
||||
this.sendMMI(msg.json.data);
|
||||
@ -1025,6 +1030,9 @@ RadioInterface.prototype = {
|
||||
case "iccUnlockCardLock":
|
||||
this.handleIccCardLockResult(message);
|
||||
break;
|
||||
case "iccGetCardLockRetryCount":
|
||||
this.handleIccCardLockRetryCount(message);
|
||||
break;
|
||||
case "icccontacts":
|
||||
this.handleReadIccContacts(message);
|
||||
break;
|
||||
@ -2107,6 +2115,10 @@ RadioInterface.prototype = {
|
||||
gMessageManager.sendRequestResults("RIL:CardLockResult", message);
|
||||
},
|
||||
|
||||
handleIccCardLockRetryCount: function handleIccCardLockRetryCount(message) {
|
||||
gMessageManager.sendRequestResults("RIL:CardLockRetryCount", message);
|
||||
},
|
||||
|
||||
handleUSSDReceived: function handleUSSDReceived(ussd) {
|
||||
if (DEBUG) this.debug("handleUSSDReceived " + JSON.stringify(ussd));
|
||||
gSystemMessenger.broadcastMessage("ussd-received", ussd);
|
||||
@ -3333,6 +3345,11 @@ RadioInterface.prototype = {
|
||||
this.worker.postMessage(message);
|
||||
},
|
||||
|
||||
getCardLockRetryCount: function getCardLockRetryCount(message) {
|
||||
message.rilMessageType = "iccGetCardLockRetryCount";
|
||||
this.worker.postMessage(message);
|
||||
},
|
||||
|
||||
readIccContacts: function readIccContacts(message) {
|
||||
message.rilMessageType = "readICCContacts";
|
||||
this.worker.postMessage(message);
|
||||
|
@ -1196,6 +1196,36 @@ let RIL = {
|
||||
this.queryICCFacilityLock(options);
|
||||
},
|
||||
|
||||
/**
|
||||
* Helper function for fetching the number of unlock retries of ICC locks.
|
||||
*/
|
||||
iccGetCardLockRetryCount: function iccGetCardLockRetryCount(options) {
|
||||
switch (options.lockType) {
|
||||
case "pin":
|
||||
case "puk":
|
||||
case "pin2":
|
||||
case "puk2":
|
||||
case "nck":
|
||||
case "cck":
|
||||
case "spck":
|
||||
options.errorMsg = GECKO_ERROR_REQUEST_NOT_SUPPORTED;
|
||||
options.success = false;
|
||||
this.sendDOMMessage(options);
|
||||
return;
|
||||
default:
|
||||
options.errorMsg = GECKO_ERROR_GENERIC_FAILURE;
|
||||
options.success = false;
|
||||
this.sendDOMMessage(options);
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: We currently don't have a way for
|
||||
// reading the retry count. See bug 868896.
|
||||
options.retryCount = 0;
|
||||
options.success = true;
|
||||
this.sendDOMMessage(options);
|
||||
},
|
||||
|
||||
/**
|
||||
* Query ICC facility lock.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user