use of com.android.internal.telephony.SubscriptionController in project android_frameworks_opt_telephony by LineageOS.
the class UiccProfile method handleCarrierNameOverride.
/**
* Override the carrier name with either carrier config or SPN
* if an override is provided.
*/
private void handleCarrierNameOverride() {
SubscriptionController subCon = SubscriptionController.getInstance();
final int subId = subCon.getSubIdUsingPhoneId(mPhoneId);
if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
loge("subId not valid for Phone " + mPhoneId);
return;
}
CarrierConfigManager configLoader = (CarrierConfigManager) mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
if (configLoader == null) {
loge("Failed to load a Carrier Config");
return;
}
PersistableBundle config = configLoader.getConfigForSubId(subId);
boolean preferCcName = config.getBoolean(CarrierConfigManager.KEY_CARRIER_NAME_OVERRIDE_BOOL, false);
String ccName = config.getString(CarrierConfigManager.KEY_CARRIER_NAME_STRING);
String newCarrierName = null;
// Get the name from EF_SPN.
String currSpn = getServiceProviderName();
int nameSource = SubscriptionManager.NAME_SOURCE_SIM_SPN;
// a name in carrier config, use the carrier config name as a backup.
if (preferCcName || (TextUtils.isEmpty(currSpn) && !TextUtils.isEmpty(ccName))) {
newCarrierName = ccName;
nameSource = SubscriptionManager.NAME_SOURCE_CARRIER;
} else if (TextUtils.isEmpty(currSpn)) {
// currSpn is empty and could not get name from carrier config; get name from PNN or
// carrier id
Phone phone = PhoneFactory.getPhone(mPhoneId);
if (phone != null) {
// Get the name from EF_PNN.
String currPnn = phone.getPlmn();
if (!TextUtils.isEmpty(currPnn)) {
newCarrierName = currPnn;
nameSource = SubscriptionManager.NAME_SOURCE_SIM_PNN;
} else {
// Get the name from carrier id.
newCarrierName = phone.getCarrierName();
nameSource = SubscriptionManager.NAME_SOURCE_CARRIER_ID;
}
}
}
if (!TextUtils.isEmpty(newCarrierName)) {
mTelephonyManager.setSimOperatorNameForPhone(mPhoneId, newCarrierName);
mOperatorBrandOverrideRegistrants.notifyRegistrants();
}
updateCarrierNameForSubscription(subCon, subId, nameSource);
}
use of com.android.internal.telephony.SubscriptionController in project android_frameworks_opt_telephony by LineageOS.
the class UiccProfile method handleSimCountryIsoOverride.
/**
* Override sim country iso based on carrier config.
* Telephony country iso is based on MCC table which is coarse and doesn't work with dual IMSI
* SIM. e.g, a US carrier might have a roaming agreement with carriers from Europe. Devices
* will switch to different IMSI (differnt mccmnc) when enter roaming state. As a result, sim
* country iso (locale) will change to non-US.
*
* Each sim carrier should have a single country code. We should improve the accuracy of
* SIM country code look-up by using carrierid-to-countrycode table as an override on top of
* MCC table
*/
private void handleSimCountryIsoOverride() {
SubscriptionController subCon = SubscriptionController.getInstance();
final int subId = subCon.getSubIdUsingPhoneId(mPhoneId);
if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
loge("subId not valid for Phone " + mPhoneId);
return;
}
CarrierConfigManager configLoader = (CarrierConfigManager) mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
if (configLoader == null) {
loge("Failed to load a Carrier Config");
return;
}
PersistableBundle config = configLoader.getConfigForSubId(subId);
String iso = config.getString(CarrierConfigManager.KEY_SIM_COUNTRY_ISO_OVERRIDE_STRING);
if (!TextUtils.isEmpty(iso) && !iso.equals(mTelephonyManager.getSimCountryIsoForPhone(mPhoneId))) {
mTelephonyManager.setSimCountryIsoForPhone(mPhoneId, iso);
subCon.setCountryIso(iso, subId);
}
}
use of com.android.internal.telephony.SubscriptionController in project android_frameworks_opt_telephony by LineageOS.
the class CatService method getInstance.
/**
* Used by application to get an AppInterface object.
*
* @return The only Service object in the system
*/
// TODO Need to take care for MSIM
public static AppInterface getInstance() {
int slotId = PhoneConstants.DEFAULT_SLOT_INDEX;
SubscriptionController sControl = SubscriptionController.getInstance();
if (sControl != null) {
slotId = sControl.getSlotIndex(sControl.getDefaultSubId());
}
return getInstance(null, null, null, slotId);
}
Aggregations