Search in sources :

Example 16 with ImsManager

use of com.android.ims.ImsManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class WifiCallingSliceHelper method handleWifiCallingChanged.

/**
 * Handles wifi calling setting change from wifi calling slice and posts notification. Should be
 * called when intent action is ACTION_WIFI_CALLING_CHANGED. Executed in @WorkerThread
 *
 * @param intent action performed
 */
public void handleWifiCallingChanged(Intent intent) {
    final int subId = getDefaultVoiceSubId();
    if (subId > SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
        final ImsManager imsManager = getImsManager(subId);
        if (imsManager.isWfcEnabledByPlatform() && imsManager.isWfcProvisionedOnDevice()) {
            final boolean currentValue = imsManager.isWfcEnabledByUser() && imsManager.isNonTtyOrTtyOnVolteEnabled();
            final boolean newValue = intent.getBooleanExtra(EXTRA_TOGGLE_STATE, currentValue);
            final Intent activationAppIntent = getWifiCallingCarrierActivityIntent(subId);
            if (!newValue || activationAppIntent == null) {
                // or there is no activation involved - Update the setting
                if (newValue != currentValue) {
                    imsManager.setWfcSetting(newValue);
                }
            }
        }
    }
    // notify change in slice in any case to get re-queried. This would result in displaying
    // appropriate message with the updated setting.
    mContext.getContentResolver().notifyChange(WIFI_CALLING_URI, null);
}
Also used : ImsManager(com.android.ims.ImsManager) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent)

Example 17 with ImsManager

use of com.android.ims.ImsManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class WifiCallingSliceHelper method createWifiCallingPreferenceSlice.

/**
 * Returns Slice object for wifi calling preference.
 *
 * If wifi calling is not turned on, this method will return a slice to turn on wifi calling.
 *
 * If wifi calling preference is not user editable, this method will return a slice to display
 * appropriate message.
 *
 * If wifi calling preference can be changed, this method will return a slice with 3 or 4 rows:
 * Header Row: current preference settings
 * Row 1: wifi only option with ACTION_WIFI_CALLING_PREFERENCE_WIFI_ONLY, if wifi only option
 * is editable
 * Row 2: wifi preferred option with ACTION_WIFI_CALLING_PREFERENCE_WIFI_PREFERRED
 * Row 3: cellular preferred option with ACTION_WIFI_CALLING_PREFERENCE_CELLULAR_PREFERRED
 */
public Slice createWifiCallingPreferenceSlice(Uri sliceUri) {
    final int subId = getDefaultVoiceSubId();
    if (subId <= SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
        Log.d(TAG, "Invalid Subscription Id");
        return null;
    }
    final boolean isWifiCallingPrefEditable = isCarrierConfigManagerKeyEnabled(CarrierConfigManager.KEY_EDITABLE_WFC_MODE_BOOL, subId, false);
    final boolean isWifiOnlySupported = isCarrierConfigManagerKeyEnabled(CarrierConfigManager.KEY_CARRIER_WFC_SUPPORTS_WIFI_ONLY_BOOL, subId, true);
    final ImsManager imsManager = getImsManager(subId);
    if (!imsManager.isWfcEnabledByPlatform() || !imsManager.isWfcProvisionedOnDevice()) {
        Log.d(TAG, "Wifi calling is either not provisioned or not enabled by platform");
        return null;
    }
    if (!isWifiCallingPrefEditable) {
        Log.d(TAG, "Wifi calling preference is not editable");
        return null;
    }
    boolean isWifiCallingEnabled = false;
    int wfcMode = -1;
    try {
        isWifiCallingEnabled = isWifiCallingEnabled(imsManager);
        wfcMode = getWfcMode(imsManager);
    } catch (InterruptedException | ExecutionException | TimeoutException e) {
        Log.e(TAG, "Unable to get wifi calling preferred mode", e);
        return null;
    }
    if (!isWifiCallingEnabled) {
        // wifi calling is not enabled. Ask user to enable wifi calling
        return getNonActionableWifiCallingSlice(mContext.getText(R.string.wifi_calling_mode_title), mContext.getText(R.string.wifi_calling_turn_on), sliceUri, getActivityIntent(ACTION_WIFI_CALLING_SETTINGS_ACTIVITY));
    }
    // Return the slice to change wifi calling preference
    return getWifiCallingPreferenceSlice(isWifiOnlySupported, wfcMode, sliceUri);
}
Also used : ImsManager(com.android.ims.ImsManager) ExecutionException(java.util.concurrent.ExecutionException) TimeoutException(java.util.concurrent.TimeoutException)

