Loading AndroidManifest.xml +2 −2 Original line number Original line Diff line number Diff line Loading @@ -19,8 +19,8 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.networkstack" package="com.android.networkstack" android:sharedUserId="android.uid.networkstack" android:sharedUserId="android.uid.networkstack" android:versionCode="300900200" android:versionCode="300900300" android:versionName="r_aml_300900200" android:versionName="r_aml_300900300" > > <!-- Permissions must be defined here, and not in the base manifest, as the network stack <!-- Permissions must be defined here, and not in the base manifest, as the network stack running in the system server process does not need any permission, and having privileged running in the system server process does not need any permission, and having privileged Loading src/android/net/captiveportal/CapportApiProbeResult.java +3 −2 Original line number Original line Diff line number Diff line Loading @@ -25,11 +25,12 @@ import com.android.networkstack.apishim.common.CaptivePortalDataShim; * @hide * @hide */ */ public class CapportApiProbeResult extends CaptivePortalProbeResult { public class CapportApiProbeResult extends CaptivePortalProbeResult { @NonNull // CaptivePortalData may be null if the capport API does not send any valid reply. @Nullable private final CaptivePortalDataShim mCapportData; private final CaptivePortalDataShim mCapportData; public CapportApiProbeResult(@NonNull CaptivePortalProbeResult result, public CapportApiProbeResult(@NonNull CaptivePortalProbeResult result, @NonNull CaptivePortalDataShim capportData) { @Nullable CaptivePortalDataShim capportData) { this(result.mHttpResponseCode, result.redirectUrl, result.detectUrl, capportData, this(result.mHttpResponseCode, result.redirectUrl, result.detectUrl, capportData, result.probeType); result.probeType); } } Loading src/com/android/server/connectivity/NetworkMonitor.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -2628,7 +2628,7 @@ public class NetworkMonitor extends StateMachine { validationLog("Missing user-portal-url from capport response"); validationLog("Missing user-portal-url from capport response"); return new CapportApiProbeResult( return new CapportApiProbeResult( sendDnsAndHttpProbes(mProxy, mUrl, ValidationProbeEvent.PROBE_HTTP), sendDnsAndHttpProbes(mProxy, mUrl, ValidationProbeEvent.PROBE_HTTP), capportData); null /* capportData */); } } final String loginUrlString = capportData.getUserPortalUrl().toString(); final String loginUrlString = capportData.getUserPortalUrl().toString(); // Starting from R (where CaptivePortalData was introduced), the captive portal app // Starting from R (where CaptivePortalData was introduced), the captive portal app Loading tests/unit/src/com/android/server/connectivity/NetworkMonitorTest.java +23 −1 Original line number Original line Diff line number Diff line Loading @@ -1152,7 +1152,29 @@ public class NetworkMonitorTest { } } @Test @Test public void testIsCaptivePortal_CapportApiIsPortal() throws Exception { public void testIsCaptivePortal_CapportApiIsPortalWithNullPortalUrl() throws Exception { assumeTrue(CaptivePortalDataShimImpl.isSupported()); setSslException(mHttpsConnection); final long bytesRemaining = 10_000L; final long secondsRemaining = 500L; // Set content without partal url. setApiContent(mCapportApiConnection, "{'captive': true," + "'venue-info-url': '" + TEST_VENUE_INFO_URL + "'," + "'bytes-remaining': " + bytesRemaining + "," + "'seconds-remaining': " + secondsRemaining + "}"); setPortal302(mHttpConnection); runNetworkTest(makeCapportLPs(), CELL_METERED_CAPABILITIES, VALIDATION_RESULT_PORTAL, 0 /* probesSucceeded*/, TEST_LOGIN_URL); verify(mCapportApiConnection).getResponseCode(); verify(mHttpConnection, times(1)).getResponseCode(); verify(mCallbacks, never()).notifyCaptivePortalDataChanged(any()); } @Test public void testIsCaptivePortal_CapportApiIsPortalWithValidPortalUrl() throws Exception { assumeTrue(CaptivePortalDataShimImpl.isSupported()); assumeTrue(CaptivePortalDataShimImpl.isSupported()); setSslException(mHttpsConnection); setSslException(mHttpsConnection); final long bytesRemaining = 10_000L; final long bytesRemaining = 10_000L; Loading Loading
AndroidManifest.xml +2 −2 Original line number Original line Diff line number Diff line Loading @@ -19,8 +19,8 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.networkstack" package="com.android.networkstack" android:sharedUserId="android.uid.networkstack" android:sharedUserId="android.uid.networkstack" android:versionCode="300900200" android:versionCode="300900300" android:versionName="r_aml_300900200" android:versionName="r_aml_300900300" > > <!-- Permissions must be defined here, and not in the base manifest, as the network stack <!-- Permissions must be defined here, and not in the base manifest, as the network stack running in the system server process does not need any permission, and having privileged running in the system server process does not need any permission, and having privileged Loading
src/android/net/captiveportal/CapportApiProbeResult.java +3 −2 Original line number Original line Diff line number Diff line Loading @@ -25,11 +25,12 @@ import com.android.networkstack.apishim.common.CaptivePortalDataShim; * @hide * @hide */ */ public class CapportApiProbeResult extends CaptivePortalProbeResult { public class CapportApiProbeResult extends CaptivePortalProbeResult { @NonNull // CaptivePortalData may be null if the capport API does not send any valid reply. @Nullable private final CaptivePortalDataShim mCapportData; private final CaptivePortalDataShim mCapportData; public CapportApiProbeResult(@NonNull CaptivePortalProbeResult result, public CapportApiProbeResult(@NonNull CaptivePortalProbeResult result, @NonNull CaptivePortalDataShim capportData) { @Nullable CaptivePortalDataShim capportData) { this(result.mHttpResponseCode, result.redirectUrl, result.detectUrl, capportData, this(result.mHttpResponseCode, result.redirectUrl, result.detectUrl, capportData, result.probeType); result.probeType); } } Loading
src/com/android/server/connectivity/NetworkMonitor.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -2628,7 +2628,7 @@ public class NetworkMonitor extends StateMachine { validationLog("Missing user-portal-url from capport response"); validationLog("Missing user-portal-url from capport response"); return new CapportApiProbeResult( return new CapportApiProbeResult( sendDnsAndHttpProbes(mProxy, mUrl, ValidationProbeEvent.PROBE_HTTP), sendDnsAndHttpProbes(mProxy, mUrl, ValidationProbeEvent.PROBE_HTTP), capportData); null /* capportData */); } } final String loginUrlString = capportData.getUserPortalUrl().toString(); final String loginUrlString = capportData.getUserPortalUrl().toString(); // Starting from R (where CaptivePortalData was introduced), the captive portal app // Starting from R (where CaptivePortalData was introduced), the captive portal app Loading
tests/unit/src/com/android/server/connectivity/NetworkMonitorTest.java +23 −1 Original line number Original line Diff line number Diff line Loading @@ -1152,7 +1152,29 @@ public class NetworkMonitorTest { } } @Test @Test public void testIsCaptivePortal_CapportApiIsPortal() throws Exception { public void testIsCaptivePortal_CapportApiIsPortalWithNullPortalUrl() throws Exception { assumeTrue(CaptivePortalDataShimImpl.isSupported()); setSslException(mHttpsConnection); final long bytesRemaining = 10_000L; final long secondsRemaining = 500L; // Set content without partal url. setApiContent(mCapportApiConnection, "{'captive': true," + "'venue-info-url': '" + TEST_VENUE_INFO_URL + "'," + "'bytes-remaining': " + bytesRemaining + "," + "'seconds-remaining': " + secondsRemaining + "}"); setPortal302(mHttpConnection); runNetworkTest(makeCapportLPs(), CELL_METERED_CAPABILITIES, VALIDATION_RESULT_PORTAL, 0 /* probesSucceeded*/, TEST_LOGIN_URL); verify(mCapportApiConnection).getResponseCode(); verify(mHttpConnection, times(1)).getResponseCode(); verify(mCallbacks, never()).notifyCaptivePortalDataChanged(any()); } @Test public void testIsCaptivePortal_CapportApiIsPortalWithValidPortalUrl() throws Exception { assumeTrue(CaptivePortalDataShimImpl.isSupported()); assumeTrue(CaptivePortalDataShimImpl.isSupported()); setSslException(mHttpsConnection); setSslException(mHttpsConnection); final long bytesRemaining = 10_000L; final long bytesRemaining = 10_000L; Loading