diff options
| author | PauloftheWest <paulofthewest@google.com> | 2014-12-08 13:49:35 -0800 |
|---|---|---|
| committer | PauloftheWest <paulofthewest@google.com> | 2014-12-08 13:51:25 -0800 |
| commit | 0b8788aae47932db56bf71869c5d58e0338420a4 (patch) | |
| tree | bd857e079aacc31dc6af23139823d68c79b86225 /src/com/android/settings/SecuritySettings.java | |
| parent | 838d6dc94970201792bc825091c9b520fb96821a (diff) | |
| download | packages_apps_Settings-0b8788aae47932db56bf71869c5d58e0338420a4.tar.gz packages_apps_Settings-0b8788aae47932db56bf71869c5d58e0338420a4.tar.bz2 packages_apps_Settings-0b8788aae47932db56bf71869c5d58e0338420a4.zip | |
Fixed a SIM Lock UI issue
+ The SIM lock option will now appear if there is any SIM with locking
capabilities.
+ Also, if the first slot does not have a SIM in it, then the SIM lock
screen will disable the ability to lock the first slot.
Bug: 18473536
Change-Id: Ib4e0ed6e94b00bc07c9febdad433fdb3c55294b8
Diffstat (limited to 'src/com/android/settings/SecuritySettings.java')
| -rw-r--r-- | src/com/android/settings/SecuritySettings.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java index 5f74ff65b..2a1fc826a 100644 --- a/src/com/android/settings/SecuritySettings.java +++ b/src/com/android/settings/SecuritySettings.java @@ -298,7 +298,7 @@ public class SecuritySettings extends SettingsPreferenceFragment // Do not display SIM lock for devices without an Icc card TelephonyManager tm = TelephonyManager.getDefault(); - if (!mIsPrimary || !tm.hasIccCard()) { + if (!mIsPrimary || !isSimIccReady()) { root.removePreference(root.findPreference(KEY_SIM_LOCK)); } else { // Disable SIM lock if there is no ready SIM card. @@ -370,6 +370,24 @@ public class SecuritySettings extends SettingsPreferenceFragment return root; } + /* Return true if a there is a Slot that has Icc. + */ + private boolean isSimIccReady() { + TelephonyManager tm = TelephonyManager.getDefault(); + final List<SubscriptionInfo> subInfoList = + mSubscriptionManager.getActiveSubscriptionInfoList(); + + if (subInfoList != null) { + for (SubscriptionInfo subInfo : subInfoList) { + if (tm.hasIccCard(subInfo.getSubscriptionId())) { + return true; + } + } + } + + return false; + } + /* Return true if a SIM is ready for locking. * TODO: consider adding to TelephonyManager or SubscritpionManasger. */ |
