Loading src/java/com/android/internal/telephony/Phone.java +8 −2 Original line number Diff line number Diff line Loading @@ -5085,9 +5085,15 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { pw.println("++++++++++++++++++++++++++++++++"); } if (isUsingNewDataStack()) { if (mAccessNetworksManager != null) { mAccessNetworksManager.dump(fd, pw, args); } } else { if (mTransportManager != null) { mTransportManager.dump(fd, pw, args); } } if (mCi != null && mCi instanceof RIL) { try { Loading src/java/com/android/internal/telephony/data/AccessNetworksManager.java +81 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.internal.telephony.data; import android.annotation.CallbackExecutor; import android.annotation.NonNull; import android.annotation.StringDef; import android.content.BroadcastReceiver; Loading Loading @@ -46,6 +47,7 @@ import android.telephony.data.IQualifiedNetworksServiceCallback; import android.telephony.data.QualifiedNetworksService; import android.telephony.data.ThrottleStatus; import android.text.TextUtils; import android.util.ArraySet; import android.util.IndentingPrintWriter; import android.util.LocalLog; import android.util.SparseArray; Loading @@ -67,6 +69,7 @@ import java.util.Map; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executor; import java.util.stream.Collectors; /** Loading Loading @@ -172,6 +175,12 @@ public class AccessNetworksManager extends Handler { */ private final Map<Integer, Integer> mPreferredTransports = new ConcurrentHashMap<>(); /** * Callbacks for passing information to interested clients. */ private final @NonNull Set<AccessNetworksManagerCallback> mAccessNetworksManagerCallbacks = new ArraySet<>(); /** * Registers the data throttler in order to receive APN status changes. * Loading Loading @@ -344,6 +353,27 @@ public class AccessNetworksManager extends Handler { } } /** * Access networks manager callback. This should be only used by {@link DataNetworkController}. */ public abstract static class AccessNetworksManagerCallback extends DataCallback { /** * Constructor * * @param executor The executor of the callback. */ public AccessNetworksManagerCallback(@NonNull @CallbackExecutor Executor executor) { super(executor); } /** * Called when preferred transport changed. * * @param networkCapability The network capability. */ public abstract void onPreferredTransportChanged(@NetCapability int networkCapability); } /** * Constructor * Loading Loading @@ -544,13 +574,24 @@ public class AccessNetworksManager extends Handler { return mAvailableTransports; } /** * Get the transport based on the network capability. * * @param netCap The network capability. * @return The transport type. */ public @TransportType int getCurrentTransportByNetworkCapability(@NetCapability int netCap) { return getCurrentTransport(DataUtils.networkCapabilityToApnType(netCap)); } /** * Get the transport based on the APN type. * * @param apnType APN type * @return The transport type */ public int getCurrentTransport(@ApnType int apnType) { // TODO: Remove this after TransportManager is removed. public @TransportType int getCurrentTransport(@ApnType int apnType) { // In legacy mode, always route to cellular. if (isInLegacyMode()) { return AccessNetworkConstants.TRANSPORT_TYPE_WWAN; Loading @@ -561,13 +602,25 @@ public class AccessNetworksManager extends Handler { ? AccessNetworkConstants.TRANSPORT_TYPE_WWAN : mCurrentTransports.get(apnType); } /** * Set the current transport of a network capability. * * @param netCap The network capability. * @param transport The transport. */ public void setCurrentTransportByNetworkCapability(@NetCapability int netCap, @TransportType int transport) { setCurrentTransport(DataUtils.networkCapabilityToApnType(netCap), transport); } /** * Set the current transport of apn type. * * @param apnType The APN type * @param transport The transport. Must be WWAN or WLAN. * @param transport The transport. */ public void setCurrentTransport(@ApnType int apnType, int transport) { // TODO: Remove this after TransportManager is removed. public void setCurrentTransport(@ApnType int apnType, @TransportType int transport) { Integer previousTransport = mCurrentTransports.put(apnType, transport); if (previousTransport == null || previousTransport != transport) { logl("setCurrentTransport: apnType=" + ApnSetting.getApnTypeString(apnType) Loading @@ -585,6 +638,12 @@ public class AccessNetworksManager extends Handler { for (QualifiedNetworks networks : networksList) { if (networks.qualifiedNetworks.length > 0) { int transport = getTransportFromAccessNetwork(networks.qualifiedNetworks[0]); if (getCurrentTransport(networks.apnType) != transport) { mAccessNetworksManagerCallbacks.forEach(callback -> callback.invokeFromExecutor(() -> callback.onPreferredTransportChanged(DataUtils .apnTypeToNetworkCapability(networks.apnType)))); } mPreferredTransports.put(networks.apnType, transport); logl("setPreferredTransports: apnType=" + ApnSetting.getApnTypeString(networks.apnType) Loading Loading @@ -652,6 +711,25 @@ public class AccessNetworksManager extends Handler { } } /** * Register the callback for receiving information from {@link AccessNetworksManager}. * * @param callback The callback. */ public void registerCallback(@NonNull AccessNetworksManagerCallback callback) { mAccessNetworksManagerCallbacks.add(callback); } /** * Unregister the callback which was previously registered through * {@link #registerCallback(AccessNetworksManagerCallback)}. * * @param callback The callback to unregister. */ public void unregisterCallback(@NonNull AccessNetworksManagerCallback callback) { mAccessNetworksManagerCallbacks.remove(callback); } private void log(String s) { Rlog.d(mLogTag, s); } Loading src/java/com/android/internal/telephony/data/DataConfigManager.java +46 −11 Original line number Diff line number Diff line Loading @@ -45,7 +45,8 @@ import android.util.IndentingPrintWriter; import com.android.internal.R; import com.android.internal.telephony.Phone; import com.android.internal.telephony.data.DataNetworkController.HandoverRule; import com.android.internal.telephony.data.DataRetryManager.DataRetryRule; import com.android.internal.telephony.data.DataRetryManager.DataHandoverRetryRule; import com.android.internal.telephony.data.DataRetryManager.DataSetupRetryRule; import com.android.telephony.Rlog; import java.io.FileDescriptor; Loading Loading @@ -197,8 +198,10 @@ public class DataConfigManager extends Handler { /** The network capability priority map */ private @NonNull final Map<Integer, Integer> mNetworkCapabilityPriorityMap = new ConcurrentHashMap<>(); /** The data retry rules */ private @NonNull final List<DataRetryRule> mDataRetryRules = new ArrayList<>(); /** The data setup retry rules */ private @NonNull final List<DataSetupRetryRule> mDataSetupRetryRules = new ArrayList<>(); /** The data handover retry rules */ private @NonNull final List<DataHandoverRetryRule> mDataHandoverRetryRules = new ArrayList<>(); /** The metered APN types for home network */ private @NonNull final @ApnType Set<Integer> mMeteredApnTypes = new HashSet<>(); /** The metered APN types for roaming network */ Loading Loading @@ -351,13 +354,26 @@ public class DataConfigManager extends Handler { */ private void updateDataRetryRules() { synchronized (this) { mDataRetryRules.clear(); mDataSetupRetryRules.clear(); String[] dataRetryRulesStrings = mCarrierConfig.getStringArray( CarrierConfigManager.KEY_TELEPHONY_DATA_RETRY_RULES_STRING_ARRAY); CarrierConfigManager.KEY_TELEPHONY_DATA_SETUP_RETRY_RULES_STRING_ARRAY); if (dataRetryRulesStrings != null) { for (String ruleString : dataRetryRulesStrings) { try { mDataRetryRules.add(new DataRetryRule(ruleString)); mDataSetupRetryRules.add(new DataSetupRetryRule(ruleString)); } catch (IllegalArgumentException e) { loge("updateDataRetryRules: " + e.getMessage()); } } } mDataHandoverRetryRules.clear(); dataRetryRulesStrings = mCarrierConfig.getStringArray( CarrierConfigManager.KEY_TELEPHONY_DATA_HANDOVER_RETRY_RULES_STRING_ARRAY); if (dataRetryRulesStrings != null) { for (String ruleString : dataRetryRulesStrings) { try { mDataHandoverRetryRules.add(new DataHandoverRetryRule(ruleString)); } catch (IllegalArgumentException e) { loge("updateDataRetryRules: " + e.getMessage()); } Loading @@ -367,10 +383,17 @@ public class DataConfigManager extends Handler { } /** * @return The data retry rules from carrier config. * @return The data setup retry rules from carrier config. */ public @NonNull List<DataRetryRule> getDataRetryRules() { return Collections.unmodifiableList(mDataRetryRules); public @NonNull List<DataSetupRetryRule> getDataSetupRetryRules() { return Collections.unmodifiableList(mDataSetupRetryRules); } /** * @return The data handover retry rules from carrier config. */ public @NonNull List<DataHandoverRetryRule> getDataHandoverRetryRules() { return Collections.unmodifiableList(mDataHandoverRetryRules); } /** Loading Loading @@ -708,6 +731,14 @@ public class DataConfigManager extends Handler { return Collections.unmodifiableList(mHandoverRuleList); } /** * @return Get the delay in milliseconds for re-evaluating unsatisfied network requests. */ public long getRetrySetupAfterDisconnectMillis() { return mCarrierConfig.getLong(CarrierConfigManager .KEY_CARRIER_DATA_CALL_APN_RETRY_AFTER_DISCONNECT_LONG); } /** * Get the data config network type for the given network type * Loading Loading @@ -814,9 +845,13 @@ public class DataConfigManager extends Handler { DataUtils.networkCapabilityToString(key) + ":" + value + " ")); pw.decreaseIndent(); pw.println(); pw.println("Data retry rules:"); pw.println("Data setup retry rules:"); pw.increaseIndent(); mDataSetupRetryRules.forEach(pw::println); pw.decreaseIndent(); pw.println("Data handover retry rules:"); pw.increaseIndent(); mDataRetryRules.forEach(pw::println); mDataHandoverRetryRules.forEach(pw::println); pw.decreaseIndent(); pw.println("Metered APN types=" + mMeteredApnTypes.stream() .map(ApnSetting::getApnTypeString).collect(Collectors.joining(","))); Loading src/java/com/android/internal/telephony/data/DataEvaluation.java +7 −1 Original line number Diff line number Diff line Loading @@ -181,6 +181,10 @@ public class DataEvaluation { DATA_NETWORK_CAPABILITIES_CHANGED, /** When emergency call started or ended. */ EMERGENCY_CALL_CHANGED, /** When data disconnected, re-evaluate later to see if data could be brought up again. */ DATA_NETWORK_DISCONNECTED, /** Data setup retry. */ DATA_RETRY, } /** Disallowed reasons. There could be multiple reasons if data connection is not allowed. */ Loading Loading @@ -217,7 +221,9 @@ public class DataEvaluation { /** Current data network type not allowed. */ DATA_NETWORK_TYPE_NOT_ALLOWED(true), /** Device is currently in an emergency call. */ EMERGENCY_CALL(true); EMERGENCY_CALL(true), /** There is already a retry setup scheduled for this data profile. */ RETRY_SCHEDULED(true); private final boolean mIsHardReason; Loading src/java/com/android/internal/telephony/data/DataNetwork.java +235 −37 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
src/java/com/android/internal/telephony/Phone.java +8 −2 Original line number Diff line number Diff line Loading @@ -5085,9 +5085,15 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { pw.println("++++++++++++++++++++++++++++++++"); } if (isUsingNewDataStack()) { if (mAccessNetworksManager != null) { mAccessNetworksManager.dump(fd, pw, args); } } else { if (mTransportManager != null) { mTransportManager.dump(fd, pw, args); } } if (mCi != null && mCi instanceof RIL) { try { Loading
src/java/com/android/internal/telephony/data/AccessNetworksManager.java +81 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.internal.telephony.data; import android.annotation.CallbackExecutor; import android.annotation.NonNull; import android.annotation.StringDef; import android.content.BroadcastReceiver; Loading Loading @@ -46,6 +47,7 @@ import android.telephony.data.IQualifiedNetworksServiceCallback; import android.telephony.data.QualifiedNetworksService; import android.telephony.data.ThrottleStatus; import android.text.TextUtils; import android.util.ArraySet; import android.util.IndentingPrintWriter; import android.util.LocalLog; import android.util.SparseArray; Loading @@ -67,6 +69,7 @@ import java.util.Map; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executor; import java.util.stream.Collectors; /** Loading Loading @@ -172,6 +175,12 @@ public class AccessNetworksManager extends Handler { */ private final Map<Integer, Integer> mPreferredTransports = new ConcurrentHashMap<>(); /** * Callbacks for passing information to interested clients. */ private final @NonNull Set<AccessNetworksManagerCallback> mAccessNetworksManagerCallbacks = new ArraySet<>(); /** * Registers the data throttler in order to receive APN status changes. * Loading Loading @@ -344,6 +353,27 @@ public class AccessNetworksManager extends Handler { } } /** * Access networks manager callback. This should be only used by {@link DataNetworkController}. */ public abstract static class AccessNetworksManagerCallback extends DataCallback { /** * Constructor * * @param executor The executor of the callback. */ public AccessNetworksManagerCallback(@NonNull @CallbackExecutor Executor executor) { super(executor); } /** * Called when preferred transport changed. * * @param networkCapability The network capability. */ public abstract void onPreferredTransportChanged(@NetCapability int networkCapability); } /** * Constructor * Loading Loading @@ -544,13 +574,24 @@ public class AccessNetworksManager extends Handler { return mAvailableTransports; } /** * Get the transport based on the network capability. * * @param netCap The network capability. * @return The transport type. */ public @TransportType int getCurrentTransportByNetworkCapability(@NetCapability int netCap) { return getCurrentTransport(DataUtils.networkCapabilityToApnType(netCap)); } /** * Get the transport based on the APN type. * * @param apnType APN type * @return The transport type */ public int getCurrentTransport(@ApnType int apnType) { // TODO: Remove this after TransportManager is removed. public @TransportType int getCurrentTransport(@ApnType int apnType) { // In legacy mode, always route to cellular. if (isInLegacyMode()) { return AccessNetworkConstants.TRANSPORT_TYPE_WWAN; Loading @@ -561,13 +602,25 @@ public class AccessNetworksManager extends Handler { ? AccessNetworkConstants.TRANSPORT_TYPE_WWAN : mCurrentTransports.get(apnType); } /** * Set the current transport of a network capability. * * @param netCap The network capability. * @param transport The transport. */ public void setCurrentTransportByNetworkCapability(@NetCapability int netCap, @TransportType int transport) { setCurrentTransport(DataUtils.networkCapabilityToApnType(netCap), transport); } /** * Set the current transport of apn type. * * @param apnType The APN type * @param transport The transport. Must be WWAN or WLAN. * @param transport The transport. */ public void setCurrentTransport(@ApnType int apnType, int transport) { // TODO: Remove this after TransportManager is removed. public void setCurrentTransport(@ApnType int apnType, @TransportType int transport) { Integer previousTransport = mCurrentTransports.put(apnType, transport); if (previousTransport == null || previousTransport != transport) { logl("setCurrentTransport: apnType=" + ApnSetting.getApnTypeString(apnType) Loading @@ -585,6 +638,12 @@ public class AccessNetworksManager extends Handler { for (QualifiedNetworks networks : networksList) { if (networks.qualifiedNetworks.length > 0) { int transport = getTransportFromAccessNetwork(networks.qualifiedNetworks[0]); if (getCurrentTransport(networks.apnType) != transport) { mAccessNetworksManagerCallbacks.forEach(callback -> callback.invokeFromExecutor(() -> callback.onPreferredTransportChanged(DataUtils .apnTypeToNetworkCapability(networks.apnType)))); } mPreferredTransports.put(networks.apnType, transport); logl("setPreferredTransports: apnType=" + ApnSetting.getApnTypeString(networks.apnType) Loading Loading @@ -652,6 +711,25 @@ public class AccessNetworksManager extends Handler { } } /** * Register the callback for receiving information from {@link AccessNetworksManager}. * * @param callback The callback. */ public void registerCallback(@NonNull AccessNetworksManagerCallback callback) { mAccessNetworksManagerCallbacks.add(callback); } /** * Unregister the callback which was previously registered through * {@link #registerCallback(AccessNetworksManagerCallback)}. * * @param callback The callback to unregister. */ public void unregisterCallback(@NonNull AccessNetworksManagerCallback callback) { mAccessNetworksManagerCallbacks.remove(callback); } private void log(String s) { Rlog.d(mLogTag, s); } Loading
src/java/com/android/internal/telephony/data/DataConfigManager.java +46 −11 Original line number Diff line number Diff line Loading @@ -45,7 +45,8 @@ import android.util.IndentingPrintWriter; import com.android.internal.R; import com.android.internal.telephony.Phone; import com.android.internal.telephony.data.DataNetworkController.HandoverRule; import com.android.internal.telephony.data.DataRetryManager.DataRetryRule; import com.android.internal.telephony.data.DataRetryManager.DataHandoverRetryRule; import com.android.internal.telephony.data.DataRetryManager.DataSetupRetryRule; import com.android.telephony.Rlog; import java.io.FileDescriptor; Loading Loading @@ -197,8 +198,10 @@ public class DataConfigManager extends Handler { /** The network capability priority map */ private @NonNull final Map<Integer, Integer> mNetworkCapabilityPriorityMap = new ConcurrentHashMap<>(); /** The data retry rules */ private @NonNull final List<DataRetryRule> mDataRetryRules = new ArrayList<>(); /** The data setup retry rules */ private @NonNull final List<DataSetupRetryRule> mDataSetupRetryRules = new ArrayList<>(); /** The data handover retry rules */ private @NonNull final List<DataHandoverRetryRule> mDataHandoverRetryRules = new ArrayList<>(); /** The metered APN types for home network */ private @NonNull final @ApnType Set<Integer> mMeteredApnTypes = new HashSet<>(); /** The metered APN types for roaming network */ Loading Loading @@ -351,13 +354,26 @@ public class DataConfigManager extends Handler { */ private void updateDataRetryRules() { synchronized (this) { mDataRetryRules.clear(); mDataSetupRetryRules.clear(); String[] dataRetryRulesStrings = mCarrierConfig.getStringArray( CarrierConfigManager.KEY_TELEPHONY_DATA_RETRY_RULES_STRING_ARRAY); CarrierConfigManager.KEY_TELEPHONY_DATA_SETUP_RETRY_RULES_STRING_ARRAY); if (dataRetryRulesStrings != null) { for (String ruleString : dataRetryRulesStrings) { try { mDataRetryRules.add(new DataRetryRule(ruleString)); mDataSetupRetryRules.add(new DataSetupRetryRule(ruleString)); } catch (IllegalArgumentException e) { loge("updateDataRetryRules: " + e.getMessage()); } } } mDataHandoverRetryRules.clear(); dataRetryRulesStrings = mCarrierConfig.getStringArray( CarrierConfigManager.KEY_TELEPHONY_DATA_HANDOVER_RETRY_RULES_STRING_ARRAY); if (dataRetryRulesStrings != null) { for (String ruleString : dataRetryRulesStrings) { try { mDataHandoverRetryRules.add(new DataHandoverRetryRule(ruleString)); } catch (IllegalArgumentException e) { loge("updateDataRetryRules: " + e.getMessage()); } Loading @@ -367,10 +383,17 @@ public class DataConfigManager extends Handler { } /** * @return The data retry rules from carrier config. * @return The data setup retry rules from carrier config. */ public @NonNull List<DataRetryRule> getDataRetryRules() { return Collections.unmodifiableList(mDataRetryRules); public @NonNull List<DataSetupRetryRule> getDataSetupRetryRules() { return Collections.unmodifiableList(mDataSetupRetryRules); } /** * @return The data handover retry rules from carrier config. */ public @NonNull List<DataHandoverRetryRule> getDataHandoverRetryRules() { return Collections.unmodifiableList(mDataHandoverRetryRules); } /** Loading Loading @@ -708,6 +731,14 @@ public class DataConfigManager extends Handler { return Collections.unmodifiableList(mHandoverRuleList); } /** * @return Get the delay in milliseconds for re-evaluating unsatisfied network requests. */ public long getRetrySetupAfterDisconnectMillis() { return mCarrierConfig.getLong(CarrierConfigManager .KEY_CARRIER_DATA_CALL_APN_RETRY_AFTER_DISCONNECT_LONG); } /** * Get the data config network type for the given network type * Loading Loading @@ -814,9 +845,13 @@ public class DataConfigManager extends Handler { DataUtils.networkCapabilityToString(key) + ":" + value + " ")); pw.decreaseIndent(); pw.println(); pw.println("Data retry rules:"); pw.println("Data setup retry rules:"); pw.increaseIndent(); mDataSetupRetryRules.forEach(pw::println); pw.decreaseIndent(); pw.println("Data handover retry rules:"); pw.increaseIndent(); mDataRetryRules.forEach(pw::println); mDataHandoverRetryRules.forEach(pw::println); pw.decreaseIndent(); pw.println("Metered APN types=" + mMeteredApnTypes.stream() .map(ApnSetting::getApnTypeString).collect(Collectors.joining(","))); Loading
src/java/com/android/internal/telephony/data/DataEvaluation.java +7 −1 Original line number Diff line number Diff line Loading @@ -181,6 +181,10 @@ public class DataEvaluation { DATA_NETWORK_CAPABILITIES_CHANGED, /** When emergency call started or ended. */ EMERGENCY_CALL_CHANGED, /** When data disconnected, re-evaluate later to see if data could be brought up again. */ DATA_NETWORK_DISCONNECTED, /** Data setup retry. */ DATA_RETRY, } /** Disallowed reasons. There could be multiple reasons if data connection is not allowed. */ Loading Loading @@ -217,7 +221,9 @@ public class DataEvaluation { /** Current data network type not allowed. */ DATA_NETWORK_TYPE_NOT_ALLOWED(true), /** Device is currently in an emergency call. */ EMERGENCY_CALL(true); EMERGENCY_CALL(true), /** There is already a retry setup scheduled for this data profile. */ RETRY_SCHEDULED(true); private final boolean mIsHardReason; Loading
src/java/com/android/internal/telephony/data/DataNetwork.java +235 −37 File changed.Preview size limit exceeded, changes collapsed. Show changes