use of android.telephony.Annotation.ApnType in project android_frameworks_opt_telephony by LineageOS.
the class DataConnection method getDisallowedApnTypes.
/**
* @return The disallowed APN types bitmask
*/
@ApnType
private int getDisallowedApnTypes() {
CarrierConfigManager configManager = (CarrierConfigManager) mPhone.getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE);
int apnTypesBitmask = 0;
if (configManager != null) {
PersistableBundle bundle = configManager.getConfigForSubId(mSubId);
if (bundle != null) {
String key = (mTransportType == AccessNetworkConstants.TRANSPORT_TYPE_WWAN) ? CarrierConfigManager.KEY_CARRIER_WWAN_DISALLOWED_APN_TYPES_STRING_ARRAY : CarrierConfigManager.KEY_CARRIER_WLAN_DISALLOWED_APN_TYPES_STRING_ARRAY;
if (bundle.getStringArray(key) != null) {
String disallowedApnTypesString = TextUtils.join(",", bundle.getStringArray(key));
if (!TextUtils.isEmpty(disallowedApnTypesString)) {
apnTypesBitmask = ApnSetting.getApnTypesBitmaskFromString(disallowedApnTypesString);
}
}
}
}
return apnTypesBitmask;
}
use of android.telephony.Annotation.ApnType in project android_frameworks_opt_telephony by LineageOS.
the class ApnContext method getApnTypeFromNetworkRequest.
@ApnType
static int getApnTypeFromNetworkRequest(NetworkRequest nr) {
NetworkCapabilities nc = nr.networkCapabilities;
// For now, ignore the bandwidth stuff
if (nc.getTransportTypes().length > 0 && nc.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) == false) {
return ApnSetting.TYPE_NONE;
}
// in the near term just do 1-1 matches.
// TODO - actually try to match the set of capabilities
int apnType = ApnSetting.TYPE_NONE;
boolean error = false;
if (nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)) {
apnType = ApnSetting.TYPE_DEFAULT;
}
if (nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_MMS)) {
if (apnType != ApnSetting.TYPE_NONE)
error = true;
apnType = ApnSetting.TYPE_MMS;
}
if (nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_SUPL)) {
if (apnType != ApnSetting.TYPE_NONE)
error = true;
apnType = ApnSetting.TYPE_SUPL;
}
if (nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_DUN)) {
if (apnType != ApnSetting.TYPE_NONE)
error = true;
apnType = ApnSetting.TYPE_DUN;
}
if (nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_FOTA)) {
if (apnType != ApnSetting.TYPE_NONE)
error = true;
apnType = ApnSetting.TYPE_FOTA;
}
if (nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_IMS)) {
if (apnType != ApnSetting.TYPE_NONE)
error = true;
apnType = ApnSetting.TYPE_IMS;
}
if (nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_CBS)) {
if (apnType != ApnSetting.TYPE_NONE)
error = true;
apnType = ApnSetting.TYPE_CBS;
}
if (nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_IA)) {
if (apnType != ApnSetting.TYPE_NONE)
error = true;
apnType = ApnSetting.TYPE_IA;
}
if (nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_EIMS)) {
if (apnType != ApnSetting.TYPE_NONE)
error = true;
apnType = ApnSetting.TYPE_EMERGENCY;
}
if (nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_MCX)) {
if (apnType != ApnSetting.TYPE_NONE)
error = true;
apnType = ApnSetting.TYPE_MCX;
}
if (nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_XCAP)) {
if (apnType != ApnSetting.TYPE_NONE)
error = true;
apnType = ApnSetting.TYPE_XCAP;
}
if (error) {
// TODO: If this error condition is removed, the framework's handling of
// NET_CAPABILITY_NOT_RESTRICTED will need to be updated so requests for
// say FOTA and INTERNET are marked as restricted. This is not how
// NetworkCapabilities.maybeMarkCapabilitiesRestricted currently works.
Rlog.d(SLOG_TAG, "Multiple apn types specified in request - result is unspecified!");
}
if (apnType == ApnSetting.TYPE_NONE) {
Rlog.d(SLOG_TAG, "Unsupported NetworkRequest in Telephony: nr=" + nr);
}
return apnType;
}
Aggregations