use of com.android.internal.telephony.uicc.SIMRecords in project android_frameworks_opt_telephony by LineageOS.
the class GsmCdmaPhone method onUpdateIccAvailability.
// todo: check if ICC availability needs to be handled here. mSimRecords should not be needed
// now because APIs can be called directly on UiccProfile, and that should handle the requests
// correctly based on supported apps, voice RAT, etc.
@Override
protected void onUpdateIccAvailability() {
if (mUiccController == null) {
return;
}
UiccCardApplication newUiccApplication = null;
// Update mIsimUiccRecords
if (isPhoneTypeGsm() || isPhoneTypeCdmaLte()) {
newUiccApplication = mUiccController.getUiccCardApplication(mPhoneId, UiccController.APP_FAM_IMS);
IsimUiccRecords newIsimUiccRecords = null;
if (newUiccApplication != null) {
newIsimUiccRecords = (IsimUiccRecords) newUiccApplication.getIccRecords();
if (DBG)
logd("New ISIM application found");
}
mIsimUiccRecords = newIsimUiccRecords;
}
// Update mSimRecords
if (mSimRecords != null) {
mSimRecords.unregisterForRecordsLoaded(this);
}
if (isPhoneTypeCdmaLte() || isPhoneTypeCdma()) {
newUiccApplication = mUiccController.getUiccCardApplication(mPhoneId, UiccController.APP_FAM_3GPP);
SIMRecords newSimRecords = null;
if (newUiccApplication != null) {
newSimRecords = (SIMRecords) newUiccApplication.getIccRecords();
}
mSimRecords = newSimRecords;
if (mSimRecords != null) {
mSimRecords.registerForRecordsLoaded(this, EVENT_SIM_RECORDS_LOADED, null);
}
} else {
mSimRecords = null;
}
// Update mIccRecords, mUiccApplication, mIccPhoneBookIntManager
newUiccApplication = getUiccCardApplication();
if (!isPhoneTypeGsm() && newUiccApplication == null) {
logd("can't find 3GPP2 application; trying APP_FAM_3GPP");
newUiccApplication = mUiccController.getUiccCardApplication(mPhoneId, UiccController.APP_FAM_3GPP);
}
UiccCardApplication app = mUiccApplication.get();
if (app != newUiccApplication) {
if (app != null) {
if (DBG)
logd("Removing stale icc objects.");
if (mIccRecords.get() != null) {
unregisterForIccRecordEvents();
mIccPhoneBookIntManager.updateIccRecords(null);
}
mIccRecords.set(null);
mUiccApplication.set(null);
}
if (newUiccApplication != null) {
if (DBG) {
logd("New Uicc application found. type = " + newUiccApplication.getType());
}
final IccRecords iccRecords = newUiccApplication.getIccRecords();
mUiccApplication.set(newUiccApplication);
mIccRecords.set(iccRecords);
registerForIccRecordEvents();
mIccPhoneBookIntManager.updateIccRecords(iccRecords);
if (iccRecords != null) {
final String simOperatorNumeric = iccRecords.getOperatorNumeric();
if (DBG) {
logd("New simOperatorNumeric = " + simOperatorNumeric);
}
if (!TextUtils.isEmpty(simOperatorNumeric)) {
TelephonyManager.from(mContext).setSimOperatorNumericForPhone(mPhoneId, simOperatorNumeric);
}
}
updateCurrentCarrierInProvider();
}
}
reapplyUiccAppsEnablementIfNeeded(ENABLE_UICC_APPS_MAX_RETRIES);
}
use of com.android.internal.telephony.uicc.SIMRecords in project android_frameworks_opt_telephony by LineageOS.
the class CarrierDisplayNameResolverTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp("CDNRTest");
mCdnr = new CarrierDisplayNameResolver(mPhone);
UiccCardApplication uiccApp = Mockito.mock(UiccCardApplication.class);
doReturn(uiccApp).when(mPhone).getUiccCardApplication();
doReturn(AppState.APPSTATE_READY).when(uiccApp).getState();
doReturn(mSS).when(mSST).getServiceState();
doReturn(false).when(mPhone).isWifiCallingEnabled();
doReturn(true).when(mPhone).isPhoneTypeGsm();
mConfig = mContextFixture.getCarrierConfigBundle();
CarrierConfigManager mockConfigManager = Mockito.mock(CarrierConfigManager.class);
doReturn(mockConfigManager).when(mContext).getSystemService(Context.CARRIER_CONFIG_SERVICE);
doReturn(mConfig).when(mockConfigManager).getConfigForSubId(anyInt());
mSS.setEmergencyOnly(false);
mSS.setOperatorName("long name", "short name", HOME_PLMN_NUMERIC);
mSS.setVoiceRegState(ServiceState.STATE_IN_SERVICE);
mSS.setDataRegState(ServiceState.STATE_IN_SERVICE);
SIMRecords usim = Mockito.mock(SIMRecords.class);
doReturn(SPN_FROM_USIM).when(usim).getServiceProviderName();
doReturn(PNN_HOME_NAME_FROM_USIM).when(usim).getPnnHomeName();
doReturn(EHPLMNS_FROM_USIM).when(usim).getEhplmns();
doReturn(SPDI_FROM_USIM).when(usim).getServiceProviderDisplayInformation();
doReturn(SPN_DISPLAY_CONDITION_FROM_USIM).when(usim).getCarrierNameDisplayCondition();
mCdnr.updateEfFromUsim(usim);
}
use of com.android.internal.telephony.uicc.SIMRecords in project android_frameworks_opt_telephony by LineageOS.
the class ServiceStateTracker method onUpdateIccAvailability.
protected void onUpdateIccAvailability() {
if (mUiccController == null) {
return;
}
UiccCardApplication newUiccApplication = getUiccCardApplication();
if (mUiccApplcation != newUiccApplication) {
// Remove the EF records that come from UICC
if (mIccRecords instanceof SIMRecords) {
mCdnr.updateEfFromUsim(null);
} else if (mIccRecords instanceof RuimRecords) {
mCdnr.updateEfFromRuim(null);
}
if (mUiccApplcation != null) {
log("Removing stale icc objects.");
mUiccApplcation.unregisterForReady(this);
if (mIccRecords != null) {
mIccRecords.unregisterForRecordsLoaded(this);
}
mIccRecords = null;
mUiccApplcation = null;
}
if (newUiccApplication != null) {
log("New card found");
mUiccApplcation = newUiccApplication;
mIccRecords = mUiccApplcation.getIccRecords();
if (mPhone.isPhoneTypeGsm()) {
mUiccApplcation.registerForReady(this, EVENT_SIM_READY, null);
if (mIccRecords != null) {
mIccRecords.registerForRecordsLoaded(this, EVENT_SIM_RECORDS_LOADED, null);
}
} else if (mIsSubscriptionFromRuim) {
mUiccApplcation.registerForReady(this, EVENT_RUIM_READY, null);
if (mIccRecords != null) {
mIccRecords.registerForRecordsLoaded(this, EVENT_RUIM_RECORDS_LOADED, null);
}
}
}
}
}
Aggregations