title: Setting airplane mode does not completely work
body: <p>I've written the code below to set the phone into airplane mode to save power. The devices is being used as a WiFi-Hotspot to relay data from some sensors in a village in Indonesia. The sensors send their data at the same time so I just need to come out of airplane mode for five minutes at midnight and then reenter airplane mode. </p>
  
  <p>The problem is the cellular radio is not shut off and the airplane icon does not appear. Though the the phone reports its status as airplane_mode on, it is still possible to call it. Other widgets in the marketplace seem to fare no better. I've tried "Airplane Mode Wi-Fi Tool". It too can not get the airplane icon to appear nor disable cell radio. When watching LogCat while using the device settings to go to Airplane mode, I can see that much more is happening than when trying from the program.</p>
  
  <p>If I load my program on a Droid, this code works as expected. <code>AIRPLANE_MODE_RADIOS</code> is set to <code>cell, bluetooth, wifi</code>.</p>
  
  <p>The offending device is a Samsung Galaxy 5, I5500 tested with:</p>
  
  <p>-Froyo 2.2 build FROYO.UYJP2
  -Froyo 2.2.1 build FROYO.UYJPE</p>
  
  <p>One interesting side note: if I programmatically set airplane mode and then power cycle the device, it comes up in full airplane mode, rejects incoming calls etc.</p>
  
  <p>Do others have similar stories with this or other devices? Is there a way to specifically turn off cell only?</p>
  
  <pre><code>public static void setAirplaneMode(Context context, boolean status) {
  
      boolean isAM = Settings.System.getInt(context.getContentResolver(),
              Settings.System.AIRPLANE_MODE_ON, 0) != 0;
  
      String radios = Settings.System.getString(context.getContentResolver(),
              Settings.System.AIRPLANE_MODE_RADIOS);
  
      //This line is reporting all radios affected but annunciator does not seem to think so. Does not show airplane
      Wake.logger("Airplane mode is: " + isAM + " changing to " + status + " For radios: " + radios, false);
  
      // It appears Airplane mode should only be toggled. Don't reset to
      // current state.
      if (isAM &amp;&amp; !status) {
          Settings.System.putInt(context.getContentResolver(),
                  Settings.System.AIRPLANE_MODE_ON, 0);
          Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
          intent.putExtra("state", 0);
          context.sendBroadcast(intent);
          return;
      }
      if (!isAM &amp;&amp; status) {
          Settings.System.putInt(context.getContentResolver(),
                  Settings.System.AIRPLANE_MODE_ON, 1);
          Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
          intent.putExtra("state", 1);
          context.sendBroadcast(intent);
          return;
      }
  }
  </code></pre>