use of android.telephony.RadioAccessSpecifier in project android_frameworks_opt_telephony by LineageOS.
the class RILTest method getNetworkScanRequestForTesting.
private NetworkScanRequest getNetworkScanRequestForTesting() {
// Construct a NetworkScanRequest for testing
List<CellInfo> allCellInfo = mTelephonyManager.getAllCellInfo();
List<RadioAccessSpecifier> radioAccessSpecifier = new ArrayList<>();
for (int i = 0; i < allCellInfo.size(); i++) {
RadioAccessSpecifier ras = getRadioAccessSpecifier(allCellInfo.get(i));
if (ras != null) {
radioAccessSpecifier.add(ras);
}
}
if (radioAccessSpecifier.size() == 0) {
RadioAccessSpecifier gsm = new RadioAccessSpecifier(AccessNetworkConstants.AccessNetworkType.GERAN, null, /* bands */
null);
radioAccessSpecifier.add(gsm);
}
RadioAccessSpecifier[] radioAccessSpecifierArray = new RadioAccessSpecifier[radioAccessSpecifier.size()];
return new NetworkScanRequest(NetworkScanRequest.SCAN_TYPE_ONE_SHOT, /* scan type */
radioAccessSpecifier.toArray(radioAccessSpecifierArray), 5, /* search periodicity */
60, /* max search time */
true, /*enable incremental results*/
5, /* incremental results periodicity */
null);
}
use of android.telephony.RadioAccessSpecifier in project android_packages_apps_Settings by omnirom.
the class NetworkScanHelperTest method createNetworkScanForPreferredAccessNetworks_deviceHasNrSa_hasNgran.
@Test
public void createNetworkScanForPreferredAccessNetworks_deviceHasNrSa_hasNgran() {
int[] deviceNrCapabilities = new int[] { PhoneCapability.DEVICE_NR_CAPABILITY_NSA, PhoneCapability.DEVICE_NR_CAPABILITY_SA };
PhoneCapability phoneCapability = createPhoneCapability(deviceNrCapabilities);
doReturn(TelephonyManager.NETWORK_CLASS_BITMASK_2G | TelephonyManager.NETWORK_CLASS_BITMASK_3G | TelephonyManager.NETWORK_CLASS_BITMASK_4G | TelephonyManager.NETWORK_CLASS_BITMASK_5G).when(mTelephonyManager).getPreferredNetworkTypeBitmask();
doReturn(phoneCapability).when(mTelephonyManager).getPhoneCapability();
List<RadioAccessSpecifier> radioAccessSpecifiers = new ArrayList<>();
radioAccessSpecifiers.add(new RadioAccessSpecifier(AccessNetworkConstants.AccessNetworkType.GERAN, null, null));
radioAccessSpecifiers.add(new RadioAccessSpecifier(AccessNetworkConstants.AccessNetworkType.UTRAN, null, null));
radioAccessSpecifiers.add(new RadioAccessSpecifier(AccessNetworkConstants.AccessNetworkType.EUTRAN, null, null));
radioAccessSpecifiers.add(new RadioAccessSpecifier(AccessNetworkConstants.AccessNetworkType.NGRAN, null, null));
NetworkScanRequest expectedNetworkScanRequest = createNetworkScanRequest(radioAccessSpecifiers);
assertEquals(expectedNetworkScanRequest, mNetworkScanHelper.createNetworkScanForPreferredAccessNetworks());
}
use of android.telephony.RadioAccessSpecifier in project android_packages_apps_Settings by omnirom.
the class NetworkScanHelper method createNetworkScanForPreferredAccessNetworks.
@VisibleForTesting
NetworkScanRequest createNetworkScanForPreferredAccessNetworks() {
long networkTypeBitmap3gpp = mTelephonyManager.getPreferredNetworkTypeBitmask() & TelephonyManager.NETWORK_STANDARDS_FAMILY_BITMASK_3GPP;
List<RadioAccessSpecifier> radioAccessSpecifiers = new ArrayList<>();
// that they can't connect to.
if (networkTypeBitmap3gpp == 0 || (networkTypeBitmap3gpp & TelephonyManager.NETWORK_CLASS_BITMASK_2G) != 0) {
radioAccessSpecifiers.add(new RadioAccessSpecifier(AccessNetworkType.GERAN, null, null));
}
if (networkTypeBitmap3gpp == 0 || (networkTypeBitmap3gpp & TelephonyManager.NETWORK_CLASS_BITMASK_3G) != 0) {
radioAccessSpecifiers.add(new RadioAccessSpecifier(AccessNetworkType.UTRAN, null, null));
}
if (networkTypeBitmap3gpp == 0 || (networkTypeBitmap3gpp & TelephonyManager.NETWORK_CLASS_BITMASK_4G) != 0) {
radioAccessSpecifiers.add(new RadioAccessSpecifier(AccessNetworkType.EUTRAN, null, null));
}
//
if (networkTypeBitmap3gpp == 0 || (hasNrSaCapability() && (networkTypeBitmap3gpp & TelephonyManager.NETWORK_CLASS_BITMASK_5G) != 0)) {
radioAccessSpecifiers.add(new RadioAccessSpecifier(AccessNetworkType.NGRAN, null, null));
Log.d(TAG, "radioAccessSpecifiers add NGRAN.");
}
return new NetworkScanRequest(NetworkScanRequest.SCAN_TYPE_ONE_SHOT, radioAccessSpecifiers.toArray(new RadioAccessSpecifier[radioAccessSpecifiers.size()]), SEARCH_PERIODICITY_SEC, MAX_SEARCH_TIME_SEC, INCREMENTAL_RESULTS, INCREMENTAL_RESULTS_PERIODICITY_SEC, null);
}
use of android.telephony.RadioAccessSpecifier in project android_packages_apps_Settings by omnirom.
the class NetworkScanHelperTest method createNetworkScanForPreferredAccessNetworks_deviceNoNrSa_noNgran.
@Test
public void createNetworkScanForPreferredAccessNetworks_deviceNoNrSa_noNgran() {
int[] deviceNrCapabilities = new int[] { PhoneCapability.DEVICE_NR_CAPABILITY_NSA };
PhoneCapability phoneCapability = createPhoneCapability(deviceNrCapabilities);
doReturn(TelephonyManager.NETWORK_CLASS_BITMASK_2G | TelephonyManager.NETWORK_CLASS_BITMASK_3G | TelephonyManager.NETWORK_CLASS_BITMASK_4G | TelephonyManager.NETWORK_CLASS_BITMASK_5G).when(mTelephonyManager).getPreferredNetworkTypeBitmask();
doReturn(phoneCapability).when(mTelephonyManager).getPhoneCapability();
List<RadioAccessSpecifier> radioAccessSpecifiers = new ArrayList<>();
radioAccessSpecifiers.add(new RadioAccessSpecifier(AccessNetworkConstants.AccessNetworkType.GERAN, null, null));
radioAccessSpecifiers.add(new RadioAccessSpecifier(AccessNetworkConstants.AccessNetworkType.UTRAN, null, null));
radioAccessSpecifiers.add(new RadioAccessSpecifier(AccessNetworkConstants.AccessNetworkType.EUTRAN, null, null));
NetworkScanRequest expectedNetworkScanRequest = createNetworkScanRequest(radioAccessSpecifiers);
assertEquals(expectedNetworkScanRequest, mNetworkScanHelper.createNetworkScanForPreferredAccessNetworks());
}
use of android.telephony.RadioAccessSpecifier in project android_frameworks_opt_telephony by LineageOS.
the class RILTest method getRadioAccessSpecifier.
private RadioAccessSpecifier getRadioAccessSpecifier(CellInfo cellInfo) {
RadioAccessSpecifier ras;
if (cellInfo instanceof CellInfoLte) {
int ranLte = AccessNetworkConstants.AccessNetworkType.EUTRAN;
int[] lteChannels = { ((CellInfoLte) cellInfo).getCellIdentity().getEarfcn() };
ras = new RadioAccessSpecifier(ranLte, null, /* bands */
lteChannels);
} else if (cellInfo instanceof CellInfoWcdma) {
int ranLte = AccessNetworkConstants.AccessNetworkType.UTRAN;
int[] wcdmaChannels = { ((CellInfoWcdma) cellInfo).getCellIdentity().getUarfcn() };
ras = new RadioAccessSpecifier(ranLte, null, /* bands */
wcdmaChannels);
} else if (cellInfo instanceof CellInfoGsm) {
int ranGsm = AccessNetworkConstants.AccessNetworkType.GERAN;
int[] gsmChannels = { ((CellInfoGsm) cellInfo).getCellIdentity().getArfcn() };
ras = new RadioAccessSpecifier(ranGsm, null, /* bands */
gsmChannels);
} else {
ras = null;
}
return ras;
}
Aggregations