summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/CryptKeeper.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/settings/CryptKeeper.java')
-rw-r--r--src/com/android/settings/CryptKeeper.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java
index 2739d91..10c067d 100644
--- a/src/com/android/settings/CryptKeeper.java
+++ b/src/com/android/settings/CryptKeeper.java
@@ -33,6 +33,7 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.storage.IMountService;
+import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
@@ -49,6 +50,7 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import com.android.internal.telephony.ITelephony;
+import com.android.internal.telephony.Phone;
import java.util.List;
@@ -296,6 +298,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
| StatusBarManager.DISABLE_HOME
| StatusBarManager.DISABLE_RECENT);
+ setAirplaneModeIfNecessary();
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
// Check for (and recover) retained instance data
final Object lastInstance = getLastNonConfigurationInstance();
@@ -607,6 +610,33 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
}
/**
+ * 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.");
+ Settings.System.putInt(getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 1);
+ 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