Merge "Get APM state from ACTION_AIRPLANE_MODE_CHANGED intent instead"
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index e8a6cb4..d09bd77 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -477,7 +477,7 @@
 
             // Initialize cell status using current airplane mode.
             handleAirplaneModeChange(this, Settings.Global.getInt(getContentResolver(),
-                    Settings.Global.AIRPLANE_MODE_ON, AIRPLANE_OFF));
+                    Settings.Global.AIRPLANE_MODE_ON, AIRPLANE_OFF) == AIRPLANE_ON);
 
             // Register for misc other intent broadcasts.
             IntentFilter intentFilter =
@@ -629,10 +629,9 @@
         notifier.updateCallNotifierRegistrationsAfterRadioTechnologyChange();
     }
 
-    private void handleAirplaneModeChange(Context context, int newMode) {
+    private void handleAirplaneModeChange(Context context, boolean isAirplaneNewlyOn) {
         int cellState = Settings.Global.getInt(context.getContentResolver(),
                 Settings.Global.CELL_ON, PhoneConstants.CELL_ON_FLAG);
-        boolean isAirplaneNewlyOn = (newMode == 1);
         switch (cellState) {
             case PhoneConstants.CELL_OFF_FLAG:
                 // Airplane mode does not affect the cell radio if user
@@ -715,12 +714,7 @@
         public void onReceive(Context context, Intent intent) {
             String action = intent.getAction();
             if (action.equals(Intent.ACTION_AIRPLANE_MODE_CHANGED)) {
-                int airplaneMode = Settings.Global.getInt(getContentResolver(),
-                        Settings.Global.AIRPLANE_MODE_ON, AIRPLANE_OFF);
-                // Treat any non-OFF values as ON.
-                if (airplaneMode != AIRPLANE_OFF) {
-                    airplaneMode = AIRPLANE_ON;
-                }
+                boolean airplaneMode = intent.getBooleanExtra("state", false);
                 handleAirplaneModeChange(context, airplaneMode);
             } else if (action.equals(TelephonyIntents.ACTION_SIM_STATE_CHANGED)) {
                 // re-register as it may be a new IccCard