diff options
author | Wileen Chiu <wileenc@codeaurora.org> | 2016-03-17 18:11:06 -0700 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-07-02 10:54:35 -0700 |
commit | 34040d04c9c0d521b9109eb24d42f079989381dd (patch) | |
tree | 507b5bf02660e283e7de9c77dcee1283ed08ce4a /packages | |
parent | 528b0ddbbe2cd0722d81bd429b2ef43d1fc6f303 (diff) | |
download | frameworks_base-34040d04c9c0d521b9109eb24d42f079989381dd.zip frameworks_base-34040d04c9c0d521b9109eb24d42f079989381dd.tar.gz frameworks_base-34040d04c9c0d521b9109eb24d42f079989381dd.tar.bz2 |
Add absent sim info to locked screen text
- For a multisim device, when only one sim is inserted
that is pin locked, the carrier text only shows
'SIM CARD IS LOCKED - NO SERVICE' even though the
voice registration state for one of the phones is 12,
where emergency calls are allowed
- This occurs when the state above is reported for the
slot where a sim card is not inserted. We only check for
active subscriptions when creating the display text
- Add a check for when only one sim card is inserted. If
the voice registration state is out of service for both
slots, with at least one as 12 (emergency allowed)
show 'Emergency calls only' instead of 'No service'
Change-Id: Ib58b6b7431d7b29c770287037cbf07c8df101ae3
CRs-Fixed: 985955
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); |