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);
}
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;
}
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()]);
}
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);
}
}
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);
}
Aggregations