Support reevaluation request from captive portal app

CaptivePortalLogin use similar way to validate the network as
NetworkMonitor. Provide API to reuse NetworkMonitor facilities
for consistent captive portal detection.

Bug: 134892996
Test: atest FrameworksNetTests NetworkStackTests NetworkStackNextTests
Test: manually test with captive portal Wi-Fi
Test: make system-api-stubs-docs-update-current-api \
      test-api-stubs-docs-update-current-api
Change-Id: I6f039eae7ceb18eb6c3cf15587cdc27a7fe35b00
This commit is contained in:
Chiachang Wang
2020-01-09 13:50:55 +08:00
parent c2441ee239
commit 938bfba0c3
3 changed files with 57 additions and 6 deletions

View File

@@ -43,6 +43,11 @@ public class CaptivePortalTest {
mCode = response;
}
@Override
public void appRequest(final int request) throws RemoteException {
mCode = request;
}
@Override
public void logEvent(int eventId, String packageName) throws RemoteException {
mCode = eventId;
@@ -79,6 +84,12 @@ public class CaptivePortalTest {
assertEquals(result.mCode, CaptivePortal.APP_RETURN_WANTED_AS_IS);
}
@Test
public void testReevaluateNetwork() {
final MyCaptivePortalImpl result = runCaptivePortalTest(c -> c.reevaluateNetwork());
assertEquals(result.mCode, CaptivePortal.APP_REQUEST_REEVALUATION_REQUIRED);
}
@Test
public void testLogEvent() {
final MyCaptivePortalImpl result = runCaptivePortalTest(c -> c.logEvent(