use of android.telephony.SubscriptionInfo in project android_packages_apps_Settings by DirtyUnicorns.
the class SimSettings method onCreate.
@Override
public void onCreate(final Bundle bundle) {
super.onCreate(bundle);
mContext = getActivity();
mSubscriptionManager = SubscriptionManager.from(getActivity());
final TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
mExtTelephony = IExtTelephony.Stub.asInterface(ServiceManager.getService("extphone"));
addPreferencesFromResource(R.xml.sim_settings);
mNumSlots = tm.getSimCount();
mSimCards = (PreferenceCategory) findPreference(SIM_CARD_CATEGORY);
mAvailableSubInfos = new ArrayList<SubscriptionInfo>(mNumSlots);
mSelectableSubInfos = new ArrayList<SubscriptionInfo>();
SimSelectNotification.cancelNotification(getActivity());
IntentFilter intentFilter = new IntentFilter(ACTION_UICC_MANUAL_PROVISION_STATUS_CHANGED);
mContext.registerReceiver(mReceiver, intentFilter);
}
use of android.telephony.SubscriptionInfo in project android_packages_apps_Settings by DirtyUnicorns.
the class SimSettings method updateCellularDataValues.
private void updateCellularDataValues() {
final Preference simPref = findPreference(KEY_CELLULAR_DATA);
final SubscriptionInfo sir = mSubscriptionManager.getDefaultDataSubscriptionInfo();
simPref.setTitle(R.string.cellular_data_title);
if (DBG)
log("[updateCellularDataValues] mSubInfoList=" + mSubInfoList);
boolean callStateIdle = isCallStateIdle();
final boolean ecbMode = SystemProperties.getBoolean(TelephonyProperties.PROPERTY_INECM_MODE, false);
if (sir != null) {
simPref.setSummary(sir.getDisplayName());
// Enable data preference in msim mode and call state idle
simPref.setEnabled((mSelectableSubInfos.size() > 1) && callStateIdle && !ecbMode);
} else if (sir == null) {
simPref.setSummary(R.string.sim_selection_required_pref);
// Enable data preference in msim mode and call state idle
simPref.setEnabled((mSelectableSubInfos.size() >= 1) && callStateIdle && !ecbMode);
}
}
use of android.telephony.SubscriptionInfo in project android_packages_apps_Settings by DirtyUnicorns.
the class SimSettings method updateSmsValues.
private void updateSmsValues() {
final Preference simPref = findPreference(KEY_SMS);
final SubscriptionInfo sir = mSubscriptionManager.getDefaultSmsSubscriptionInfo();
simPref.setTitle(R.string.sms_messages_title);
if (DBG)
log("[updateSmsValues] mSubInfoList=" + mSubInfoList);
if (sir != null) {
simPref.setSummary(sir.getDisplayName());
simPref.setEnabled(mSelectableSubInfos.size() > 1);
} else if (sir == null) {
simPref.setSummary(R.string.sim_selection_required_pref);
simPref.setEnabled(mSelectableSubInfos.size() >= 1);
}
}
use of android.telephony.SubscriptionInfo in project android_packages_apps_Dialer by MoKee.
the class SpeedDialListActivity method onItemClick.
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (position == 0) {
Intent intent = new Intent(ACTION_ADD_VOICEMAIL);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
if (TelephonyManager.getDefault().getPhoneCount() > 1) {
int sub = SubscriptionManager.getDefaultVoiceSubscriptionId();
SubscriptionInfo subInfo = mSubscriptionManager.getActiveSubscriptionInfo(sub);
if (subInfo != null) {
intent.putExtra(SUB_ID_EXTRA, subInfo.getSubscriptionId());
intent.putExtra(SUB_LABEL_EXTRA, subInfo.getDisplayName().toString());
}
}
try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
Log.w(TAG, "Could not find voice mail setup activity");
}
} else {
int number = position + 1;
if (mEmergencyCallSpeedDial && (number == mSpeedDialKeyforEmergncyCall)) {
Toast.makeText(SpeedDialListActivity.this, R.string.speed_dial_can_not_be_set, Toast.LENGTH_SHORT).show();
return;
}
mItemPosition = number;
final Record record = mRecords.get(number);
if (record == null) {
showAddSpeedDialDialog(number);
} else {
PopupMenu pm = new PopupMenu(this, view, Gravity.START);
pm.getMenu().add(number, MENU_REPLACE, 0, R.string.speed_dial_replace);
pm.getMenu().add(number, MENU_DELETE, 0, R.string.speed_dial_delete);
pm.setOnMenuItemClickListener(this);
pm.show();
}
}
}
use of android.telephony.SubscriptionInfo in project android_packages_apps_Dialer by MoKee.
the class InCallActivity method updateDsdaTabLabels.
private void updateDsdaTabLabels() {
int tabCount = mDsdaTabLayout.getTabCount();
for (int i = 0; i < tabCount; i++) {
TabLayout.Tab tab = mDsdaTabLayout.getTabAt(i);
int phoneId = (Integer) tab.getTag();
SubscriptionInfo info = null;
for (int j = 0; j < mSubInfos.size(); j++) {
if (mSubInfos.get(j).getSimSlotIndex() == phoneId) {
info = mSubInfos.get(j);
break;
}
}
tab.setText(info != null ? info.getDisplayName() : "SIM " + (i + 1));
}
}
Aggregations