summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/SecuritySettings.java
diff options
context:
space:
mode:
authorPauloftheWest <paulofthewest@google.com>2014-10-03 11:07:14 -0700
committerPauloftheWest <paulofthewest@google.com>2014-10-03 15:22:59 -0700
commit50e6ecacf99c30bf239e68bd54895e3632315063 (patch)
tree682aa675af16e0c9f20449c079210bcf86552960 /src/com/android/settings/SecuritySettings.java
parentdbd052ed5ee71b2fc552e0a2954f8c283acc6f70 (diff)
downloadpackages_apps_Settings-50e6ecacf99c30bf239e68bd54895e3632315063.zip
packages_apps_Settings-50e6ecacf99c30bf239e68bd54895e3632315063.tar.gz
packages_apps_Settings-50e6ecacf99c30bf239e68bd54895e3632315063.tar.bz2
[DS] DSDS support for Settings
+ Rebase and modify as APIs rename. + Fix bugs on set sub's name as title. + Enabled Sim Settings. Change-Id: Ic731c7882be95b86b6b8dcdd3f208a6125681f3e
Diffstat (limited to 'src/com/android/settings/SecuritySettings.java')
-rw-r--r--src/com/android/settings/SecuritySettings.java29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 46a3c8e..b068c51 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -43,6 +43,8 @@ import android.provider.Settings.SettingNotFoundException;
import android.security.KeyStore;
import android.service.trust.TrustAgentService;
import android.telephony.TelephonyManager;
+import android.telephony.SubscriptionManager;
+import android.telephony.SubInfoRecord;
import android.text.TextUtils;
import android.util.Log;
@@ -299,13 +301,8 @@ public class SecuritySettings extends SettingsPreferenceFragment
if (!mIsPrimary || !tm.hasIccCard()) {
root.removePreference(root.findPreference(KEY_SIM_LOCK));
} else {
- // Disable SIM lock if sim card is missing or unknown
- if ((TelephonyManager.getDefault().getSimState() ==
- TelephonyManager.SIM_STATE_ABSENT) ||
- (TelephonyManager.getDefault().getSimState() ==
- TelephonyManager.SIM_STATE_UNKNOWN)) {
- root.findPreference(KEY_SIM_LOCK).setEnabled(false);
- }
+ // Disable SIM lock if there is no ready SIM card.
+ root.findPreference(KEY_SIM_LOCK).setEnabled(isSimReady());
}
if (Settings.System.getInt(getContentResolver(),
Settings.System.LOCK_TO_APP_ENABLED, 0) != 0) {
@@ -372,6 +369,24 @@ public class SecuritySettings extends SettingsPreferenceFragment
return root;
}
+ /* Return true if a SIM is ready for locking.
+ * TODO: consider adding to TelephonyManager or SubscritpionManasger.
+ */
+ private static boolean isSimReady() {
+ int simState = TelephonyManager.SIM_STATE_UNKNOWN;
+ final List<SubInfoRecord> subInfoList = SubscriptionManager.getActiveSubInfoList();
+ if (subInfoList != null) {
+ for (SubInfoRecord subInfo : subInfoList) {
+ simState = TelephonyManager.getDefault().getSimState(subInfo.slotId);
+ if((simState != TelephonyManager.SIM_STATE_ABSENT) &&
+ (simState != TelephonyManager.SIM_STATE_UNKNOWN)){
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
private static ArrayList<TrustAgentComponentInfo> getActiveTrustAgents(
PackageManager pm, LockPatternUtils utils) {
ArrayList<TrustAgentComponentInfo> result = new ArrayList<TrustAgentComponentInfo>();