Sim Pin Dialog
For mobiles, SimPin is so important that we have to use it do some special operations and normally we’ll have SIM1, SIM2, PUK1, PUK2. Take Fixed Dialing Number feature for example, you would use SIM2 to lock your phone and make sure it can only dial out some configured numbers instead of every numbers for security issues.
But in Settings App, we have plenty of different situations that you need to show these different UIs, so this is why we make a unified dialog called SimPinDialog. For this dialog, we encapsulate all logics inside it like how many retry times can be used for this operation, if users type the code wrongly for too many times and we have to jump to different operation to unlock it … etc.
And because this is a dialog, so caller can pass needed parameters to it and use Promise.prototype.then to get returned results.
After knowing what SimPinDialog is used for, if you do check the source code of it, you may get curious about what the relationship between itself and SimSecurity is.
In Gecko, there are some limitations that in some specific situations, if you enable pin, you can’t get simPinLocked status from API (If I remembered this right, some different devices may have correct result when accessing related API), so in order to fix this thoroughly, we make a wrapping called SimSecurity which will provide needed events / status for Gaia use.