Set default sim name and carrier name from subinforecord object.
Changes for retrieving display name and carrier name from subinforecord object. Bug: 18247211 Bug: 17732079 Bug: 17321641 Change-Id: I718700648ddd5a2646c720591ce776bd30a03543 Conflicts: src/com/android/settings/sim/SimSettings.java
This commit is contained in:
@@ -115,33 +115,6 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
|||||||
private PreferenceCategory mSimCards = null;
|
private PreferenceCategory mSimCards = null;
|
||||||
|
|
||||||
private int mNumSims;
|
private int mNumSims;
|
||||||
/**
|
|
||||||
* Standard projection for the interesting columns of a normal note.
|
|
||||||
*/
|
|
||||||
private static final String[] sProjection = new String[] {
|
|
||||||
Telephony.Carriers._ID, // 0
|
|
||||||
Telephony.Carriers.NAME, // 1
|
|
||||||
Telephony.Carriers.APN, // 2
|
|
||||||
Telephony.Carriers.PROXY, // 3
|
|
||||||
Telephony.Carriers.PORT, // 4
|
|
||||||
Telephony.Carriers.USER, // 5
|
|
||||||
Telephony.Carriers.SERVER, // 6
|
|
||||||
Telephony.Carriers.PASSWORD, // 7
|
|
||||||
Telephony.Carriers.MMSC, // 8
|
|
||||||
Telephony.Carriers.MCC, // 9
|
|
||||||
Telephony.Carriers.MNC, // 10
|
|
||||||
Telephony.Carriers.NUMERIC, // 11
|
|
||||||
Telephony.Carriers.MMSPROXY,// 12
|
|
||||||
Telephony.Carriers.MMSPORT, // 13
|
|
||||||
Telephony.Carriers.AUTH_TYPE, // 14
|
|
||||||
Telephony.Carriers.TYPE, // 15
|
|
||||||
Telephony.Carriers.PROTOCOL, // 16
|
|
||||||
Telephony.Carriers.CARRIER_ENABLED, // 17
|
|
||||||
Telephony.Carriers.BEARER, // 18
|
|
||||||
Telephony.Carriers.ROAMING_PROTOCOL, // 19
|
|
||||||
Telephony.Carriers.MVNO_TYPE, // 20
|
|
||||||
Telephony.Carriers.MVNO_MATCH_DATA // 21
|
|
||||||
};
|
|
||||||
|
|
||||||
public SimSettings() {
|
public SimSettings() {
|
||||||
super(DISALLOW_CONFIG_SIM);
|
super(DISALLOW_CONFIG_SIM);
|
||||||
@@ -476,16 +449,10 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
|||||||
final Resources res = getResources();
|
final Resources res = getResources();
|
||||||
|
|
||||||
if (mSubInfoRecord != null) {
|
if (mSubInfoRecord != null) {
|
||||||
if(TextUtils.isEmpty(mSubInfoRecord.getDisplayName())) {
|
setTitle(String.format(res.getString(R.string.sim_editor_title),
|
||||||
setTitle(getCarrierName());
|
(mSubInfoRecord.getSimSlotIndex() + 1)));
|
||||||
String displayName = getCarrierName();
|
setSummary(mSubInfoRecord.getDisplayName() + " - " +
|
||||||
mSubInfoRecord.setDisplayName(displayName);
|
mSubInfoRecord.getNumber().toString());
|
||||||
SubscriptionManager.setDisplayName(displayName,
|
|
||||||
mSubInfoRecord.getSubscriptionId());
|
|
||||||
} else {
|
|
||||||
setTitle(mSubInfoRecord.getDisplayName());
|
|
||||||
}
|
|
||||||
setSummary(mSubInfoRecord.getNumber());
|
|
||||||
setEnabled(true);
|
setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
setSummary(R.string.sim_slot_empty);
|
setSummary(R.string.sim_slot_empty);
|
||||||
@@ -494,14 +461,6 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCarrierName() {
|
|
||||||
Uri mUri = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI,
|
|
||||||
mSubInfoRecord.getSubscriptionId());
|
|
||||||
Cursor mCursor = getActivity().managedQuery(mUri, sProjection, null, null);
|
|
||||||
mCursor.moveToFirst();
|
|
||||||
return mCursor.getString(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFormattedPhoneNumber() {
|
public String getFormattedPhoneNumber() {
|
||||||
try{
|
try{
|
||||||
final String rawNumber = PhoneFactory.getPhone(mSlotId).getLine1Number();
|
final String rawNumber = PhoneFactory.getPhone(mSlotId).getLine1Number();
|
||||||
@@ -561,7 +520,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
|||||||
numberView.setText(simPref.getFormattedPhoneNumber());
|
numberView.setText(simPref.getFormattedPhoneNumber());
|
||||||
|
|
||||||
TextView carrierView = (TextView)dialogLayout.findViewById(R.id.carrier);
|
TextView carrierView = (TextView)dialogLayout.findViewById(R.id.carrier);
|
||||||
carrierView.setText(getCarrierName());
|
carrierView.setText(mSubInfoRecord.getCarrierName());
|
||||||
|
|
||||||
builder.setTitle(String.format(res.getString(R.string.sim_editor_title),
|
builder.setTitle(String.format(res.getString(R.string.sim_editor_title),
|
||||||
(mSubInfoRecord.getSimSlotIndex() + 1)));
|
(mSubInfoRecord.getSimSlotIndex() + 1)));
|
||||||
|
Reference in New Issue
Block a user