diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/Keyguard/src/com/android/keyguard/CarrierText.java | 19 | ||||
-rw-r--r-- | packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java | 30 |
2 files changed, 49 insertions, 0 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/CarrierText.java b/packages/Keyguard/src/com/android/keyguard/CarrierText.java index 8dd56fa..f21ce7f 100644 --- a/packages/Keyguard/src/com/android/keyguard/CarrierText.java +++ b/packages/Keyguard/src/com/android/keyguard/CarrierText.java @@ -188,6 +188,25 @@ public class CarrierText extends TextView { } } } + /* + * In the case where there is only one sim inserted in a multisim device, if + * the voice registration service state is reported as 12 (no service with emergency) + * for at least one of the sim concatenate the sim state with Emergency calls only" + */ + if (N < TelephonyManager.getDefault().getPhoneCount() && + mKeyguardUpdateMonitor.isEmergencyOnly()) { + int presentSubId = mKeyguardUpdateMonitor.getPresentSubId(); + + if (DEBUG) { + Log.d(TAG, " Present sim - sub id: " + presentSubId); + } + if (presentSubId != -1) { + CharSequence emergencyOnlyText = + getContext().getText(com.android.internal.R.string.emergency_calls_only); + displayText = getCarrierTextForSimState( + mKeyguardUpdateMonitor.getSimState(presentSubId), emergencyOnlyText); + } + } if (allSimsMissing) { if (N != 0) { // Shows "No SIM card | Emergency calls only" on devices that are voice-capable. diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java index be8ded3..f608f13 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -383,6 +383,36 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { return mSubscriptionInfo; } + public boolean isEmergencyOnly() { + boolean isEmerg = false; + ServiceState state; + for (int slotId = 0; slotId < TelephonyManager.getDefault().getPhoneCount(); slotId++) { + state = null; + int[] subId = mSubscriptionManager.getSubId(slotId); + if (subId != null && subId.length > 0) { + state = mServiceStates.get(subId[0]); + } + if (state != null) { + if (state.getVoiceRegState() == ServiceState.STATE_IN_SERVICE) + return false; + else if (state.isEmergencyOnly()) { + isEmerg = true; + } + } + } + return isEmerg; + } + + public int getPresentSubId() { + for (int slotId = 0; slotId < TelephonyManager.getDefault().getPhoneCount(); slotId++) { + int[] subId = mSubscriptionManager.getSubId(slotId); + if (subId != null && subId.length > 0 && getSimState(subId[0]) != State.ABSENT) { + return subId[0]; + } + } + return -1; + } + @Override public void onTrustManagedChanged(boolean managed, int userId) { mUserTrustIsManaged.put(userId, managed); |