use of android.telephony.SubscriptionInfo in project android_packages_apps_Settings by LineageOS.
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 LineageOS.
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);
}
}
mAvailableSubInfos.clear();
mSelectableSubInfos.clear();
for (int i = 0; i < mNumSlots; ++i) {
final SubscriptionInfo sir = mSubscriptionManager.getActiveSubscriptionInfoForSimSlotIndex(i);
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);
}
}
updateAllOptions();
}
use of android.telephony.SubscriptionInfo in project android_packages_apps_Settings by LineageOS.
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_Settings by LineageOS.
the class DataUsageUtils method getDefaultSubscriptionId.
/**
* Returns the default subscription if available else returns
* SubscriptionManager#INVALID_SUBSCRIPTION_ID
*/
public static int getDefaultSubscriptionId(Context context) {
SubscriptionManager subManager = SubscriptionManager.from(context);
if (subManager == null) {
return SubscriptionManager.INVALID_SUBSCRIPTION_ID;
}
SubscriptionInfo subscriptionInfo = subManager.getDefaultDataSubscriptionInfo();
if (subscriptionInfo == null) {
List<SubscriptionInfo> list = subManager.getAllSubscriptionInfoList();
if (list.size() == 0) {
return SubscriptionManager.INVALID_SUBSCRIPTION_ID;
}
subscriptionInfo = list.get(0);
}
return subscriptionInfo.getSubscriptionId();
}
use of android.telephony.SubscriptionInfo in project android_packages_apps_Settings by omnirom.
the class SettingsDumpService method dumpDataUsage.
private JSONObject dumpDataUsage() throws JSONException {
JSONObject obj = new JSONObject();
DataUsageController controller = new DataUsageController(this);
ConnectivityManager connectivityManager = getSystemService(ConnectivityManager.class);
SubscriptionManager manager = SubscriptionManager.from(this);
TelephonyManager telephonyManager = TelephonyManager.from(this);
if (connectivityManager.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)) {
JSONArray array = new JSONArray();
for (SubscriptionInfo info : manager.getAllSubscriptionInfoList()) {
NetworkTemplate mobileAll = NetworkTemplate.buildTemplateMobileAll(telephonyManager.getSubscriberId(info.getSubscriptionId()));
final JSONObject usage = dumpDataUsage(mobileAll, controller);
usage.put("subId", info.getSubscriptionId());
array.put(usage);
}
obj.put("cell", array);
}
if (connectivityManager.isNetworkSupported(ConnectivityManager.TYPE_WIFI)) {
obj.put("wifi", dumpDataUsage(NetworkTemplate.buildTemplateWifiWildcard(), controller));
}
if (connectivityManager.isNetworkSupported(ConnectivityManager.TYPE_ETHERNET)) {
obj.put("ethernet", dumpDataUsage(NetworkTemplate.buildTemplateEthernet(), controller));
}
return obj;
}
Aggregations