Loading src/java/com/android/internal/telephony/RILUtils.java +4 −0 Original line number Diff line number Diff line Loading @@ -983,8 +983,11 @@ public class RILUtils { dpi.persistent = dp.isPersistent(); dpi.preferred = dp.isPreferred(); dpi.alwaysOn = false; dpi.infrastructureBitmap = android.hardware.radio.data.DataProfileInfo .INFRASTRUCTURE_CELLULAR; if (dp.getApnSetting() != null) { dpi.alwaysOn = dp.getApnSetting().isAlwaysOn(); dpi.infrastructureBitmap = dp.getApnSetting().getInfrastructureBitmask(); } dpi.trafficDescriptor = convertToHalTrafficDescriptorAidl(dp.getTrafficDescriptor()); Loading Loading @@ -1022,6 +1025,7 @@ public class RILUtils { .setRoamingProtocol(dpi.roamingProtocol) .setUser(dpi.user) .setAlwaysOn(dpi.alwaysOn) .setInfrastructureBitmask(dpi.infrastructureBitmap) .build(); TrafficDescriptor td; Loading src/java/com/android/internal/telephony/TelephonyComponentFactory.java +3 −1 Original line number Diff line number Diff line Loading @@ -498,15 +498,17 @@ public class TelephonyComponentFactory { * @param dataServiceManager Data service manager instance. * @param looper The looper to be used by the handler. Currently the handler thread is the phone * process's main thread. * @param featureFlags Feature flags controlling which feature is enabled. * * @param callback Callback for passing events back to data network controller. * @return The data profile manager instance. */ public @NonNull DataProfileManager makeDataProfileManager(@NonNull Phone phone, @NonNull DataNetworkController dataNetworkController, @NonNull DataServiceManager dataServiceManager, @NonNull Looper looper, @NonNull FeatureFlags featureFlags, @NonNull DataProfileManager.DataProfileManagerCallback callback) { return new DataProfileManager(phone, dataNetworkController, dataServiceManager, looper, callback); featureFlags, callback); } /** Loading src/java/com/android/internal/telephony/data/DataNetwork.java +2 −1 Original line number Diff line number Diff line Loading @@ -3308,7 +3308,8 @@ public class DataNetwork extends StateMachine { && !mAttachedNetworkRequestList.isEmpty()) { TelephonyNetworkRequest networkRequest = mAttachedNetworkRequestList.get(0); DataProfile dataProfile = mDataNetworkController.getDataProfileManager() .getDataProfileForNetworkRequest(networkRequest, targetNetworkType, false); .getDataProfileForNetworkRequest(networkRequest, targetNetworkType, mPhone.getServiceState().isUsingNonTerrestrialNetwork(), false); // Some carriers have different profiles between cellular and IWLAN. We need to // dynamically switch profile, but only when those profiles have same APN name. if (dataProfile != null && dataProfile.getApnSetting() != null Loading src/java/com/android/internal/telephony/data/DataNetworkController.java +5 −1 Original line number Diff line number Diff line Loading @@ -879,6 +879,7 @@ public class DataNetworkController extends Handler { DataProfileManager.class.getName()) .makeDataProfileManager(mPhone, this, mDataServiceManagers .get(AccessNetworkConstants.TRANSPORT_TYPE_WWAN), looper, mFeatureFlags, new DataProfileManagerCallback(this::post) { @Override public void onDataProfilesChanged() { Loading Loading @@ -1328,6 +1329,7 @@ public class DataNetworkController extends Handler { DataProfile candidate = mDataProfileManager .getDataProfileForNetworkRequest(requestList.getFirst(), TelephonyManager.NETWORK_TYPE_IWLAN, mServiceState.isUsingNonTerrestrialNetwork(), false/*ignorePermanentFailure*/); if (candidate != null && !dataNetwork.getDataProfile().equals(candidate)) { logv("But skipped because found better data profile " + candidate Loading Loading @@ -1491,7 +1493,8 @@ public class DataNetworkController extends Handler { if (networkRequest.hasCapability(NetworkCapabilities.NET_CAPABILITY_EIMS)) { evaluation.addDataAllowedReason(DataAllowedReason.EMERGENCY_REQUEST); evaluation.setCandidateDataProfile(mDataProfileManager.getDataProfileForNetworkRequest( networkRequest, getDataNetworkType(transport), true)); networkRequest, getDataNetworkType(transport), mServiceState.isUsingNonTerrestrialNetwork(), true)); networkRequest.setEvaluation(evaluation); log(evaluation.toString()); return evaluation; Loading Loading @@ -1647,6 +1650,7 @@ public class DataNetworkController extends Handler { } DataProfile dataProfile = mDataProfileManager .getDataProfileForNetworkRequest(networkRequest, networkType, mServiceState.isUsingNonTerrestrialNetwork(), // If the evaluation is due to environmental changes, then we should ignore // the permanent failure reached earlier. reason.isConditionBased()); Loading src/java/com/android/internal/telephony/data/DataProfileManager.java +65 −18 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import android.util.LocalLog; import com.android.internal.telephony.Phone; import com.android.internal.telephony.data.DataConfigManager.DataConfigManagerCallback; import com.android.internal.telephony.data.DataNetworkController.DataNetworkControllerCallback; import com.android.internal.telephony.flags.FeatureFlags; import com.android.telephony.Rlog; import java.io.FileDescriptor; Loading Loading @@ -113,6 +114,9 @@ public class DataProfileManager extends Handler { /** SIM state. */ private @SimState int mSimState = TelephonyManager.SIM_STATE_UNKNOWN; /** Feature flags controlling which feature is enabled. */ private final @NonNull FeatureFlags mFeatureFlags; /** * Data profile manager callback. This should be only used by {@link DataNetworkController}. */ Loading Loading @@ -140,15 +144,18 @@ public class DataProfileManager extends Handler { * @param dataServiceManager WWAN data service manager. * @param looper The looper to be used by the handler. Currently the handler thread is the * phone process's main thread. * @param featureFlags Feature flags controlling which feature is enabled. * @param callback Data profile manager callback. */ public DataProfileManager(@NonNull Phone phone, @NonNull DataNetworkController dataNetworkController, @NonNull DataServiceManager dataServiceManager, @NonNull Looper looper, @NonNull FeatureFlags featureFlags, @NonNull DataProfileManagerCallback callback) { super(looper); mPhone = phone; mLogTag = "DPM-" + mPhone.getPhoneId(); mFeatureFlags = featureFlags; mDataNetworkController = dataNetworkController; mWwanDataServiceManager = dataServiceManager; mDataConfigManager = dataNetworkController.getDataConfigManager(); Loading Loading @@ -626,17 +633,18 @@ public class DataProfileManager extends Handler { * * @param networkRequest The network request. * @param networkType The current data network type. * @param isNtn {@code true} if the device is currently attached to non-terrestrial network. * @param ignorePermanentFailure {@code true} to ignore {@link ApnSetting#getPermanentFailed()}. * This should be set to true for condition-based retry/setup. * @return The data profile. {@code null} if can't find any satisfiable data profile. */ public @Nullable DataProfile getDataProfileForNetworkRequest( @NonNull TelephonyNetworkRequest networkRequest, @NetworkType int networkType, boolean ignorePermanentFailure) { boolean isNtn, boolean ignorePermanentFailure) { ApnSetting apnSetting = null; if (networkRequest.hasAttribute(TelephonyNetworkRequest .CAPABILITY_ATTRIBUTE_APN_SETTING)) { apnSetting = getApnSettingForNetworkRequest(networkRequest, networkType, apnSetting = getApnSettingForNetworkRequest(networkRequest, networkType, isNtn, ignorePermanentFailure); } Loading Loading @@ -696,21 +704,44 @@ public class DataProfileManager extends Handler { * * @param networkRequest The network request. * @param networkType The current data network type. * @param isNtn {@code true} if the device is currently attached to non-terrestrial network. * @param ignorePermanentFailure {@code true} to ignore {@link ApnSetting#getPermanentFailed()}. * This should be set to true for condition-based retry/setup. * @return The APN setting. {@code null} if can't find any satisfiable data profile. */ private @Nullable ApnSetting getApnSettingForNetworkRequest( @NonNull TelephonyNetworkRequest networkRequest, @NetworkType int networkType, boolean ignorePermanentFailure) { boolean isNtn, boolean ignorePermanentFailure) { if (!networkRequest.hasAttribute( TelephonyNetworkRequest.CAPABILITY_ATTRIBUTE_APN_SETTING)) { loge("Network request does not have APN setting attribute."); return null; } // If the preferred data profile can be used, always use it if it can satisfy the network // request with current network type (even though it's been marked as permanent failed.) if (mFeatureFlags.carrierEnabledSatelliteFlag()) { // If the preferred data profile can be used, always use it if it can satisfy the // network request with current network type (even though it's been marked as permanent // failed.) if (mPreferredDataProfile != null && networkRequest.canBeSatisfiedBy(mPreferredDataProfile) && mPreferredDataProfile.getApnSetting() != null && mPreferredDataProfile.getApnSetting().canSupportNetworkType(networkType) && ((isNtn && mPreferredDataProfile.getApnSetting().isForInfrastructure( ApnSetting.INFRASTRUCTURE_SATELLITE)) || (!isNtn && mPreferredDataProfile.getApnSetting().isForInfrastructure( ApnSetting.INFRASTRUCTURE_CELLULAR)))) { if (ignorePermanentFailure || !mPreferredDataProfile.getApnSetting() .getPermanentFailed()) { return mPreferredDataProfile.getApnSetting(); } log("The preferred data profile is permanently failed. Only condition based " + "retry can happen."); return null; } } else { // If the preferred data profile can be used, always use it if it can satisfy the // network request with current network type (even though it's been marked as permanent // failed.) if (mPreferredDataProfile != null && networkRequest.canBeSatisfiedBy(mPreferredDataProfile) && mPreferredDataProfile.getApnSetting() != null Loading @@ -719,10 +750,11 @@ public class DataProfileManager extends Handler { .getPermanentFailed()) { return mPreferredDataProfile.getApnSetting(); } log("The preferred data profile is permanently failed. Only condition based retry " + "can happen."); log("The preferred data profile is permanently failed. Only condition based " + "retry can happen."); return null; } } // Filter out the data profile that can't satisfy the request. // Preferred data profile should be returned in the top of the list. Loading @@ -743,8 +775,22 @@ public class DataProfileManager extends Handler { // Check if the remaining data profiles can used in current data network type. dataProfiles = dataProfiles.stream() .filter(dp -> dp.getApnSetting() != null && dp.getApnSetting().canSupportNetworkType(networkType)) .filter((dp) -> { if (dp.getApnSetting() == null) return false; if (!dp.getApnSetting().canSupportNetworkType(networkType)) return false; if (mFeatureFlags.carrierEnabledSatelliteFlag()) { if (isNtn && !dp.getApnSetting().isForInfrastructure( ApnSetting.INFRASTRUCTURE_SATELLITE)) { return false; } if (!isNtn && !dp.getApnSetting().isForInfrastructure( ApnSetting.INFRASTRUCTURE_CELLULAR)) { return false; } } return true; }) .collect(Collectors.toList()); if (dataProfiles.size() == 0) { log("Can't find any data profile for network type " Loading Loading @@ -818,7 +864,8 @@ public class DataProfileManager extends Handler { new NetworkRequest.Builder() .addCapability(NetworkCapabilities.NET_CAPABILITY_DUN) .build(), mPhone); return getDataProfileForNetworkRequest(networkRequest, networkType, true) != null; return getDataProfileForNetworkRequest(networkRequest, networkType, mPhone.getServiceState().isUsingNonTerrestrialNetwork(), true) != null; } /** Loading Loading
src/java/com/android/internal/telephony/RILUtils.java +4 −0 Original line number Diff line number Diff line Loading @@ -983,8 +983,11 @@ public class RILUtils { dpi.persistent = dp.isPersistent(); dpi.preferred = dp.isPreferred(); dpi.alwaysOn = false; dpi.infrastructureBitmap = android.hardware.radio.data.DataProfileInfo .INFRASTRUCTURE_CELLULAR; if (dp.getApnSetting() != null) { dpi.alwaysOn = dp.getApnSetting().isAlwaysOn(); dpi.infrastructureBitmap = dp.getApnSetting().getInfrastructureBitmask(); } dpi.trafficDescriptor = convertToHalTrafficDescriptorAidl(dp.getTrafficDescriptor()); Loading Loading @@ -1022,6 +1025,7 @@ public class RILUtils { .setRoamingProtocol(dpi.roamingProtocol) .setUser(dpi.user) .setAlwaysOn(dpi.alwaysOn) .setInfrastructureBitmask(dpi.infrastructureBitmap) .build(); TrafficDescriptor td; Loading
src/java/com/android/internal/telephony/TelephonyComponentFactory.java +3 −1 Original line number Diff line number Diff line Loading @@ -498,15 +498,17 @@ public class TelephonyComponentFactory { * @param dataServiceManager Data service manager instance. * @param looper The looper to be used by the handler. Currently the handler thread is the phone * process's main thread. * @param featureFlags Feature flags controlling which feature is enabled. * * @param callback Callback for passing events back to data network controller. * @return The data profile manager instance. */ public @NonNull DataProfileManager makeDataProfileManager(@NonNull Phone phone, @NonNull DataNetworkController dataNetworkController, @NonNull DataServiceManager dataServiceManager, @NonNull Looper looper, @NonNull FeatureFlags featureFlags, @NonNull DataProfileManager.DataProfileManagerCallback callback) { return new DataProfileManager(phone, dataNetworkController, dataServiceManager, looper, callback); featureFlags, callback); } /** Loading
src/java/com/android/internal/telephony/data/DataNetwork.java +2 −1 Original line number Diff line number Diff line Loading @@ -3308,7 +3308,8 @@ public class DataNetwork extends StateMachine { && !mAttachedNetworkRequestList.isEmpty()) { TelephonyNetworkRequest networkRequest = mAttachedNetworkRequestList.get(0); DataProfile dataProfile = mDataNetworkController.getDataProfileManager() .getDataProfileForNetworkRequest(networkRequest, targetNetworkType, false); .getDataProfileForNetworkRequest(networkRequest, targetNetworkType, mPhone.getServiceState().isUsingNonTerrestrialNetwork(), false); // Some carriers have different profiles between cellular and IWLAN. We need to // dynamically switch profile, but only when those profiles have same APN name. if (dataProfile != null && dataProfile.getApnSetting() != null Loading
src/java/com/android/internal/telephony/data/DataNetworkController.java +5 −1 Original line number Diff line number Diff line Loading @@ -879,6 +879,7 @@ public class DataNetworkController extends Handler { DataProfileManager.class.getName()) .makeDataProfileManager(mPhone, this, mDataServiceManagers .get(AccessNetworkConstants.TRANSPORT_TYPE_WWAN), looper, mFeatureFlags, new DataProfileManagerCallback(this::post) { @Override public void onDataProfilesChanged() { Loading Loading @@ -1328,6 +1329,7 @@ public class DataNetworkController extends Handler { DataProfile candidate = mDataProfileManager .getDataProfileForNetworkRequest(requestList.getFirst(), TelephonyManager.NETWORK_TYPE_IWLAN, mServiceState.isUsingNonTerrestrialNetwork(), false/*ignorePermanentFailure*/); if (candidate != null && !dataNetwork.getDataProfile().equals(candidate)) { logv("But skipped because found better data profile " + candidate Loading Loading @@ -1491,7 +1493,8 @@ public class DataNetworkController extends Handler { if (networkRequest.hasCapability(NetworkCapabilities.NET_CAPABILITY_EIMS)) { evaluation.addDataAllowedReason(DataAllowedReason.EMERGENCY_REQUEST); evaluation.setCandidateDataProfile(mDataProfileManager.getDataProfileForNetworkRequest( networkRequest, getDataNetworkType(transport), true)); networkRequest, getDataNetworkType(transport), mServiceState.isUsingNonTerrestrialNetwork(), true)); networkRequest.setEvaluation(evaluation); log(evaluation.toString()); return evaluation; Loading Loading @@ -1647,6 +1650,7 @@ public class DataNetworkController extends Handler { } DataProfile dataProfile = mDataProfileManager .getDataProfileForNetworkRequest(networkRequest, networkType, mServiceState.isUsingNonTerrestrialNetwork(), // If the evaluation is due to environmental changes, then we should ignore // the permanent failure reached earlier. reason.isConditionBased()); Loading
src/java/com/android/internal/telephony/data/DataProfileManager.java +65 −18 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import android.util.LocalLog; import com.android.internal.telephony.Phone; import com.android.internal.telephony.data.DataConfigManager.DataConfigManagerCallback; import com.android.internal.telephony.data.DataNetworkController.DataNetworkControllerCallback; import com.android.internal.telephony.flags.FeatureFlags; import com.android.telephony.Rlog; import java.io.FileDescriptor; Loading Loading @@ -113,6 +114,9 @@ public class DataProfileManager extends Handler { /** SIM state. */ private @SimState int mSimState = TelephonyManager.SIM_STATE_UNKNOWN; /** Feature flags controlling which feature is enabled. */ private final @NonNull FeatureFlags mFeatureFlags; /** * Data profile manager callback. This should be only used by {@link DataNetworkController}. */ Loading Loading @@ -140,15 +144,18 @@ public class DataProfileManager extends Handler { * @param dataServiceManager WWAN data service manager. * @param looper The looper to be used by the handler. Currently the handler thread is the * phone process's main thread. * @param featureFlags Feature flags controlling which feature is enabled. * @param callback Data profile manager callback. */ public DataProfileManager(@NonNull Phone phone, @NonNull DataNetworkController dataNetworkController, @NonNull DataServiceManager dataServiceManager, @NonNull Looper looper, @NonNull FeatureFlags featureFlags, @NonNull DataProfileManagerCallback callback) { super(looper); mPhone = phone; mLogTag = "DPM-" + mPhone.getPhoneId(); mFeatureFlags = featureFlags; mDataNetworkController = dataNetworkController; mWwanDataServiceManager = dataServiceManager; mDataConfigManager = dataNetworkController.getDataConfigManager(); Loading Loading @@ -626,17 +633,18 @@ public class DataProfileManager extends Handler { * * @param networkRequest The network request. * @param networkType The current data network type. * @param isNtn {@code true} if the device is currently attached to non-terrestrial network. * @param ignorePermanentFailure {@code true} to ignore {@link ApnSetting#getPermanentFailed()}. * This should be set to true for condition-based retry/setup. * @return The data profile. {@code null} if can't find any satisfiable data profile. */ public @Nullable DataProfile getDataProfileForNetworkRequest( @NonNull TelephonyNetworkRequest networkRequest, @NetworkType int networkType, boolean ignorePermanentFailure) { boolean isNtn, boolean ignorePermanentFailure) { ApnSetting apnSetting = null; if (networkRequest.hasAttribute(TelephonyNetworkRequest .CAPABILITY_ATTRIBUTE_APN_SETTING)) { apnSetting = getApnSettingForNetworkRequest(networkRequest, networkType, apnSetting = getApnSettingForNetworkRequest(networkRequest, networkType, isNtn, ignorePermanentFailure); } Loading Loading @@ -696,21 +704,44 @@ public class DataProfileManager extends Handler { * * @param networkRequest The network request. * @param networkType The current data network type. * @param isNtn {@code true} if the device is currently attached to non-terrestrial network. * @param ignorePermanentFailure {@code true} to ignore {@link ApnSetting#getPermanentFailed()}. * This should be set to true for condition-based retry/setup. * @return The APN setting. {@code null} if can't find any satisfiable data profile. */ private @Nullable ApnSetting getApnSettingForNetworkRequest( @NonNull TelephonyNetworkRequest networkRequest, @NetworkType int networkType, boolean ignorePermanentFailure) { boolean isNtn, boolean ignorePermanentFailure) { if (!networkRequest.hasAttribute( TelephonyNetworkRequest.CAPABILITY_ATTRIBUTE_APN_SETTING)) { loge("Network request does not have APN setting attribute."); return null; } // If the preferred data profile can be used, always use it if it can satisfy the network // request with current network type (even though it's been marked as permanent failed.) if (mFeatureFlags.carrierEnabledSatelliteFlag()) { // If the preferred data profile can be used, always use it if it can satisfy the // network request with current network type (even though it's been marked as permanent // failed.) if (mPreferredDataProfile != null && networkRequest.canBeSatisfiedBy(mPreferredDataProfile) && mPreferredDataProfile.getApnSetting() != null && mPreferredDataProfile.getApnSetting().canSupportNetworkType(networkType) && ((isNtn && mPreferredDataProfile.getApnSetting().isForInfrastructure( ApnSetting.INFRASTRUCTURE_SATELLITE)) || (!isNtn && mPreferredDataProfile.getApnSetting().isForInfrastructure( ApnSetting.INFRASTRUCTURE_CELLULAR)))) { if (ignorePermanentFailure || !mPreferredDataProfile.getApnSetting() .getPermanentFailed()) { return mPreferredDataProfile.getApnSetting(); } log("The preferred data profile is permanently failed. Only condition based " + "retry can happen."); return null; } } else { // If the preferred data profile can be used, always use it if it can satisfy the // network request with current network type (even though it's been marked as permanent // failed.) if (mPreferredDataProfile != null && networkRequest.canBeSatisfiedBy(mPreferredDataProfile) && mPreferredDataProfile.getApnSetting() != null Loading @@ -719,10 +750,11 @@ public class DataProfileManager extends Handler { .getPermanentFailed()) { return mPreferredDataProfile.getApnSetting(); } log("The preferred data profile is permanently failed. Only condition based retry " + "can happen."); log("The preferred data profile is permanently failed. Only condition based " + "retry can happen."); return null; } } // Filter out the data profile that can't satisfy the request. // Preferred data profile should be returned in the top of the list. Loading @@ -743,8 +775,22 @@ public class DataProfileManager extends Handler { // Check if the remaining data profiles can used in current data network type. dataProfiles = dataProfiles.stream() .filter(dp -> dp.getApnSetting() != null && dp.getApnSetting().canSupportNetworkType(networkType)) .filter((dp) -> { if (dp.getApnSetting() == null) return false; if (!dp.getApnSetting().canSupportNetworkType(networkType)) return false; if (mFeatureFlags.carrierEnabledSatelliteFlag()) { if (isNtn && !dp.getApnSetting().isForInfrastructure( ApnSetting.INFRASTRUCTURE_SATELLITE)) { return false; } if (!isNtn && !dp.getApnSetting().isForInfrastructure( ApnSetting.INFRASTRUCTURE_CELLULAR)) { return false; } } return true; }) .collect(Collectors.toList()); if (dataProfiles.size() == 0) { log("Can't find any data profile for network type " Loading Loading @@ -818,7 +864,8 @@ public class DataProfileManager extends Handler { new NetworkRequest.Builder() .addCapability(NetworkCapabilities.NET_CAPABILITY_DUN) .build(), mPhone); return getDataProfileForNetworkRequest(networkRequest, networkType, true) != null; return getDataProfileForNetworkRequest(networkRequest, networkType, mPhone.getServiceState().isUsingNonTerrestrialNetwork(), true) != null; } /** Loading