deactivate PIN-request after airplane mode When switching on the phone, one is by default asked to enter the SIM-PIN -- which is a good security measure, to prevent "strangers" from causing you costs. Now the same applies when returning from airplane mode: one has to enter the SIM-PIN again. Which renders certain energy-savers useless: if an app e.g. enters airplane mode on signal loss (see: What is Cell standby and how can I keep it from eating my battery?), it would be unable to return to normal operation without user interaction.

I'm looking for a way to selectively disable this: Have the PIN request active when powering up the device -- but not being asked for the SIM-PIN when returning from airplane mode.

Please do not confuse this with "keyguard": I'm not asking about the screen lock (PIN/pattern/password). Here I know my way around, as there is an API for apps to use (so I can e.g. temporarily turn this off with Tasker).

I know this works with Samsung devices -- but I preferably want a device independent solution which works for all manufacturers.
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 (&quot;ABSENT&quot;.equals(prop)) {
            return SIM_STATE_ABSENT;
        }
        else if (&quot;PIN_REQUIRED&quot;.equals(prop)) {
            return SIM_STATE_PIN_REQUIRED;
        }
        else if (&quot;PUK_REQUIRED&quot;.equals(prop)) {
            return SIM_STATE_PUK_REQUIRED;
        }
        else if (&quot;NETWORK_LOCKED&quot;.equals(prop)) {
            return SIM_STATE_NETWORK_LOCKED;
        }
        else if (&quot;READY&quot;.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 &lt;code&gt;&quot;UNKNOWN&quot;&lt;/code&gt; &lt;code&gt;&quot;ABSENT&quot;&lt;/code&gt; &lt;code&gt;&quot;PIN_REQUIRED&quot;&lt;/code&gt;
 * &lt;code&gt;&quot;PUK_REQUIRED&quot;&lt;/code&gt; &lt;code&gt;&quot;NETWORK_LOCKED&quot;&lt;/code&gt; or &lt;code&gt;&quot;READY&quot;&lt;/code&gt;
 */
static String PROPERTY_SIM_STATE = &quot;gsm.sim.state&quot;;

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:                &amp;&amp; (mUpdateMonitor.getSimState() == IccCard.State.ABSENT); 217:                final IccCard.State simState = mUpdateMonitor.getSimState(); 469:                &amp;&amp; (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 &quot;not-ready&quot; or &quot;unknown&quot;. (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 &quot;magic&quot; 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 &quot;PIN_REQUIRED&quot; 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.