Merge branch 'master' of https://googleplex-android.googlesource.com/_direct/platform/packages/apps/Settings
This commit is contained in:
@@ -39,6 +39,7 @@ import android.preference.PreferenceActivity;
|
|||||||
import android.preference.PreferenceGroup;
|
import android.preference.PreferenceGroup;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
import android.provider.Telephony;
|
import android.provider.Telephony;
|
||||||
|
import android.telephony.SubscriptionInfo;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
@@ -88,6 +89,7 @@ public class ApnSettings extends SettingsPreferenceFragment implements
|
|||||||
private RestoreApnUiHandler mRestoreApnUiHandler;
|
private RestoreApnUiHandler mRestoreApnUiHandler;
|
||||||
private RestoreApnProcessHandler mRestoreApnProcessHandler;
|
private RestoreApnProcessHandler mRestoreApnProcessHandler;
|
||||||
private HandlerThread mRestoreDefaultApnThread;
|
private HandlerThread mRestoreDefaultApnThread;
|
||||||
|
private SubscriptionInfo mSubscriptionInfo;
|
||||||
|
|
||||||
private UserManager mUm;
|
private UserManager mUm;
|
||||||
|
|
||||||
@@ -128,6 +130,8 @@ public class ApnSettings extends SettingsPreferenceFragment implements
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
|
final Activity activity = getActivity();
|
||||||
|
final int subId = activity.getIntent().getIntExtra("sub_id", -1);
|
||||||
|
|
||||||
mUm = (UserManager) getSystemService(Context.USER_SERVICE);
|
mUm = (UserManager) getSystemService(Context.USER_SERVICE);
|
||||||
|
|
||||||
@@ -137,6 +141,8 @@ public class ApnSettings extends SettingsPreferenceFragment implements
|
|||||||
if (!mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
|
if (!mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mSubscriptionInfo = Utils.findRecordBySubId(activity, subId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -196,8 +202,11 @@ public class ApnSettings extends SettingsPreferenceFragment implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void fillList() {
|
private void fillList() {
|
||||||
String where = "numeric=\""
|
final String mccmnc = mSubscriptionInfo == null ? ""
|
||||||
+ android.os.SystemProperties.get(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC, "")
|
: Integer.toString(mSubscriptionInfo.getMcc())
|
||||||
|
+ Integer.toString(mSubscriptionInfo.getMnc());
|
||||||
|
final String where = "numeric=\""
|
||||||
|
+ mccmnc
|
||||||
+ "\"";
|
+ "\"";
|
||||||
|
|
||||||
Cursor cursor = getContentResolver().query(Telephony.Carriers.CONTENT_URI, new String[] {
|
Cursor cursor = getContentResolver().query(Telephony.Carriers.CONTENT_URI, new String[] {
|
||||||
|
@@ -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