Example 18 with ImsManager

use of com.android.ims.ImsManager in project android_frameworks_opt_telephony by LineageOS.

the class ImsPhone method updateRoamingState.

/**
 * Update roaming state and WFC mode in the following situations:
 *     1) voice is in service.
 *     2) data is in service and it is not IWLAN (if in legacy mode).
 * @param ss non-null ServiceState
 */
private void updateRoamingState(ServiceState ss) {
    if (ss == null) {
        loge("updateRoamingState: null ServiceState!");
        return;
    }
    boolean newRoamingState = ss.getRoaming();
    // Do not recalculate if there is no change to state.
    if (mRoaming == newRoamingState) {
        return;
    }
    boolean isInService = (ss.getState() == ServiceState.STATE_IN_SERVICE || ss.getDataRegistrationState() == ServiceState.STATE_IN_SERVICE);
    // move to home in this case.
    if (!isInService) {
        logi("updateRoamingState: we are OUT_OF_SERVICE, ignoring roaming change.");
        return;
    }
    // IWLAN->cell->IWLAN->cell...
    if (isCsNotInServiceAndPsWwanReportingWlan(ss)) {
        logi("updateRoamingState: IWLAN masking roaming, ignore roaming change.");
        return;
    }
    if (mCT.getState() == PhoneConstants.State.IDLE) {
        if (DBG)
            logd("updateRoamingState now: " + newRoamingState);
        mRoaming = newRoamingState;
        CarrierConfigManager configManager = (CarrierConfigManager) getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE);
        // when receives ACTION_CARRIER_CONFIG_CHANGED broadcast.
        if (configManager != null && CarrierConfigManager.isConfigForIdentifiedCarrier(configManager.getConfigForSubId(getSubId()))) {
            ImsManager imsManager = ImsManager.getInstance(mContext, mPhoneId);
            imsManager.setWfcMode(imsManager.getWfcMode(newRoamingState), newRoamingState);
        }
    } else {
        if (DBG)
            logd("updateRoamingState postponed: " + newRoamingState);
        mCT.registerForVoiceCallEnded(this, EVENT_VOICE_CALL_ENDED, null);
    }
}
Also used : CarrierConfigManager(android.telephony.CarrierConfigManager) ImsManager(com.android.ims.ImsManager)

Example 19 with ImsManager

use of com.android.ims.ImsManager in project android_frameworks_opt_telephony by LineageOS.

the class GsmCdmaPhone method handleMessage.

