Use CONNECTIVITY_INTERNAL on Q for portal URL
getCaptivePortalServerUrl requires CONNECTIVITY_INTERNAL or MAINLINE_NETWORK_STACK on Q, and NETWORK_SETTINGS or MAINLINE_NETWORK_STACK on R+. Use CONNECTIVITY_INTERNAL on Q instead of NETWORK_SETTINGS to test it. Bug: 172626873 Test: atest CtsNetTestCasesLatestSdk:ConnectivityManagerTest Change-Id: I03309de945b198ad9b40d51d799d2619bb3179ea
This commit is contained in:
parent
fcabfc688d
commit
78cb3a9de0
1 changed files with 5 additions and 1 deletions
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package android.net.cts;
|
||||
|
||||
import static android.Manifest.permission.CONNECTIVITY_INTERNAL;
|
||||
import static android.Manifest.permission.CONNECTIVITY_USE_RESTRICTED_NETWORKS;
|
||||
import static android.Manifest.permission.NETWORK_SETTINGS;
|
||||
import static android.content.pm.PackageManager.FEATURE_ETHERNET;
|
||||
|
|
@ -1517,7 +1518,10 @@ public class ConnectivityManagerTest {
|
|||
|
||||
@Test
|
||||
public void testGetCaptivePortalServerUrl() {
|
||||
final String url = runAsShell(NETWORK_SETTINGS, mCm::getCaptivePortalServerUrl);
|
||||
final String permission = Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q
|
||||
? CONNECTIVITY_INTERNAL
|
||||
: NETWORK_SETTINGS;
|
||||
final String url = runAsShell(permission, mCm::getCaptivePortalServerUrl);
|
||||
assertNotNull("getCaptivePortalServerUrl must not be null", url);
|
||||
try {
|
||||
final URL parsedUrl = new URL(url);
|
||||
|
|
|
|||
Loading…
Reference in a new issue