use of android.telephony.SubscriptionInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
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);
}
if (mNoSims != null) {
mNoSims.setEnabled(mSelectableSubInfos.size() >= 1);
}
}
use of android.telephony.SubscriptionInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SimSettings method updateSubscriptions.
private void updateSubscriptions() {
mSubInfoList = mSubscriptionManager.getActiveSubscriptionInfoList();
for (int i = 0; i < mNumSlots; ++i) {
Preference pref = mSimCards.findPreference("sim" + i);
if (pref instanceof SimPreference) {
mSimCards.removePreference(pref);
}
}
mMobileNetwork.removeAll();
mAvailableSubInfos.clear();
mSelectableSubInfos.clear();
for (int i = 0; i < mNumSlots; ++i) {
final SubscriptionInfo sir = mSubscriptionManager.getActiveSubscriptionInfoForSimSlotIndex(i);
final int subscriptionId = sir != null ? sir.getSubscriptionId() : SubscriptionManager.INVALID_SUBSCRIPTION_ID;
SimPreference simPreference = new SimEnablerPreference(getPrefContext(), sir, i);
simPreference.setOrder(i - mNumSlots);
mSimCards.addPreference(simPreference);
mAvailableSubInfos.add(sir);
if (sir != null && mUiccProvisionStatus[i] == PROVISIONED) {
mSelectableSubInfos.add(sir);
}
Intent mobileNetworkIntent = new Intent();
mobileNetworkIntent.setComponent(new ComponentName("com.android.phone", "com.android.phone.MobileNetworkSettings"));
SubscriptionManager.putPhoneIdAndSubIdExtra(mobileNetworkIntent, i, subscriptionId);
Preference mobileNetworkPref = new Preference(getActivity());
mobileNetworkPref.setTitle(getString(R.string.sim_mobile_network_settings_title, (i + 1)));
mobileNetworkPref.setIntent(mobileNetworkIntent);
mobileNetworkPref.setEnabled(subscriptionId != SubscriptionManager.INVALID_SUBSCRIPTION_ID);
mMobileNetwork.addPreference(mobileNetworkPref);
}
updateAllOptions();
}
use of android.telephony.SubscriptionInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
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 Resurrection_packages_apps_Settings by ResurrectionRemix.
the class Status method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
mHandler = new MyHandler(this);
mCM = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
mWifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
addPreferencesFromResource(R.xml.device_info_status);
mBatteryLevel = findPreference(KEY_BATTERY_LEVEL);
mBatteryStatus = findPreference(KEY_BATTERY_STATUS);
mBtAddress = findPreference(KEY_BT_ADDRESS);
mWifiMacAddress = findPreference(KEY_WIFI_MAC_ADDRESS);
mWimaxMacAddress = findPreference(KEY_WIMAX_MAC_ADDRESS);
mIpAddress = findPreference(KEY_IP_ADDRESS);
mRes = getResources();
mUnknown = mRes.getString(R.string.device_info_default);
mUnavailable = mRes.getString(R.string.status_unavailable);
// Note - missing in zaku build, be careful later...
mUptime = findPreference("up_time");
if (!hasBluetooth()) {
getPreferenceScreen().removePreference(mBtAddress);
mBtAddress = null;
}
if (!hasWimax()) {
getPreferenceScreen().removePreference(mWimaxMacAddress);
mWimaxMacAddress = null;
}
mConnectivityIntentFilter = new IntentFilter();
for (String intent : CONNECTIVITY_INTENTS) {
mConnectivityIntentFilter.addAction(intent);
}
updateConnectivity();
String serial = getSerialNumber();
if (serial != null && !serial.equals("")) {
setSummaryText(KEY_SERIAL_NUMBER, serial);
} else {
removePreferenceFromScreen(KEY_SERIAL_NUMBER);
}
//TODO: the bug above will surface in split system user mode.
if (!UserManager.get(getContext()).isAdminUser() || Utils.isWifiOnly(getContext())) {
removePreferenceFromScreen(KEY_SIM_STATUS);
removePreferenceFromScreen(KEY_IMEI_INFO);
} else {
int numPhones = TelephonyManager.getDefault().getPhoneCount();
if (numPhones > 1) {
PreferenceScreen prefSet = getPreferenceScreen();
Preference singleSimPref = prefSet.findPreference(KEY_SIM_STATUS);
SubscriptionManager subscriptionManager = SubscriptionManager.from(getActivity());
for (int i = 0; i < numPhones; i++) {
SubscriptionInfo sir = subscriptionManager.getActiveSubscriptionInfoForSimSlotIndex(i);
Preference pref = new Preference(getActivity());
pref.setOrder(singleSimPref.getOrder());
pref.setTitle(getString(R.string.sim_card_status_title, i + 1));
if (sir != null) {
pref.setSummary(sir.getDisplayName());
} else {
pref.setSummary(R.string.sim_card_summary_empty);
}
Intent intent = new Intent(getActivity(), Settings.SimStatusActivity.class);
intent.putExtra(Settings.EXTRA_SHOW_FRAGMENT_TITLE, getString(R.string.sim_card_status_title, i + 1));
intent.putExtra(Settings.EXTRA_SHOW_FRAGMENT_AS_SUBSETTING, true);
intent.putExtra(SimStatus.EXTRA_SLOT_ID, i);
pref.setIntent(intent);
prefSet.addPreference(pref);
}
prefSet.removePreference(singleSimPref);
}
}
if (SystemProperties.getBoolean("ro.alarm_boot", false)) {
removePreferenceFromScreen(KEY_IMEI_INFO);
}
}
use of android.telephony.SubscriptionInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SimDialogActivity method displayPreferredDialog.
private void displayPreferredDialog(final int slotId) {
final Resources res = getResources();
final Context context = getApplicationContext();
final SubscriptionInfo sir = SubscriptionManager.from(context).getActiveSubscriptionInfoForSimSlotIndex(slotId);
if (sir != null) {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setTitle(R.string.sim_preferred_title);
alertDialogBuilder.setMessage(res.getString(R.string.sim_preferred_message, sir.getDisplayName()));
alertDialogBuilder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
final int subId = sir.getSubscriptionId();
PhoneAccountHandle phoneAccountHandle = subscriptionIdToPhoneAccountHandle(subId);
setDefaultDataSubId(context, subId);
setDefaultSmsSubId(context, subId);
setUserSelectedOutgoingPhoneAccount(phoneAccountHandle);
finish();
}
});
alertDialogBuilder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
finish();
}
});
alertDialogBuilder.create().show();
} else {
finish();
}
}
Aggregations