@Override
public void handleMessage(Message msg) {
    AsyncResult ar;
    Message onComplete;
    switch(msg.what) {
        case EVENT_RADIO_AVAILABLE:
            {
                handleRadioAvailable();
            }
            break;
        case EVENT_GET_DEVICE_IDENTITY_DONE:
            {
                ar = (AsyncResult) msg.obj;
                if (ar.exception != null) {
                    break;
                }
                String[] respId = (String[]) ar.result;
                mImei = respId[0];
                mImeiSv = respId[1];
                mEsn = respId[2];
                mMeid = respId[3];
            }
            break;
        case EVENT_EMERGENCY_CALLBACK_MODE_ENTER:
            {
                handleEnterEmergencyCallbackMode(msg);
            }
            break;
        case EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE:
            {
                handleExitEmergencyCallbackMode(msg);
            }
            break;
        case EVENT_MODEM_RESET:
            {
                logd("Event EVENT_MODEM_RESET Received" + " isInEcm = " + isInEcm() + " isPhoneTypeGsm = " + isPhoneTypeGsm() + " mImsPhone = " + mImsPhone);
                if (isInEcm()) {
                    if (isPhoneTypeGsm()) {
                        if (mImsPhone != null) {
                            mImsPhone.handleExitEmergencyCallbackMode();
                        }
                    } else {
                        handleExitEmergencyCallbackMode(msg);
                    }
                }
            }
            break;
        case EVENT_RUIM_RECORDS_LOADED:
            logd("Event EVENT_RUIM_RECORDS_LOADED Received");
            updateCurrentCarrierInProvider();
            break;
        case EVENT_RADIO_ON:
            logd("Event EVENT_RADIO_ON Received");
            handleRadioOn();
            break;
        case EVENT_RIL_CONNECTED:
            ar = (AsyncResult) msg.obj;
            if (ar.exception == null && ar.result != null) {
                mRilVersion = (Integer) ar.result;
            } else {
                logd("Unexpected exception on EVENT_RIL_CONNECTED");
                mRilVersion = -1;
            }
            break;
        case EVENT_VOICE_RADIO_TECH_CHANGED:
        case EVENT_REQUEST_VOICE_RADIO_TECH_DONE:
            String what = (msg.what == EVENT_VOICE_RADIO_TECH_CHANGED) ? "EVENT_VOICE_RADIO_TECH_CHANGED" : "EVENT_REQUEST_VOICE_RADIO_TECH_DONE";
            ar = (AsyncResult) msg.obj;
            if (ar.exception == null) {
                if ((ar.result != null) && (((int[]) ar.result).length != 0)) {
                    int newVoiceTech = ((int[]) ar.result)[0];
                    logd(what + ": newVoiceTech=" + newVoiceTech);
                    phoneObjectUpdater(newVoiceTech);
                } else {
                    loge(what + ": has no tech!");
                }
            } else {
                loge(what + ": exception=" + ar.exception);
            }
            break;
        case EVENT_UPDATE_PHONE_OBJECT:
            phoneObjectUpdater(msg.arg1);
            break;
        case EVENT_CARRIER_CONFIG_CHANGED:
            // Obtain new radio capabilities from the modem, since some are SIM-dependent
            mCi.getRadioCapability(obtainMessage(EVENT_GET_RADIO_CAPABILITY));
            // registration changes.
            if (!mContext.getResources().getBoolean(com.android.internal.R.bool.config_switch_phone_on_voice_reg_state_change)) {
                mCi.getVoiceRadioTechnology(obtainMessage(EVENT_REQUEST_VOICE_RADIO_TECH_DONE));
            }
            // Force update IMS service if it is available, if it isn't the config will be
            // updated when ImsPhoneCallTracker opens a connection.
            ImsManager imsManager = ImsManager.getInstance(mContext, mPhoneId);
            if (imsManager.isServiceAvailable()) {
                imsManager.updateImsServiceConfig(true);
            } else {
                logd("ImsManager is not available to update CarrierConfig.");
            }
            // Update broadcastEmergencyCallStateChanges
            CarrierConfigManager configMgr = (CarrierConfigManager) getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE);
            PersistableBundle b = configMgr.getConfigForSubId(getSubId());
            if (b != null) {
                boolean broadcastEmergencyCallStateChanges = b.getBoolean(CarrierConfigManager.KEY_BROADCAST_EMERGENCY_CALL_STATE_CHANGES_BOOL);
                logd("broadcastEmergencyCallStateChanges = " + broadcastEmergencyCallStateChanges);
                setBroadcastEmergencyCallStateChanges(broadcastEmergencyCallStateChanges);
            } else {
                loge("didn't get broadcastEmergencyCallStateChanges from carrier config");
            }
            // Changing the cdma roaming settings based carrier config.
            if (b != null) {
                int config_cdma_roaming_mode = b.getInt(CarrierConfigManager.KEY_CDMA_ROAMING_MODE_INT);
                int current_cdma_roaming_mode = Settings.Global.getInt(getContext().getContentResolver(), Settings.Global.CDMA_ROAMING_MODE, TelephonyManager.CDMA_ROAMING_MODE_RADIO_DEFAULT);
                switch(config_cdma_roaming_mode) {
                    // when carrier's setting is turn off.
                    case TelephonyManager.CDMA_ROAMING_MODE_HOME:
                    case TelephonyManager.CDMA_ROAMING_MODE_AFFILIATED:
                    case TelephonyManager.CDMA_ROAMING_MODE_ANY:
                        logd("cdma_roaming_mode is going to changed to " + config_cdma_roaming_mode);
                        setCdmaRoamingPreference(config_cdma_roaming_mode, obtainMessage(EVENT_SET_ROAMING_PREFERENCE_DONE));
                        break;
                    // previous user's setting
                    case TelephonyManager.CDMA_ROAMING_MODE_RADIO_DEFAULT:
                        if (current_cdma_roaming_mode != config_cdma_roaming_mode) {
                            logd("cdma_roaming_mode is going to changed to " + current_cdma_roaming_mode);
                            setCdmaRoamingPreference(current_cdma_roaming_mode, obtainMessage(EVENT_SET_ROAMING_PREFERENCE_DONE));
                        }
                    default:
                        loge("Invalid cdma_roaming_mode settings: " + config_cdma_roaming_mode);
                }
            } else {
                loge("didn't get the cdma_roaming_mode changes from the carrier config.");
            }
            break;
        case EVENT_SET_ROAMING_PREFERENCE_DONE:
            logd("cdma_roaming_mode change is done");
            break;
        case EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED:
            logd("EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED");
            mCdmaSubscriptionSource = mCdmaSSM.getCdmaSubscriptionSource();
            break;
        case EVENT_REGISTERED_TO_NETWORK:
            logd("Event EVENT_REGISTERED_TO_NETWORK Received");
            if (isPhoneTypeGsm()) {
                syncClirSetting();
            }
            break;
        case EVENT_SIM_RECORDS_LOADED:
            updateCurrentCarrierInProvider();
            // Check if this is a different SIM than the previous one. If so unset the
            // voice mail number.
            String imsi = getVmSimImsi();
            String imsiFromSIM = getSubscriberId();
            if ((!isPhoneTypeGsm() || imsi != null) && imsiFromSIM != null && !imsiFromSIM.equals(imsi)) {
                storeVoiceMailNumber(null);
                setVmSimImsi(null);
            }
            updateVoiceMail();
            mSimRecordsLoadedRegistrants.notifyRegistrants();
            break;
        case EVENT_GET_BASEBAND_VERSION_DONE:
            ar = (AsyncResult) msg.obj;
            if (ar.exception != null) {
                break;
            }
            if (DBG)
                logd("Baseband version: " + ar.result);
            /* Android property value is limited to 91 characters, but low layer
                 could pass a larger version string. To avoid runtime exception,
                 truncate the string baseband version string to 45 characters at most
                 for this per sub property. Since the latter part of the version string
                 is meaningful, truncated the version string from the beginning and
                 keep the end of the version.
                */
            String version = (String) ar.result;
            if (version != null) {
                int length = version.length();
                final int MAX_VERSION_LEN = SystemProperties.PROP_VALUE_MAX / 2;
                TelephonyManager.from(mContext).setBasebandVersionForPhone(getPhoneId(), length <= MAX_VERSION_LEN ? version : version.substring(length - MAX_VERSION_LEN, length));
            }
            break;
        case EVENT_GET_IMEI_DONE:
            ar = (AsyncResult) msg.obj;
            if (ar.exception != null) {
                break;
            }
            mImei = (String) ar.result;
            break;
        case EVENT_GET_IMEISV_DONE:
            ar = (AsyncResult) msg.obj;
            if (ar.exception != null) {
                break;
            }
            mImeiSv = (String) ar.result;
            break;
        case EVENT_USSD:
            ar = (AsyncResult) msg.obj;
            String[] ussdResult = (String[]) ar.result;
            if (ussdResult.length > 1) {
                try {
                    onIncomingUSSD(Integer.parseInt(ussdResult[0]), ussdResult[1]);
                } catch (NumberFormatException e) {
                    Rlog.w(LOG_TAG, "error parsing USSD");
                }
            }
            break;
        case EVENT_RADIO_OFF_OR_NOT_AVAILABLE:
            {
                logd("Event EVENT_RADIO_OFF_OR_NOT_AVAILABLE Received");
                handleRadioOffOrNotAvailable();
                break;
            }
        case EVENT_RADIO_STATE_CHANGED:
            {
                logd("EVENT EVENT_RADIO_STATE_CHANGED");
                handleRadioPowerStateChange();
                break;
            }
        case EVENT_SSN:
            logd("Event EVENT_SSN Received");
            if (isPhoneTypeGsm()) {
                ar = (AsyncResult) msg.obj;
                SuppServiceNotification not = (SuppServiceNotification) ar.result;
                mSsnRegistrants.notifyRegistrants(ar);
            }
            break;
        case EVENT_REGISTRATION_FAILED:
            logd("Event RegistrationFailed Received");
            ar = (AsyncResult) msg.obj;
            RegistrationFailedEvent rfe = (RegistrationFailedEvent) ar.result;
            mNotifier.notifyRegistrationFailed(this, rfe.cellIdentity, rfe.chosenPlmn, rfe.domain, rfe.causeCode, rfe.additionalCauseCode);
            break;
        case EVENT_BARRING_INFO_CHANGED:
            logd("Event BarringInfoChanged Received");
            ar = (AsyncResult) msg.obj;
            BarringInfo barringInfo = (BarringInfo) ar.result;
            mNotifier.notifyBarringInfoChanged(this, barringInfo);
            break;
        case EVENT_SET_CALL_FORWARD_DONE:
            ar = (AsyncResult) msg.obj;
            Cfu cfu = (Cfu) ar.userObj;
            if (ar.exception == null) {
                setVoiceCallForwardingFlag(1, msg.arg1 == 1, cfu.mSetCfNumber);
            }
            if (cfu.mOnComplete != null) {
                AsyncResult.forMessage(cfu.mOnComplete, ar.result, ar.exception);
                cfu.mOnComplete.sendToTarget();
            }
            break;
        case EVENT_SET_VM_NUMBER_DONE:
            ar = (AsyncResult) msg.obj;
            if (((isPhoneTypeGsm() || mSimRecords != null) && IccVmNotSupportedException.class.isInstance(ar.exception)) || (!isPhoneTypeGsm() && mSimRecords == null && IccException.class.isInstance(ar.exception))) {
                storeVoiceMailNumber(mVmNumber);
                ar.exception = null;
            }
            onComplete = (Message) ar.userObj;
            if (onComplete != null) {
                AsyncResult.forMessage(onComplete, ar.result, ar.exception);
                onComplete.sendToTarget();
            }
            break;
        case EVENT_GET_CALL_FORWARD_DONE:
            ar = (AsyncResult) msg.obj;
            if (ar.exception == null) {
                handleCfuQueryResult((CallForwardInfo[]) ar.result);
            }
            onComplete = (Message) ar.userObj;
            if (onComplete != null) {
                AsyncResult.forMessage(onComplete, ar.result, ar.exception);
                onComplete.sendToTarget();
            }
            break;
        case EVENT_SET_NETWORK_AUTOMATIC:
            // Automatic network selection from EF_CSP SIM record
            ar = (AsyncResult) msg.obj;
            if (mSST.mSS.getIsManualSelection()) {
                setNetworkSelectionModeAutomatic((Message) ar.result);
                logd("SET_NETWORK_SELECTION_AUTOMATIC: set to automatic");
            } else {
                // prevent duplicate request which will push current PLMN to low priority
                logd("SET_NETWORK_SELECTION_AUTOMATIC: already automatic, ignore");
            }
            break;
        case EVENT_ICC_RECORD_EVENTS:
            ar = (AsyncResult) msg.obj;
            processIccRecordEvents((Integer) ar.result);
            break;
        case EVENT_SET_CLIR_COMPLETE:
            ar = (AsyncResult) msg.obj;
            if (ar.exception == null) {
                saveClirSetting(msg.arg1);
            }
            onComplete = (Message) ar.userObj;
            if (onComplete != null) {
                AsyncResult.forMessage(onComplete, ar.result, ar.exception);
                onComplete.sendToTarget();
            }
            break;
        case EVENT_SS:
            ar = (AsyncResult) msg.obj;
            logd("Event EVENT_SS received");
            if (isPhoneTypeGsm()) {
                // SS data is already being handled through MMI codes.
                // So, this result if processed as MMI response would help
                // in re-using the existing functionality.
                GsmMmiCode mmi = new GsmMmiCode(this, mUiccApplication.get());
                mmi.processSsData(ar);
            }
            break;
        case EVENT_GET_RADIO_CAPABILITY:
            ar = (AsyncResult) msg.obj;
            RadioCapability rc = (RadioCapability) ar.result;
            if (ar.exception != null) {
                Rlog.d(LOG_TAG, "get phone radio capability fail, no need to change " + "mRadioCapability");
            } else {
                radioCapabilityUpdated(rc);
            }
            Rlog.d(LOG_TAG, "EVENT_GET_RADIO_CAPABILITY: phone rc: " + rc);
            break;
        case EVENT_VRS_OR_RAT_CHANGED:
            ar = (AsyncResult) msg.obj;
            Pair<Integer, Integer> vrsRatPair = (Pair<Integer, Integer>) ar.result;
            onVoiceRegStateOrRatChanged(vrsRatPair.first, vrsRatPair.second);
            break;
        case EVENT_SET_CARRIER_DATA_ENABLED:
            ar = (AsyncResult) msg.obj;
            boolean enabled = (boolean) ar.result;
            mDataEnabledSettings.setCarrierDataEnabled(enabled);
            break;
        case EVENT_DEVICE_PROVISIONED_CHANGE:
            mDataEnabledSettings.updateProvisionedChanged();
            break;
        case EVENT_DEVICE_PROVISIONING_DATA_SETTING_CHANGE:
            mDataEnabledSettings.updateProvisioningDataEnabled();
            break;
        case EVENT_GET_AVAILABLE_NETWORKS_DONE:
            ar = (AsyncResult) msg.obj;
            if (ar.exception == null && ar.result != null && mSST != null) {
                List<OperatorInfo> operatorInfoList = (List<OperatorInfo>) ar.result;
                List<OperatorInfo> filteredInfoList = new ArrayList<>();
                for (OperatorInfo operatorInfo : operatorInfoList) {
                    if (OperatorInfo.State.CURRENT == operatorInfo.getState()) {
                        filteredInfoList.add(new OperatorInfo(mSST.filterOperatorNameByPattern(operatorInfo.getOperatorAlphaLong()), mSST.filterOperatorNameByPattern(operatorInfo.getOperatorAlphaShort()), operatorInfo.getOperatorNumeric(), operatorInfo.getState()));
                    } else {
                        filteredInfoList.add(operatorInfo);
                    }
                }
                ar.result = filteredInfoList;
            }
            onComplete = (Message) ar.userObj;
            if (onComplete != null) {
                AsyncResult.forMessage(onComplete, ar.result, ar.exception);
                onComplete.sendToTarget();
            }
            break;
        case EVENT_GET_UICC_APPS_ENABLEMENT_DONE:
        case EVENT_UICC_APPS_ENABLEMENT_STATUS_CHANGED:
            ar = (AsyncResult) msg.obj;
            if (ar == null)
                return;
            if (ar.exception != null) {
                logd("Received exception on event" + msg.what + " : " + ar.exception);
                return;
            }
            mUiccApplicationsEnabled = (Boolean) ar.result;
        // Intentional falling through.
        case EVENT_UICC_APPS_ENABLEMENT_SETTING_CHANGED:
            reapplyUiccAppsEnablementIfNeeded(ENABLE_UICC_APPS_MAX_RETRIES);
            break;
        case EVENT_REAPPLY_UICC_APPS_ENABLEMENT_DONE:
            {
                ar = (AsyncResult) msg.obj;
                if (ar == null || ar.exception == null)
                    return;
                Pair<Boolean, Integer> userObject = (Pair) ar.userObj;
                if (userObject == null)
                    return;
                boolean expectedValue = userObject.first;
                int retries = userObject.second;
                CommandException.Error error = ((CommandException) ar.exception).getCommandError();
                loge("Error received when re-applying uicc application" + " setting to " + expectedValue + " on phone " + mPhoneId + " Error code: " + error + " retry count left: " + retries);
                if (retries > 0 && (error == GENERIC_FAILURE || error == SIM_BUSY)) {
                    // Retry for certain errors, but not for others like RADIO_NOT_AVAILABLE or
                    // SIM_ABSENT, as they will trigger it whey they become available.
                    postDelayed(() -> reapplyUiccAppsEnablementIfNeeded(retries - 1), REAPPLY_UICC_APPS_SETTING_RETRY_TIME_GAP_IN_MS);
                }
                break;
            }
        default:
            super.handleMessage(msg);
    }
}
Also used : ImsManager(com.android.ims.ImsManager) Message(android.os.Message) ArrayList(java.util.ArrayList) SuppServiceNotification(com.android.internal.telephony.gsm.SuppServiceNotification) BarringInfo(android.telephony.BarringInfo) GsmMmiCode(com.android.internal.telephony.gsm.GsmMmiCode) IccVmNotSupportedException(com.android.internal.telephony.uicc.IccVmNotSupportedException) RegistrantList(android.os.RegistrantList) ArrayList(java.util.ArrayList) List(java.util.List) Pair(android.util.Pair) CarrierConfigManager(android.telephony.CarrierConfigManager) IccException(com.android.internal.telephony.uicc.IccException) PersistableBundle(android.os.PersistableBundle) AsyncResult(android.os.AsyncResult)

