am e6d7b31f
: Merge "Fixed a SIM Lock UI issue" into lmp-mr1-dev
* commit 'e6d7b31fc44ef6f0865ef22401217b70a6676eaa': Fixed a SIM Lock UI issue
This commit is contained in:
@@ -221,9 +221,13 @@ public class IccLockSettings extends PreferenceActivity
|
|||||||
? context.getString(R.string.sim_editor_title, i + 1)
|
? context.getString(R.string.sim_editor_title, i + 1)
|
||||||
: subInfo.getDisplayName())));
|
: subInfo.getDisplayName())));
|
||||||
}
|
}
|
||||||
}
|
final SubscriptionInfo sir = Utils.findRecordBySlotId(getBaseContext(), 0);
|
||||||
|
|
||||||
mPhone = PhoneFactory.getDefaultPhone();
|
mPhone = (sir == null) ? null
|
||||||
|
: PhoneFactory.getPhone(SubscriptionManager.getPhoneId(sir.getSubscriptionId()));
|
||||||
|
} else {
|
||||||
|
mPhone = PhoneFactory.getDefaultPhone();
|
||||||
|
}
|
||||||
mRes = getResources();
|
mRes = getResources();
|
||||||
updatePreferences();
|
updatePreferences();
|
||||||
}
|
}
|
||||||
|
@@ -298,7 +298,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
// Do not display SIM lock for devices without an Icc card
|
// Do not display SIM lock for devices without an Icc card
|
||||||
TelephonyManager tm = TelephonyManager.getDefault();
|
TelephonyManager tm = TelephonyManager.getDefault();
|
||||||
if (!mIsPrimary || !tm.hasIccCard()) {
|
if (!mIsPrimary || !isSimIccReady()) {
|
||||||
root.removePreference(root.findPreference(KEY_SIM_LOCK));
|
root.removePreference(root.findPreference(KEY_SIM_LOCK));
|
||||||
} else {
|
} else {
|
||||||
// Disable SIM lock if there is no ready SIM card.
|
// Disable SIM lock if there is no ready SIM card.
|
||||||
@@ -370,6 +370,24 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
return root;
|
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.
|
/* Return true if a SIM is ready for locking.
|
||||||
* TODO: consider adding to TelephonyManager or SubscritpionManasger.
|
* TODO: consider adding to TelephonyManager or SubscritpionManasger.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user