Search in sources :

Example 1 with DcTracker

use of com.android.internal.telephony.dataconnection.DcTracker in project android_frameworks_opt_telephony by LineageOS.

the class TelephonyComponentFactoryTest method testMakeDcTracker.

@Test
public void testMakeDcTracker() {
    TelephonyComponentFactory telephonyComponentFactory = TelephonyComponentFactory.getInstance();
    DcTracker dcTracker = telephonyComponentFactory.makeDcTracker(mPhone);
    // FIXME: Uncomment below once QtiDcTracker is available.
    // assertFalse(dcTracker instanceof DcTracker);
    assertTrue(dcTracker instanceof DcTracker);
}
Also used : DcTracker(com.android.internal.telephony.dataconnection.DcTracker) MediumTest(android.test.suitebuilder.annotation.MediumTest) Test(org.junit.Test)

Example 2 with DcTracker

use of com.android.internal.telephony.dataconnection.DcTracker in project android_frameworks_opt_telephony by LineageOS.

the class ServiceStateTracker method updateNrFrequencyRangeFromPhysicalChannelConfigs.

private boolean updateNrFrequencyRangeFromPhysicalChannelConfigs(List<PhysicalChannelConfig> physicalChannelConfigs, ServiceState ss) {
    int newFrequencyRange = ServiceState.FREQUENCY_RANGE_UNKNOWN;
    if (physicalChannelConfigs != null) {
        DcTracker dcTracker = mPhone.getDcTracker(AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
        for (PhysicalChannelConfig config : physicalChannelConfigs) {
            if (isNrPhysicalChannelConfig(config)) {
                // Update the frequency range of the NR parameters if there is an internet data
                // connection associate to this NR physical channel channel config.
                int[] contextIds = config.getContextIds();
                for (int cid : contextIds) {
                    DataConnection dc = dcTracker.getDataConnectionByContextId(cid);
                    if (dc != null && dc.getNetworkCapabilities().hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)) {
                        newFrequencyRange = ServiceState.getBetterNRFrequencyRange(newFrequencyRange, config.getFrequencyRange());
                        break;
                    }
                }
            }
        }
    }
    boolean hasChanged = newFrequencyRange != ss.getNrFrequencyRange();
    ss.setNrFrequencyRange(newFrequencyRange);
    return hasChanged;
}
Also used : DcTracker(com.android.internal.telephony.dataconnection.DcTracker) DataConnection(com.android.internal.telephony.dataconnection.DataConnection) PhysicalChannelConfig(android.telephony.PhysicalChannelConfig)

Example 3 with DcTracker

use of com.android.internal.telephony.dataconnection.DcTracker in project android_frameworks_opt_telephony by LineageOS.

the class Phone method getActiveApnTypes.

/**
 * Returns an array of string identifiers for the APN types serviced by the
 * currently active subscription.
 *
 * @return The string array of APN types. Return null if no active APN types.
 */
@UnsupportedAppUsage
@NonNull
public String[] getActiveApnTypes() {
    if (mTransportManager == null || mDcTrackers == null) {
        Rlog.e(LOG_TAG, "Invalid state for Transport/DcTrackers");
        return new String[0];
    }
    Set<String> activeApnTypes = new HashSet<String>();
    for (int transportType : mTransportManager.getAvailableTransports()) {
        DcTracker dct = getDcTracker(transportType);
        // TODO: should this ever happen?
        if (dct == null)
            continue;
        activeApnTypes.addAll(Arrays.asList(dct.getActiveApnTypes()));
    }
    return activeApnTypes.toArray(new String[activeApnTypes.size()]);
}
Also used : DcTracker(com.android.internal.telephony.dataconnection.DcTracker) HashSet(java.util.HashSet) NonNull(android.annotation.NonNull) UnsupportedAppUsage(android.compat.annotation.UnsupportedAppUsage)

Example 4 with DcTracker

use of com.android.internal.telephony.dataconnection.DcTracker in project android_frameworks_opt_telephony by LineageOS.

the class ServiceStateTracker method setPowerStateToDesired.

