use of android.telephony.PhoneCapability 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.PhoneCapability in project android_frameworks_opt_telephony by LineageOS.
the class RadioConfigResponse method getPhoneCapabilityResponse.
/**
* Response function for IRadioConfig.getPhoneCapability().
*/
public void getPhoneCapabilityResponse(RadioResponseInfo responseInfo, android.hardware.radio.config.V1_1.PhoneCapability phoneCapability) {
RILRequest rr = mRadioConfig.processResponse(responseInfo);
if (rr != null) {
PhoneCapability ret = convertHalPhoneCapability(phoneCapability);
if (responseInfo.error == RadioError.NONE) {
// send response
RadioResponse.sendMessageResponse(rr.mResult, ret);
Rlog.d(TAG, rr.serialString() + "< " + mRadioConfig.requestToString(rr.mRequest) + " " + ret.toString());
} else {
rr.onError(responseInfo.error, ret);
Rlog.e(TAG, rr.serialString() + "< " + mRadioConfig.requestToString(rr.mRequest) + " error " + responseInfo.error);
}
} else {
Rlog.e(TAG, "getPhoneCapabilityResponse: Error " + responseInfo.toString());
}
}
use of android.telephony.PhoneCapability in project android_frameworks_opt_telephony by LineageOS.
the class RadioConfigResponse method convertHalPhoneCapability.
private PhoneCapability convertHalPhoneCapability(android.hardware.radio.config.V1_1.PhoneCapability phoneCapability) {
// TODO b/121394331: clean up V1_1.PhoneCapability fields.
int maxActiveVoiceCalls = 0;
int maxActiveData = phoneCapability.maxActiveData;
int max5G = 0;
boolean validationBeforeSwitchSupported = phoneCapability.isInternetLingeringSupported;
List<ModemInfo> logicalModemList = new ArrayList();
for (android.hardware.radio.config.V1_1.ModemInfo modemInfo : phoneCapability.logicalModemList) {
logicalModemList.add(new ModemInfo(modemInfo.modemId));
}
return new PhoneCapability(maxActiveVoiceCalls, maxActiveData, max5G, logicalModemList, validationBeforeSwitchSupported);
}
use of android.telephony.PhoneCapability in project android_frameworks_opt_telephony by LineageOS.
the class PhoneCapabilityTest method parcelReadWrite.
@Test
@SmallTest
public void parcelReadWrite() throws Exception {
int maxActiveVoiceCalls = 1;
int maxActiveData = 2;
int max5G = 3;
ModemInfo modemInfo = new ModemInfo(1, 2, true, false);
List<ModemInfo> logicalModemList = new ArrayList<>();
logicalModemList.add(modemInfo);
PhoneCapability capability = new PhoneCapability(maxActiveVoiceCalls, maxActiveData, max5G, logicalModemList, false);
Parcel parcel = Parcel.obtain();
capability.writeToParcel(parcel, 0);
parcel.setDataPosition(0);
PhoneCapability toCompare = PhoneCapability.CREATOR.createFromParcel(parcel);
assertEquals(maxActiveVoiceCalls, toCompare.maxActiveVoiceCalls);
assertEquals(maxActiveData, toCompare.maxActiveData);
assertEquals(max5G, toCompare.max5G);
assertEquals(1, toCompare.logicalModemList.size());
assertEquals(modemInfo, toCompare.logicalModemList.get(0));
assertEquals(capability, toCompare);
}
use of android.telephony.PhoneCapability in project android_frameworks_opt_telephony by LineageOS.
the class TelephonyRegistryTest method testPhoneCapabilityChanged.
@Test
@SmallTest
public void testPhoneCapabilityChanged() {
doReturn(mMockSubInfo).when(mSubscriptionManager).getActiveSubscriptionInfo(anyInt());
doReturn(0).when(mMockSubInfo).getSimSlotIndex();
// mTelephonyRegistry.listen with notifyNow = true should trigger callback immediately.
PhoneCapability phoneCapability = new PhoneCapability(1, 2, 3, null, false);
mTelephonyRegistry.notifyPhoneCapabilityChanged(phoneCapability);
mTelephonyRegistry.listenWithFeature(mContext.getOpPackageName(), mContext.getAttributionTag(), mPhoneStateListener.callback, LISTEN_PHONE_CAPABILITY_CHANGE, true);
processAllMessages();
assertEquals(phoneCapability, mPhoneCapability);
// notifyPhoneCapabilityChanged with a new capability. Callback should be triggered.
phoneCapability = new PhoneCapability(3, 2, 2, null, false);
mTelephonyRegistry.notifyPhoneCapabilityChanged(phoneCapability);
processAllMessages();
assertEquals(phoneCapability, mPhoneCapability);
}
Aggregations