Go into airplane mode in minimal boot mode.
Fix b/6006192
Change-Id: Ied4d9b51aac4e8ac1d2114aa1e95d4ebbe93413b
diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java
index 3e88e27..6795e28 100644
--- a/src/com/android/settings/CryptKeeper.java
+++ b/src/com/android/settings/CryptKeeper.java
@@ -49,6 +49,7 @@
import android.widget.TextView;
import com.android.internal.telephony.ITelephony;
+import com.android.internal.telephony.Phone;
import java.util.List;
@@ -296,6 +297,7 @@
| StatusBarManager.DISABLE_HOME
| StatusBarManager.DISABLE_RECENT);
+ setAirplaneModeIfNecessary();
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
// Check for (and recover) retained instance data
final Object lastInstance = getLastNonConfigurationInstance();
@@ -597,6 +599,32 @@
}
/**
+ * Set airplane mode on the device if it isn't an LTE device.
+ * Full story: In minimal boot mode, we cannot save any state. In particular, we cannot save
+ * any incoming SMS's. So SMSs that are received here will be silently dropped to the floor.
+ * That is bad. Also, we cannot receive any telephone calls in this state. So to avoid
+ * both these problems, we turn the radio off. However, on certain networks turning on and
+ * off the radio takes a long time. In such cases, we are better off leaving the radio
+ * running so the latency of an E911 call is short.
+ * The behavior after this is:
+ * 1. Emergency dialing: the emergency dialer has logic to force the device out of
+ * airplane mode and restart the radio.
+ * 2. Full boot: we read the persistent settings from the previous boot and restore the
+ * radio to whatever it was before it restarted. This also happens when rebooting a
+ * phone that has no encryption.
+ */
+ private final void setAirplaneModeIfNecessary() {
+ final boolean isLteDevice =
+ TelephonyManager.getDefault().getLteOnCdmaMode() == Phone.LTE_ON_CDMA_TRUE;
+ if (!isLteDevice) {
+ Log.d(TAG, "Going into airplane mode.");
+ final Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
+ intent.putExtra("state", true);
+ sendBroadcast(intent);
+ }
+ }
+
+ /**
* Code to update the state of, and handle clicks from, the "Emergency call" button.
*
* This code is mostly duplicated from the corresponding code in