Clean up public API of SubInfoRecord.
bug: 17575308 Change-Id: I38afd507b1c004fd566214c0b3812cab226936df
This commit is contained in:
@@ -1134,7 +1134,7 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
|
|||||||
final SubInfoRecord nextSir = SubscriptionManager.getSubInfoForSubscriber(
|
final SubInfoRecord nextSir = SubscriptionManager.getSubInfoForSubscriber(
|
||||||
SubscriptionManager.getDefaultDataSubId());
|
SubscriptionManager.getDefaultDataSubId());
|
||||||
|
|
||||||
if (currentSir.subId == nextSir.subId) {
|
if (currentSir.getSubscriptionId() == nextSir.getSubscriptionId()) {
|
||||||
setMobileDataEnabled(true);
|
setMobileDataEnabled(true);
|
||||||
updateBody();
|
updateBody();
|
||||||
return;
|
return;
|
||||||
@@ -1144,12 +1144,12 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
|
|||||||
|
|
||||||
builder.setTitle(R.string.sim_change_data_title);
|
builder.setTitle(R.string.sim_change_data_title);
|
||||||
builder.setMessage(getActivity().getResources().getString(R.string.sim_change_data_message,
|
builder.setMessage(getActivity().getResources().getString(R.string.sim_change_data_message,
|
||||||
currentSir.displayName, nextSir.displayName));
|
currentSir.getDisplayName(), nextSir.getDisplayName()));
|
||||||
|
|
||||||
builder.setPositiveButton(R.string.okay, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(R.string.okay, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
SubscriptionManager.setDefaultDataSubId(currentSir.subId);
|
SubscriptionManager.setDefaultDataSubId(currentSir.getSubscriptionId());
|
||||||
setMobileDataEnabled(true);
|
setMobileDataEnabled(true);
|
||||||
updateBody();
|
updateBody();
|
||||||
}
|
}
|
||||||
@@ -2347,7 +2347,7 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
|
|||||||
// require both supported network and ready SIM
|
// require both supported network and ready SIM
|
||||||
boolean isReady = true;
|
boolean isReady = true;
|
||||||
for (SubInfoRecord subInfo : subInfoList) {
|
for (SubInfoRecord subInfo : subInfoList) {
|
||||||
isReady = isReady & tele.getSimState(subInfo.slotId) == SIM_STATE_READY;
|
isReady = isReady & tele.getSimState(subInfo.getSimSlotIndex()) == SIM_STATE_READY;
|
||||||
}
|
}
|
||||||
return conn.isNetworkSupported(TYPE_MOBILE) && isReady;
|
return conn.isNetworkSupported(TYPE_MOBILE) && isReady;
|
||||||
}
|
}
|
||||||
@@ -2588,9 +2588,9 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
|
|||||||
private void addMobileTab(Context context, List<SubInfoRecord> subInfoList) {
|
private void addMobileTab(Context context, List<SubInfoRecord> subInfoList) {
|
||||||
if (subInfoList != null) {
|
if (subInfoList != null) {
|
||||||
for (SubInfoRecord subInfo : mSubInfoList) {
|
for (SubInfoRecord subInfo : mSubInfoList) {
|
||||||
if (hasReadyMobileRadio(context, subInfo.subId)) {
|
if (hasReadyMobileRadio(context, subInfo.getSubscriptionId())) {
|
||||||
mTabHost.addTab(buildTabSpec(mMobileTagMap.get(subInfo.subId),
|
mTabHost.addTab(buildTabSpec(mMobileTagMap.get(subInfo.getSubscriptionId()),
|
||||||
subInfo.displayName));
|
subInfo.getDisplayName().toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2601,7 +2601,7 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
|
|||||||
final int currentTagIndex = mTabHost.getCurrentTab();
|
final int currentTagIndex = mTabHost.getCurrentTab();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (SubInfoRecord subInfo : mSubInfoList) {
|
for (SubInfoRecord subInfo : mSubInfoList) {
|
||||||
if (hasReadyMobileRadio(context, subInfo.subId)) {
|
if (hasReadyMobileRadio(context, subInfo.getSubscriptionId())) {
|
||||||
if (i++ == currentTagIndex) {
|
if (i++ == currentTagIndex) {
|
||||||
return subInfo;
|
return subInfo;
|
||||||
}
|
}
|
||||||
@@ -2622,8 +2622,8 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
|
|||||||
String mobileTag;
|
String mobileTag;
|
||||||
map = new HashMap<Integer, String>();
|
map = new HashMap<Integer, String>();
|
||||||
for (SubInfoRecord subInfo : subInfoList) {
|
for (SubInfoRecord subInfo : subInfoList) {
|
||||||
mobileTag = TAB_MOBILE + String.valueOf(subInfo.subId);
|
mobileTag = TAB_MOBILE + String.valueOf(subInfo.getSubscriptionId());
|
||||||
map.put(subInfo.subId,mobileTag);
|
map.put(subInfo.getSubscriptionId(), mobileTag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
|
@@ -374,7 +374,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
final List<SubInfoRecord> subInfoList = SubscriptionManager.getActiveSubInfoList();
|
final List<SubInfoRecord> subInfoList = SubscriptionManager.getActiveSubInfoList();
|
||||||
if (subInfoList != null) {
|
if (subInfoList != null) {
|
||||||
for (SubInfoRecord subInfo : subInfoList) {
|
for (SubInfoRecord subInfo : subInfoList) {
|
||||||
simState = TelephonyManager.getDefault().getSimState(subInfo.slotId);
|
simState = TelephonyManager.getDefault().getSimState(subInfo.getSimSlotIndex());
|
||||||
if((simState != TelephonyManager.SIM_STATE_ABSENT) &&
|
if((simState != TelephonyManager.SIM_STATE_ABSENT) &&
|
||||||
(simState != TelephonyManager.SIM_STATE_UNKNOWN)){
|
(simState != TelephonyManager.SIM_STATE_UNKNOWN)){
|
||||||
return true;
|
return true;
|
||||||
|
@@ -110,7 +110,7 @@ public class ImeiInformation extends PreferenceActivity {
|
|||||||
final Phone[] phones = PhoneFactory.getPhones();
|
final Phone[] phones = PhoneFactory.getPhones();
|
||||||
for (int i = 0; i < phones.length; i++) {
|
for (int i = 0; i < phones.length; i++) {
|
||||||
// Currently we only operate with the first subscription of a SIM.
|
// Currently we only operate with the first subscription of a SIM.
|
||||||
if (phones[i].getSubId() == subInfos.get(0).subId) {
|
if (phones[i].getSubId() == subInfos.get(0).getSubscriptionId()) {
|
||||||
return phones[i];
|
return phones[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -232,7 +232,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
|||||||
|
|
||||||
for (int i = 0; i < availableSubInfoLength; ++i) {
|
for (int i = 0; i < availableSubInfoLength; ++i) {
|
||||||
final SubInfoRecord sir = mAvailableSubInfos.get(i);
|
final SubInfoRecord sir = mAvailableSubInfos.get(i);
|
||||||
if (sir != null && sir.subId == subId) {
|
if (sir != null && sir.getSubscriptionId() == subId) {
|
||||||
return sir;
|
return sir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -250,7 +250,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
|||||||
|
|
||||||
for (int i = 0; i < availableSubInfoLength; ++i) {
|
for (int i = 0; i < availableSubInfoLength; ++i) {
|
||||||
final SubInfoRecord sir = mSubInfoList.get(i);
|
final SubInfoRecord sir = mSubInfoList.get(i);
|
||||||
if (sir.slotId == slotId) {
|
if (sir.getSimSlotIndex() == slotId) {
|
||||||
//Right now we take the first subscription on a SIM.
|
//Right now we take the first subscription on a SIM.
|
||||||
return sir;
|
return sir;
|
||||||
}
|
}
|
||||||
@@ -265,9 +265,9 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
|||||||
final SubInfoRecord sir = findRecordBySubId(SubscriptionManager.getDefaultSmsSubId());
|
final SubInfoRecord sir = findRecordBySubId(SubscriptionManager.getDefaultSmsSubId());
|
||||||
simPref.setTitle(R.string.sms_messages_title);
|
simPref.setTitle(R.string.sms_messages_title);
|
||||||
if (mSubInfoList.size() == 1) {
|
if (mSubInfoList.size() == 1) {
|
||||||
simPref.setSummary(mSubInfoList.get(0).displayName);
|
simPref.setSummary(mSubInfoList.get(0).getDisplayName());
|
||||||
} else if (sir != null) {
|
} else if (sir != null) {
|
||||||
simPref.setSummary(sir.displayName);
|
simPref.setSummary(sir.getDisplayName());
|
||||||
} else if (sir == null) {
|
} else if (sir == null) {
|
||||||
simPref.setSummary(R.string.sim_selection_required_pref);
|
simPref.setSummary(R.string.sim_selection_required_pref);
|
||||||
}
|
}
|
||||||
@@ -279,9 +279,9 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
|||||||
final SubInfoRecord sir = findRecordBySubId(SubscriptionManager.getDefaultDataSubId());
|
final SubInfoRecord sir = findRecordBySubId(SubscriptionManager.getDefaultDataSubId());
|
||||||
simPref.setTitle(R.string.cellular_data_title);
|
simPref.setTitle(R.string.cellular_data_title);
|
||||||
if (mSubInfoList.size() == 1) {
|
if (mSubInfoList.size() == 1) {
|
||||||
simPref.setSummary(mSubInfoList.get(0).displayName);
|
simPref.setSummary(mSubInfoList.get(0).getDisplayName());
|
||||||
} else if (sir != null) {
|
} else if (sir != null) {
|
||||||
simPref.setSummary(sir.displayName);
|
simPref.setSummary(sir.getDisplayName());
|
||||||
} else if (sir == null) {
|
} else if (sir == null) {
|
||||||
simPref.setSummary(R.string.sim_selection_required_pref);
|
simPref.setSummary(R.string.sim_selection_required_pref);
|
||||||
}
|
}
|
||||||
@@ -339,7 +339,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
|||||||
|
|
||||||
if (id == DATA_PICK) {
|
if (id == DATA_PICK) {
|
||||||
sir = mSelectableSubInfos.get(value);
|
sir = mSelectableSubInfos.get(value);
|
||||||
SubscriptionManager.setDefaultDataSubId(sir.subId);
|
SubscriptionManager.setDefaultDataSubId(sir.getSubscriptionId());
|
||||||
} else if (id == CALLS_PICK) {
|
} else if (id == CALLS_PICK) {
|
||||||
final TelecomManager telecomManager =
|
final TelecomManager telecomManager =
|
||||||
TelecomManager.from(getActivity());
|
TelecomManager.from(getActivity());
|
||||||
@@ -349,7 +349,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
|||||||
value < 1 ? null : phoneAccountsList.get(value - 1));
|
value < 1 ? null : phoneAccountsList.get(value - 1));
|
||||||
} else if (id == SMS_PICK) {
|
} else if (id == SMS_PICK) {
|
||||||
sir = mSelectableSubInfos.get(value);
|
sir = mSelectableSubInfos.get(value);
|
||||||
SubscriptionManager.setDefaultSmsSubId(sir.subId);
|
SubscriptionManager.setDefaultSmsSubId(sir.getSubscriptionId());
|
||||||
}
|
}
|
||||||
|
|
||||||
updateActivitesCategory();
|
updateActivitesCategory();
|
||||||
@@ -370,7 +370,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
|||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < selectableSubInfoLength; ++i) {
|
for (int i = 0; i < selectableSubInfoLength; ++i) {
|
||||||
final SubInfoRecord sir = mSelectableSubInfos.get(i);
|
final SubInfoRecord sir = mSelectableSubInfos.get(i);
|
||||||
list.add(sir.displayName);
|
list.add(sir.getDisplayName().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -472,14 +472,16 @@ 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.displayName)) {
|
if(TextUtils.isEmpty(mSubInfoRecord.getDisplayName())) {
|
||||||
setTitle(getCarrierName());
|
setTitle(getCarrierName());
|
||||||
mSubInfoRecord.displayName = getCarrierName();
|
String displayName = getCarrierName();
|
||||||
SubscriptionManager.setDisplayName(getCarrierName(), mSubInfoRecord.subId);
|
mSubInfoRecord.setDisplayName(displayName);
|
||||||
|
SubscriptionManager.setDisplayName(displayName,
|
||||||
|
mSubInfoRecord.getSubscriptionId());
|
||||||
} else {
|
} else {
|
||||||
setTitle(mSubInfoRecord.displayName);
|
setTitle(mSubInfoRecord.getDisplayName());
|
||||||
}
|
}
|
||||||
setSummary(mSubInfoRecord.number.toString());
|
setSummary(mSubInfoRecord.getNumber().toString());
|
||||||
setEnabled(true);
|
setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
setSummary(R.string.sim_slot_empty);
|
setSummary(R.string.sim_slot_empty);
|
||||||
@@ -489,7 +491,8 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getCarrierName() {
|
public String getCarrierName() {
|
||||||
Uri mUri = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI, mSubInfoRecord.subId);
|
Uri mUri = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI,
|
||||||
|
mSubInfoRecord.getSubscriptionId());
|
||||||
Cursor mCursor = getActivity().managedQuery(mUri, sProjection, null, null);
|
Cursor mCursor = getActivity().managedQuery(mUri, sProjection, null, null);
|
||||||
mCursor.moveToFirst();
|
mCursor.moveToFirst();
|
||||||
return mCursor.getString(1);
|
return mCursor.getString(1);
|
||||||
@@ -523,7 +526,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
|||||||
builder.setView(dialogLayout);
|
builder.setView(dialogLayout);
|
||||||
|
|
||||||
EditText nameText = (EditText)dialogLayout.findViewById(R.id.sim_name);
|
EditText nameText = (EditText)dialogLayout.findViewById(R.id.sim_name);
|
||||||
nameText.setText(mSubInfoRecord.displayName);
|
nameText.setText(mSubInfoRecord.getDisplayName());
|
||||||
|
|
||||||
final Spinner colorSpinner = (Spinner) dialogLayout.findViewById(R.id.spinner);
|
final Spinner colorSpinner = (Spinner) dialogLayout.findViewById(R.id.spinner);
|
||||||
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getContext(),
|
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getContext(),
|
||||||
@@ -532,7 +535,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
|||||||
colorSpinner.setAdapter(adapter);
|
colorSpinner.setAdapter(adapter);
|
||||||
|
|
||||||
for (int i = 0; i < colorArr.length; i++) {
|
for (int i = 0; i < colorArr.length; i++) {
|
||||||
if (colorArr[i] == mSubInfoRecord.color) {
|
if (colorArr[i] == mSubInfoRecord.getColor()) {
|
||||||
colorSpinner.setSelection(i);
|
colorSpinner.setSelection(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -557,23 +560,25 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
|||||||
carrierView.setText(getCarrierName());
|
carrierView.setText(getCarrierName());
|
||||||
|
|
||||||
builder.setTitle(String.format(res.getString(R.string.sim_editor_title),
|
builder.setTitle(String.format(res.getString(R.string.sim_editor_title),
|
||||||
(mSubInfoRecord.slotId + 1)));
|
(mSubInfoRecord.getSimSlotIndex() + 1)));
|
||||||
|
|
||||||
builder.setPositiveButton(R.string.okay, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(R.string.okay, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int whichButton) {
|
public void onClick(DialogInterface dialog, int whichButton) {
|
||||||
final EditText nameText = (EditText)dialogLayout.findViewById(R.id.sim_name);
|
final EditText nameText = (EditText)dialogLayout.findViewById(R.id.sim_name);
|
||||||
|
|
||||||
mSubInfoRecord.displayName = nameText.getText().toString();
|
String displayName = nameText.getText().toString();
|
||||||
SubscriptionManager.setDisplayName(mSubInfoRecord.displayName,
|
int subId = mSubInfoRecord.getSubscriptionId();
|
||||||
mSubInfoRecord.subId);
|
mSubInfoRecord.setDisplayName(displayName);
|
||||||
findRecordBySubId(mSubInfoRecord.subId).displayName =
|
SubscriptionManager.setDisplayName(displayName, subId);
|
||||||
nameText.getText().toString();
|
findRecordBySubId(subId).setDisplayName(displayName);
|
||||||
|
|
||||||
final int colorSelected = colorSpinner.getSelectedItemPosition();
|
final int colorSelected = colorSpinner.getSelectedItemPosition();
|
||||||
mSubInfoRecord.color = colorArr[colorSelected];
|
int subscriptionId = mSubInfoRecord.getSubscriptionId();
|
||||||
SubscriptionManager.setColor(colorArr[colorSelected], mSubInfoRecord.subId);
|
int color = colorArr[colorSelected];
|
||||||
findRecordBySubId(mSubInfoRecord.subId).color = colorArr[colorSelected];
|
mSubInfoRecord.setColor(color);
|
||||||
|
SubscriptionManager.setColor(color, subscriptionId);
|
||||||
|
findRecordBySubId(subscriptionId).setColor(color);
|
||||||
|
|
||||||
updateAllOptions();
|
updateAllOptions();
|
||||||
update();
|
update();
|
||||||
@@ -603,9 +608,9 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(SubInfoRecord arg0, SubInfoRecord arg1) {
|
public int compare(SubInfoRecord arg0, SubInfoRecord arg1) {
|
||||||
int flag = arg0.slotId - arg1.slotId;
|
int flag = arg0.getSimSlotIndex() - arg1.getSimSlotIndex();
|
||||||
if (flag == 0) {
|
if (flag == 0) {
|
||||||
return (int) (arg0.subId - arg1.subId);
|
return (int) (arg0.getSubscriptionId() - arg1.getSubscriptionId());
|
||||||
}
|
}
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user