The answer lies in the source... it seems to be that the property to request pin-lock is built into build.prop
or default.prop
.
Have a look at the reference found in the TelephonyManager source, between lines 735 and 755. For brevity,
public int getSimState() {
String prop = SystemProperties.get(TelephonyProperties.PROPERTY_SIM_STATE);
if ("ABSENT".equals(prop)) {
return SIM_STATE_ABSENT;
}
else if ("PIN_REQUIRED".equals(prop)) {
return SIM_STATE_PIN_REQUIRED;
}
else if ("PUK_REQUIRED".equals(prop)) {
return SIM_STATE_PUK_REQUIRED;
}
else if ("NETWORK_LOCKED".equals(prop)) {
return SIM_STATE_NETWORK_LOCKED;
}
else if ("READY".equals(prop)) {
return SIM_STATE_READY;
}
else {
return SIM_STATE_UNKNOWN;
}
}
The key is TelephonyProperties.PROPERTY_SIM_STATE
which is referred elsewhere, between lines 94 and 98.
//****** SIM Card
/**
* One of <code>"UNKNOWN"</code> <code>"ABSENT"</code> <code>"PIN_REQUIRED"</code>
* <code>"PUK_REQUIRED"</code> <code>"NETWORK_LOCKED"</code> or <code>"READY"</code>
*/
static String PROPERTY_SIM_STATE = "gsm.sim.state";
After searching through the source code here on my machine, I'll give you the idea of how often this method getSimState
is called, notice the names of the java source to clue in on how its integrated within Android, not just in the Telephony layer but elsewhere.
services/java/com/android/server/am/BatteryStatsService.java 219: int simState = TelephonyManager.getDefault().getSimState();
telephony/java/android/telephony/TelephonyManager.java 523: public int getSimState() { 551: * @see #getSimState 562: * @see getSimState
policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java 478: public IccCard.State getSimState() {
policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java 545: final IccCard.State state = mUpdateMonitor.getSimState();
policy/src/com/android/internal/policy/impl/LockPatternKeyguardViewProperties.java 57: final IccCard.State simState = mUpdateMonitor.getSimState();
policy/src/com/android/internal/policy/impl/LockScreen.java 273: mStatus = getCurrentStatus(updateMonitor.getSimState());
policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java 173: && (mUpdateMonitor.getSimState() == IccCard.State.ABSENT); 217: final IccCard.State simState = mUpdateMonitor.getSimState(); 469: && (mUpdateMonitor.getSimState() != IccCard.State.PUK_REQUIRED)) { 512: secure = mUpdateMonitor.getSimState() == IccCard.State.PIN_REQUIRED 513: || mUpdateMonitor.getSimState() == IccCard.State.PUK_REQUIRED; 643: final IccCard.State simState = mUpdateMonitor.getSimState(); 662: final IccCard.State simState
= mUpdateMonitor.getSimState();
policy/tests/src/com/android/internal/policy/impl/LockPatternKeyguardViewTest.java 49: public IccCard.State getSimState() {
Do those file names give a clue, yup, in the lock screen...
Theory
This requires root at this point, by invoking the adb shell
and calling getprop
and setprop
to do this, the only part is this, by invoking
adb shell getprop
will get back the pertinent information as shown below
sh-4.1# getprop
[gsm.sim.state]: [READY]
This subtle property seems to be dynamically persisted into a backing property store, from the moment of powering up and is adjusted accordingly, based on number of things, service, and not to mention accidentally dropping the handset which may knock the sim-card out of its reader which would change the state of the card to "not-ready" or "unknown". (ref: system/core/include/cutils/properties.h and system/core/toolbox/ [ getprop | setprop ].c)
Now at this point, theoretically, by invoking setprop prior to locking the screen, it could be circumvented temporarily, but then again, that could get resetted by the telephony layer! Have not tried that! Which is leading to this...
Conclusion
The only way this can be switched off, is to effectively disable the pin-lock request on the actual sim-card. That is where the "magic" bit-flag is stored on that, in which the telephony's RIL layer reads it in via the proprietary htc/samsung/qualcomm's library, and that would prevent propragation of the persisting of the property "PIN_REQUIRED" up through the layers of Android.
A possible work-around, for Android Developers only :)
This would require hacking and recompiling the source.
For the airplane mode, when entering that mode and leaving airplane mode, the property could be split up, into two, gsm.sim.state can be left as is, but devise another property, something like this, gsm.sim.state.airplane.mode and assign a value along the lines of SIM_STATE_PIN_NOT_REQUIRED
, and modify the airplane mode check, to read that property and if set to that, do not show the pin dialog box, otherwise as usually does, prompt it.