Example 20 with ImsManager

use of com.android.ims.ImsManager in project android_frameworks_opt_telephony by LineageOS.

the class ImsManagerTest method testGetDefaultValues.

@Test
@SmallTest
public void testGetDefaultValues() {
    ImsManager imsManager = getImsManagerAndInitProvisionedValues();
    assertEquals(WFC_IMS_ENABLE_DEFAULT_VAL, imsManager.isWfcEnabledByUser());
    verify(mSubscriptionController, times(1)).getSubscriptionProperty(anyInt(), eq(SubscriptionManager.WFC_IMS_ENABLED), anyString(), nullable(String.class));
    assertEquals(WFC_IMS_ROAMING_ENABLE_DEFAULT_VAL, imsManager.isWfcRoamingEnabledByUser());
    verify(mSubscriptionController, times(1)).getSubscriptionProperty(anyInt(), eq(SubscriptionManager.WFC_IMS_ROAMING_ENABLED), anyString(), nullable(String.class));
    assertEquals(ENHANCED_4G_MODE_DEFAULT_VAL, imsManager.isEnhanced4gLteModeSettingEnabledByUser());
    verify(mSubscriptionController, times(1)).getSubscriptionProperty(anyInt(), eq(SubscriptionManager.ENHANCED_4G_MODE_ENABLED), anyString(), nullable(String.class));
    assertEquals(WFC_IMS_MODE_DEFAULT_VAL, imsManager.getWfcMode(false));
    verify(mSubscriptionController, times(1)).getSubscriptionProperty(anyInt(), eq(SubscriptionManager.WFC_IMS_MODE), anyString(), nullable(String.class));
    assertEquals(WFC_IMS_ROAMING_MODE_DEFAULT_VAL, imsManager.getWfcMode(true));
    verify(mSubscriptionController, times(1)).getSubscriptionProperty(anyInt(), eq(SubscriptionManager.WFC_IMS_ROAMING_MODE), anyString(), nullable(String.class));
    assertEquals(VT_IMS_ENABLE_DEFAULT_VAL, imsManager.isVtEnabledByUser());
    verify(mSubscriptionController, times(1)).getSubscriptionProperty(anyInt(), eq(SubscriptionManager.VT_IMS_ENABLED), anyString(), nullable(String.class));
}
Also used : ImsManager(com.android.ims.ImsManager) Mockito.anyString(org.mockito.Mockito.anyString) TelephonyTest(com.android.internal.telephony.TelephonyTest) SmallTest(androidx.test.filters.SmallTest) Test(org.junit.Test) SmallTest(androidx.test.filters.SmallTest)

Aggregations

ImsManager (com.android.ims.ImsManager)31 SmallTest (androidx.test.filters.SmallTest)18 TelephonyTest (com.android.internal.telephony.TelephonyTest)18 Test (org.junit.Test)18 Mockito.anyString (org.mockito.Mockito.anyString)11 Intent (android.content.Intent)3 ExecutionException (java.util.concurrent.ExecutionException)3 TimeoutException (java.util.concurrent.TimeoutException)3 PendingIntent (android.app.PendingIntent)2 CarrierConfigManager (android.telephony.CarrierConfigManager)2 AsyncResult (android.os.AsyncResult)1 Message (android.os.Message)1 PersistableBundle (android.os.PersistableBundle)1 RegistrantList (android.os.RegistrantList)1 PhoneAccountHandle (android.telecom.PhoneAccountHandle)1 BarringInfo (android.telephony.BarringInfo)1 ImsConfigImplBase (android.telephony.ims.stub.ImsConfigImplBase)1 Pair (android.util.Pair)1 GsmMmiCode (com.android.internal.telephony.gsm.GsmMmiCode)1 SuppServiceNotification (com.android.internal.telephony.gsm.SuppServiceNotification)1