Disable shortcut view for airplane mode.
The network country code in airplane mode depends on radio/modem
implementation and may cause inconsistent behavior. Disable shortcut
view since it's difficult to judge if the country code is correct at
that moment.
Bug: 112168722
Bug: 123052993
Test: Manually
Change-Id: Iec73fb78ad4744b0b3c636eaa82d762e59c3ea40
diff --git a/src/com/android/phone/EmergencyDialer.java b/src/com/android/phone/EmergencyDialer.java
index 52ad6da..468919f 100644
--- a/src/com/android/phone/EmergencyDialer.java
+++ b/src/com/android/phone/EmergencyDialer.java
@@ -364,7 +364,11 @@
mIsShortcutViewEnabled = false;
mPhoneInfo = null;
if (canEnableShortcutView(carrierConfig)) {
- mPhoneInfo = ShortcutViewUtils.pickPreferredPhone(this);
+ if (!isAirplaneModeOn()) {
+ mPhoneInfo = ShortcutViewUtils.pickPreferredPhone(this);
+ } else {
+ Log.d(LOG_TAG, "Disables shortcut view in airplane mode");
+ }
if (mPhoneInfo != null) {
mIsShortcutViewEnabled = true;
}
@@ -823,6 +827,11 @@
return true;
}
+ private boolean isAirplaneModeOn() {
+ return Settings.Global.getInt(getContentResolver(),
+ Settings.Global.AIRPLANE_MODE_ON, 0) != 0;
+ }
+
/**
* Sets theme based on gradient colors
*