Merge changes I5125755b,I312e55a5 into sc-dev

* changes:
  Updating tests to honor per-app TRACK_DEFAULT
  Changing per-app default request to TRACK_DEFAULT
This commit is contained in:
James Mattis
2021-04-23 14:42:51 +00:00
committed by Android (Google) Code Review
2 changed files with 12 additions and 8 deletions

View File

@@ -10479,7 +10479,7 @@ public class ConnectivityServiceTest {
assertTrue(mRequests.get(0).hasCapability(NET_CAPABILITY_VALIDATED));
assertTrue(mRequests.get(1).isRequest());
assertTrue(mRequests.get(1).hasCapability(NET_CAPABILITY_OEM_PAID));
assertTrue(mRequests.get(2).isRequest());
assertEquals(NetworkRequest.Type.TRACK_DEFAULT, mRequests.get(2).type);
assertTrue(mService.getDefaultRequest().networkCapabilities.equalsNetCapabilities(
mRequests.get(2).networkCapabilities));
}
@@ -11693,10 +11693,12 @@ public class ConnectivityServiceTest {
mServiceContext, "internetFactory", internetFilter, mCsHandlerThread);
internetFactory.setScoreFilter(40);
internetFactory.register();
// Default internet request & 3rd (fallback) request in OEM_PAID NRI. The unmetered request
// is never sent to factories (it's a LISTEN, not requestable) and the OEM_PAID request
// doesn't match the internetFactory filter.
internetFactory.expectRequestAdds(2);
// Default internet request only. The unmetered request is never sent to factories (it's a
// LISTEN, not requestable). The 3rd (fallback) request in OEM_PAID NRI is TRACK_DEFAULT
// which is also not sent to factories. Finally, the OEM_PAID request doesn't match the
// internetFactory filter.
internetFactory.expectRequestAdds(1);
internetFactory.assertRequestCountEquals(1);
NetworkCapabilities oemPaidFilter = new NetworkCapabilities()
.addCapability(NET_CAPABILITY_INTERNET)
@@ -11719,7 +11721,7 @@ public class ConnectivityServiceTest {
expectNoRequestChanged(oemPaidFactory);
oemPaidFactory.assertRequestCountEquals(1);
// The internet factory however is outscored, and should lose its requests.
internetFactory.expectRequestRemoves(2);
internetFactory.expectRequestRemove();
internetFactory.assertRequestCountEquals(0);
final NetworkCapabilities oemPaidNc = new NetworkCapabilities();