Reputation: 401
I would like to start by mentioning that what I'm trying to achieve is to be used only on those devices which are distributed by us and we have complete ownership on these devices and the applications which run on these devices.
My requirement is to enable "Lock SIM card" under Settings -> Security -> SIM Card Lock Settings on android phones and set/change the SIM lock/unlock pin. All the phones are rooted and are at remote locations. I don't have physical access to these devices but I have remote access to ADB shell.
I came across an USSD code to reset the sim pin. For eg. **04*1234*2345*2345# can be used to change the pin from 1234 to 2345. However if the "Lock SIM card" is disabled in the sim lock settings, the above USSD says "PIN change Unsuccessful, enable SIM/RUIM Lock".
I monitored the logcat output while trying to enable the "Lock SIM card" checkbox manually for pointers on which service is being called and figured out is the task is handled by the method com.android.internal.telephony.IccCard.setIccLockEnabled which is not exposed through SDK.
I am stuck there. Is there any way (USSD/programmatically using reflection/adb shell command) by which I can enable the "Lock SIM card" setting (automatically accepting the popup it shows/disabling the popup if possible) and then set/reset the pin.
Thanks in advance.
Upvotes: 1
Views: 4215
Reputation: 883
Seeing that it has been 3 months with no answers, I could propose a suggestion. Enabling and managing the PIN is a SIM feature. You could write application code to send "RAW" data to the SIM directly. This data would be in the form of APDU's defined in ISO-7816-4 document. Look at VERIFY, CHANGE REF DATA, ENABLE/DISABLE VERIFY commands. Alternatively make reference to GSM11.11 VERIFY/CHANGE/ENABLE/DISABLE CHV Commands.
Upvotes: 1