protected void setPowerStateToDesired() {
    if (DBG) {
        String tmpLog = "mDeviceShuttingDown=" + mDeviceShuttingDown + ", mDesiredPowerState=" + mDesiredPowerState + ", getRadioState=" + mCi.getRadioState() + ", mPowerOffDelayNeed=" + mPowerOffDelayNeed + ", mAlarmSwitch=" + mAlarmSwitch + ", mRadioDisabledByCarrier=" + mRadioDisabledByCarrier;
        log(tmpLog);
        mRadioPowerLog.log(tmpLog);
    }
    if (mPhone.isPhoneTypeGsm() && mAlarmSwitch) {
        if (DBG)
            log("mAlarmSwitch == true");
        Context context = mPhone.getContext();
        AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
        am.cancel(mRadioOffIntent);
        mAlarmSwitch = false;
    }
    // If we want it on and it's off, turn it on
    if (mDesiredPowerState && !mRadioDisabledByCarrier && mCi.getRadioState() == CommandsInterface.RadioState.RADIO_OFF) {
        mCi.setRadioPower(true, null);
    } else if ((!mDesiredPowerState || mRadioDisabledByCarrier) && mCi.getRadioState().isOn()) {
        // If it's on and available and we want it off gracefully
        if (mPhone.isPhoneTypeGsm() && mPowerOffDelayNeed) {
            if (mImsRegistrationOnOff && !mAlarmSwitch) {
                if (DBG)
                    log("mImsRegistrationOnOff == true");
                Context context = mPhone.getContext();
                AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
                Intent intent = new Intent(ACTION_RADIO_OFF);
                mRadioOffIntent = PendingIntent.getBroadcast(context, 0, intent, 0);
                mAlarmSwitch = true;
                if (DBG)
                    log("Alarm setting");
                am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 3000, mRadioOffIntent);
            } else {
                DcTracker dcTracker = mPhone.mDcTracker;
                powerOffRadioSafely(dcTracker);
            }
        } else {
            DcTracker dcTracker = mPhone.mDcTracker;
            powerOffRadioSafely(dcTracker);
        }
    } else if (mDeviceShuttingDown && mCi.getRadioState().isAvailable()) {
        mCi.requestShutdown(null);
    }
}
Also used : Context(android.content.Context) DcTracker(com.android.internal.telephony.dataconnection.DcTracker) AlarmManager(android.app.AlarmManager) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent)

Example 5 with DcTracker

use of com.android.internal.telephony.dataconnection.DcTracker in project android_frameworks_opt_telephony by LineageOS.

the class GsmCdmaPhone method getPreciseDataConnectionState.

@Override
public PreciseDataConnectionState getPreciseDataConnectionState(String apnType) {
    // If we are OOS, then all data connections are null.
    // FIXME: we need to figure out how to report the EIMS PDN connectivity here, which
    // should imply emergency attach - today emergency attach is unknown at the AP,
    // so, we take a guess.
    boolean isEmergencyData = isPhoneTypeGsm() && apnType.equals(PhoneConstants.APN_TYPE_EMERGENCY);
    if (mSST == null || ((mSST.getCurrentDataConnectionState() != ServiceState.STATE_IN_SERVICE) && !isEmergencyData)) {
        return new PreciseDataConnectionState(TelephonyManager.DATA_DISCONNECTED, TelephonyManager.NETWORK_TYPE_UNKNOWN, ApnSetting.getApnTypesBitmaskFromString(apnType), apnType, null, DataFailCause.NONE, null);
    }
    // must never be null
    final DcTracker dctForApn = getActiveDcTrackerForApn(apnType);
    int networkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
    // Always non-null
    ServiceState ss = getServiceState();
    if (ss != null) {
        networkType = ss.getDataNetworkType();
    }
    return dctForApn.getPreciseDataConnectionState(apnType, isDataSuspended(), networkType);
}
Also used : DcTracker(com.android.internal.telephony.dataconnection.DcTracker) ServiceState(android.telephony.ServiceState) PreciseDataConnectionState(android.telephony.PreciseDataConnectionState)

Aggregations

DcTracker (com.android.internal.telephony.dataconnection.DcTracker)5 NonNull (android.annotation.NonNull)1 AlarmManager (android.app.AlarmManager)1 PendingIntent (android.app.PendingIntent)1 UnsupportedAppUsage (android.compat.annotation.UnsupportedAppUsage)1 Context (android.content.Context)1 Intent (android.content.Intent)1 PhysicalChannelConfig (android.telephony.PhysicalChannelConfig)1 PreciseDataConnectionState (android.telephony.PreciseDataConnectionState)1 ServiceState (android.telephony.ServiceState)1 MediumTest (android.test.suitebuilder.annotation.MediumTest)1 DataConnection (com.android.internal.telephony.dataconnection.DataConnection)1 HashSet (java.util.HashSet)1 Test (org.junit.Test)1