Merge "[DU04-4]Appropriate changes to the NetworkPolicyManager API" am: cd9fe9b220

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2022895

Change-Id: I4a7ac07e48f726fa090d92d9d5e2d4bec63c1f17
This commit is contained in:
Frank Li
2022-03-16 12:55:22 +00:00
committed by Automerger Merge Worker

View File

@@ -26,7 +26,7 @@ import static android.net.NetworkStats.UID_TETHERING;
import static android.net.RouteInfo.RTN_UNICAST; import static android.net.RouteInfo.RTN_UNICAST;
import static android.provider.Settings.Global.TETHER_OFFLOAD_DISABLED; import static android.provider.Settings.Global.TETHER_OFFLOAD_DISABLED;
import static com.android.modules.utils.build.SdkLevel.isAtLeastS; import static com.android.modules.utils.build.SdkLevel.isAtLeastT;
import static com.android.networkstack.tethering.OffloadController.StatsType.STATS_PER_IFACE; import static com.android.networkstack.tethering.OffloadController.StatsType.STATS_PER_IFACE;
import static com.android.networkstack.tethering.OffloadController.StatsType.STATS_PER_UID; import static com.android.networkstack.tethering.OffloadController.StatsType.STATS_PER_UID;
import static com.android.networkstack.tethering.OffloadHardwareInterface.ForwardedStats; import static com.android.networkstack.tethering.OffloadHardwareInterface.ForwardedStats;
@@ -666,10 +666,12 @@ public class OffloadControllerTest {
callback.onStoppedLimitReached(); callback.onStoppedLimitReached();
mTetherStatsProviderCb.expectNotifyStatsUpdated(); mTetherStatsProviderCb.expectNotifyStatsUpdated();
if (isAtLeastS()) { if (isAtLeastT()) {
mTetherStatsProviderCb.expectNotifyLimitReached();
} else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.S) {
mTetherStatsProviderCb.expectNotifyWarningOrLimitReached(); mTetherStatsProviderCb.expectNotifyWarningOrLimitReached();
} else { } else {
mTetherStatsProviderCb.expectLegacyNotifyLimitReached(); mTetherStatsProviderCb.expectNotifyLimitReached();
} }
} }
@@ -680,8 +682,13 @@ public class OffloadControllerTest {
final OffloadHardwareInterface.ControlCallback callback = mControlCallbackCaptor.getValue(); final OffloadHardwareInterface.ControlCallback callback = mControlCallbackCaptor.getValue();
callback.onWarningReached(); callback.onWarningReached();
mTetherStatsProviderCb.expectNotifyStatsUpdated(); mTetherStatsProviderCb.expectNotifyStatsUpdated();
if (isAtLeastT()) {
mTetherStatsProviderCb.expectNotifyWarningReached();
} else {
mTetherStatsProviderCb.expectNotifyWarningOrLimitReached(); mTetherStatsProviderCb.expectNotifyWarningOrLimitReached();
} }
}
@Test @Test
public void testAddRemoveDownstreams() throws Exception { public void testAddRemoveDownstreams() throws Exception {