Loading src/java/com/android/internal/telephony/Phone.java +13 −0 Original line number Diff line number Diff line Loading @@ -4750,6 +4750,13 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { return Collections.emptyList(); } /** * Return link bandwidth estimator */ public LinkBandwidthEstimator getLinkBandwidthEstimator() { return mLinkBandwidthEstimator; } public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.println("Phone: subId=" + getSubId()); pw.println(" mPhoneId=" + mPhoneId); Loading Loading @@ -4926,6 +4933,12 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { pw.println("++++++++++++++++++++++++++++++++"); } if (getLinkBandwidthEstimator() != null) { pw.println("LinkBandwidthEstimator:"); getLinkBandwidthEstimator().dump(fd, pw, args); pw.println("++++++++++++++++++++++++++++++++"); } pw.println("Phone Local Log: "); if (mLocalLog != null) { try { Loading src/java/com/android/internal/telephony/dataconnection/DataConnection.java +54 −16 Original line number Diff line number Diff line Loading @@ -373,7 +373,8 @@ public class DataConnection extends StateMachine { static final int EVENT_START_HANDOVER_ON_TARGET = BASE + 36; static final int EVENT_ALLOCATE_PDU_SESSION_ID = BASE + 37; static final int EVENT_RELEASE_PDU_SESSION_ID = BASE + 38; private static final int CMD_TO_STRING_COUNT = EVENT_RELEASE_PDU_SESSION_ID - BASE + 1; static final int EVENT_LINK_BANDWIDTH_ESTIMATOR_UPDATE = BASE + 39; private static final int CMD_TO_STRING_COUNT = EVENT_LINK_BANDWIDTH_ESTIMATOR_UPDATE - BASE + 1; private static String[] sCmdToString = new String[CMD_TO_STRING_COUNT]; static { Loading Loading @@ -423,6 +424,8 @@ public class DataConnection extends StateMachine { sCmdToString[EVENT_START_HANDOVER_ON_TARGET - BASE] = "EVENT_START_HANDOVER_ON_TARGET"; sCmdToString[EVENT_ALLOCATE_PDU_SESSION_ID - BASE] = "EVENT_ALLOCATE_PDU_SESSION_ID"; sCmdToString[EVENT_RELEASE_PDU_SESSION_ID - BASE] = "EVENT_RELEASE_PDU_SESSION_ID"; sCmdToString[EVENT_LINK_BANDWIDTH_ESTIMATOR_UPDATE - BASE] = "EVENT_LINK_BANDWIDTH_ESTIMATOR_UPDATE"; } // Convert cmd to string or null if unknown static String cmdToString(int cmd) { Loading Loading @@ -1515,7 +1518,31 @@ public class DataConnection extends StateMachine { uplinkUpdated = true; } } if (!downlinkUpdated || !uplinkUpdated) { fallBackToCarrierConfigValues(downlinkUpdated, uplinkUpdated); } if (mNetworkAgent != null) { mNetworkAgent.sendNetworkCapabilities(getNetworkCapabilities(), DataConnection.this); } } private void updateLinkBandwidthsFromBandwidthEstimator(int uplinkBandwidthKbps, int downlinkBandwidthKbps) { if (DBG) { log("updateLinkBandwidthsFromBandwidthEstimator, UL= " + uplinkBandwidthKbps + " DL= " + downlinkBandwidthKbps); } mDownlinkBandwidth = downlinkBandwidthKbps; mUplinkBandwidth = uplinkBandwidthKbps; if (mNetworkAgent != null) { mNetworkAgent.sendNetworkCapabilities(getNetworkCapabilities(), DataConnection.this); } } private void fallBackToCarrierConfigValues(boolean downlinkUpdated, boolean uplinkUpdated) { String ratName = ServiceState.rilRadioTechnologyToString(mRilRat); if (mRilRat == ServiceState.RIL_RADIO_TECHNOLOGY_LTE && isNRConnected()) { ratName = mPhone.getServiceState().getNrFrequencyRange() Loading @@ -1532,9 +1559,11 @@ public class DataConnection extends StateMachine { } } } if (mNetworkAgent != null) { mNetworkAgent.sendNetworkCapabilities(getNetworkCapabilities(), DataConnection.this); } /** Update Tx and Rx link bandwidth estimation values */ public void updateLinkBandwidthEstimation(int uplinkBandwidthKbps, int downlinkBandwidthKbps) { sendMessage(DataConnection.EVENT_LINK_BANDWIDTH_ESTIMATOR_UPDATE, new Pair<Integer, Integer>(uplinkBandwidthKbps, downlinkBandwidthKbps)); } private boolean isBandwidthSourceKey(String source) { Loading Loading @@ -3016,6 +3045,15 @@ public class DataConnection extends StateMachine { retVal = HANDLED; break; } case EVENT_LINK_BANDWIDTH_ESTIMATOR_UPDATE: { Pair<Integer, Integer> pair = (Pair<Integer, Integer>) msg.obj; if (isBandwidthSourceKey( DctConstants.BANDWIDTH_SOURCE_BANDWIDTH_ESTIMATOR_KEY)) { updateLinkBandwidthsFromBandwidthEstimator(pair.first, pair.second); } retVal = HANDLED; break; } case EVENT_REEVALUATE_RESTRICTED_STATE: { // If the network was restricted, and now it does not need to be restricted // anymore, we should add the NET_CAPABILITY_NOT_RESTRICTED capability. Loading src/java/com/android/internal/telephony/dataconnection/DcTracker.java +4 −0 Original line number Diff line number Diff line Loading @@ -4099,6 +4099,10 @@ public class DcTracker extends Handler { for (DataConnection dc : mDataConnections.values()) { dc.sendMessage(DataConnection.EVENT_CARRIER_CONFIG_LINK_BANDWIDTHS_CHANGED); } if (mPhone.getLinkBandwidthEstimator() != null) { mPhone.getLinkBandwidthEstimator().sendMessage(obtainMessage( LinkBandwidthEstimator.MSG_CARRIER_CONFIG_LINK_BANDWIDTHS_CHANGED)); } } /** Loading src/java/com/android/internal/telephony/dataconnection/LinkBandwidthEstimator.java +642 −73 File changed.Preview size limit exceeded, changes collapsed. Show changes tests/telephonytests/src/com/android/internal/telephony/TelephonyTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -566,6 +566,7 @@ public abstract class TelephonyTest { doReturn(mSmsStats).when(mPhone).getSmsStats(); doReturn(mImsStats).when(mImsPhone).getImsStats(); mIccSmsInterfaceManager.mDispatchersController = mSmsDispatchersController; doReturn(mLinkBandwidthEstimator).when(mPhone).getLinkBandwidthEstimator(); //mUiccController doReturn(mUiccCardApplication3gpp).when(mUiccController).getUiccCardApplication(anyInt(), Loading Loading
src/java/com/android/internal/telephony/Phone.java +13 −0 Original line number Diff line number Diff line Loading @@ -4750,6 +4750,13 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { return Collections.emptyList(); } /** * Return link bandwidth estimator */ public LinkBandwidthEstimator getLinkBandwidthEstimator() { return mLinkBandwidthEstimator; } public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.println("Phone: subId=" + getSubId()); pw.println(" mPhoneId=" + mPhoneId); Loading Loading @@ -4926,6 +4933,12 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { pw.println("++++++++++++++++++++++++++++++++"); } if (getLinkBandwidthEstimator() != null) { pw.println("LinkBandwidthEstimator:"); getLinkBandwidthEstimator().dump(fd, pw, args); pw.println("++++++++++++++++++++++++++++++++"); } pw.println("Phone Local Log: "); if (mLocalLog != null) { try { Loading
src/java/com/android/internal/telephony/dataconnection/DataConnection.java +54 −16 Original line number Diff line number Diff line Loading @@ -373,7 +373,8 @@ public class DataConnection extends StateMachine { static final int EVENT_START_HANDOVER_ON_TARGET = BASE + 36; static final int EVENT_ALLOCATE_PDU_SESSION_ID = BASE + 37; static final int EVENT_RELEASE_PDU_SESSION_ID = BASE + 38; private static final int CMD_TO_STRING_COUNT = EVENT_RELEASE_PDU_SESSION_ID - BASE + 1; static final int EVENT_LINK_BANDWIDTH_ESTIMATOR_UPDATE = BASE + 39; private static final int CMD_TO_STRING_COUNT = EVENT_LINK_BANDWIDTH_ESTIMATOR_UPDATE - BASE + 1; private static String[] sCmdToString = new String[CMD_TO_STRING_COUNT]; static { Loading Loading @@ -423,6 +424,8 @@ public class DataConnection extends StateMachine { sCmdToString[EVENT_START_HANDOVER_ON_TARGET - BASE] = "EVENT_START_HANDOVER_ON_TARGET"; sCmdToString[EVENT_ALLOCATE_PDU_SESSION_ID - BASE] = "EVENT_ALLOCATE_PDU_SESSION_ID"; sCmdToString[EVENT_RELEASE_PDU_SESSION_ID - BASE] = "EVENT_RELEASE_PDU_SESSION_ID"; sCmdToString[EVENT_LINK_BANDWIDTH_ESTIMATOR_UPDATE - BASE] = "EVENT_LINK_BANDWIDTH_ESTIMATOR_UPDATE"; } // Convert cmd to string or null if unknown static String cmdToString(int cmd) { Loading Loading @@ -1515,7 +1518,31 @@ public class DataConnection extends StateMachine { uplinkUpdated = true; } } if (!downlinkUpdated || !uplinkUpdated) { fallBackToCarrierConfigValues(downlinkUpdated, uplinkUpdated); } if (mNetworkAgent != null) { mNetworkAgent.sendNetworkCapabilities(getNetworkCapabilities(), DataConnection.this); } } private void updateLinkBandwidthsFromBandwidthEstimator(int uplinkBandwidthKbps, int downlinkBandwidthKbps) { if (DBG) { log("updateLinkBandwidthsFromBandwidthEstimator, UL= " + uplinkBandwidthKbps + " DL= " + downlinkBandwidthKbps); } mDownlinkBandwidth = downlinkBandwidthKbps; mUplinkBandwidth = uplinkBandwidthKbps; if (mNetworkAgent != null) { mNetworkAgent.sendNetworkCapabilities(getNetworkCapabilities(), DataConnection.this); } } private void fallBackToCarrierConfigValues(boolean downlinkUpdated, boolean uplinkUpdated) { String ratName = ServiceState.rilRadioTechnologyToString(mRilRat); if (mRilRat == ServiceState.RIL_RADIO_TECHNOLOGY_LTE && isNRConnected()) { ratName = mPhone.getServiceState().getNrFrequencyRange() Loading @@ -1532,9 +1559,11 @@ public class DataConnection extends StateMachine { } } } if (mNetworkAgent != null) { mNetworkAgent.sendNetworkCapabilities(getNetworkCapabilities(), DataConnection.this); } /** Update Tx and Rx link bandwidth estimation values */ public void updateLinkBandwidthEstimation(int uplinkBandwidthKbps, int downlinkBandwidthKbps) { sendMessage(DataConnection.EVENT_LINK_BANDWIDTH_ESTIMATOR_UPDATE, new Pair<Integer, Integer>(uplinkBandwidthKbps, downlinkBandwidthKbps)); } private boolean isBandwidthSourceKey(String source) { Loading Loading @@ -3016,6 +3045,15 @@ public class DataConnection extends StateMachine { retVal = HANDLED; break; } case EVENT_LINK_BANDWIDTH_ESTIMATOR_UPDATE: { Pair<Integer, Integer> pair = (Pair<Integer, Integer>) msg.obj; if (isBandwidthSourceKey( DctConstants.BANDWIDTH_SOURCE_BANDWIDTH_ESTIMATOR_KEY)) { updateLinkBandwidthsFromBandwidthEstimator(pair.first, pair.second); } retVal = HANDLED; break; } case EVENT_REEVALUATE_RESTRICTED_STATE: { // If the network was restricted, and now it does not need to be restricted // anymore, we should add the NET_CAPABILITY_NOT_RESTRICTED capability. Loading
src/java/com/android/internal/telephony/dataconnection/DcTracker.java +4 −0 Original line number Diff line number Diff line Loading @@ -4099,6 +4099,10 @@ public class DcTracker extends Handler { for (DataConnection dc : mDataConnections.values()) { dc.sendMessage(DataConnection.EVENT_CARRIER_CONFIG_LINK_BANDWIDTHS_CHANGED); } if (mPhone.getLinkBandwidthEstimator() != null) { mPhone.getLinkBandwidthEstimator().sendMessage(obtainMessage( LinkBandwidthEstimator.MSG_CARRIER_CONFIG_LINK_BANDWIDTHS_CHANGED)); } } /** Loading
src/java/com/android/internal/telephony/dataconnection/LinkBandwidthEstimator.java +642 −73 File changed.Preview size limit exceeded, changes collapsed. Show changes
tests/telephonytests/src/com/android/internal/telephony/TelephonyTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -566,6 +566,7 @@ public abstract class TelephonyTest { doReturn(mSmsStats).when(mPhone).getSmsStats(); doReturn(mImsStats).when(mImsPhone).getImsStats(); mIccSmsInterfaceManager.mDispatchersController = mSmsDispatchersController; doReturn(mLinkBandwidthEstimator).when(mPhone).getLinkBandwidthEstimator(); //mUiccController doReturn(mUiccCardApplication3gpp).when(mUiccController).getUiccCardApplication(anyInt(), Loading