Use Q permission on Q for startCaptivePortalApp

on Q startCaptivePortalApp was guarded by CONNECTIVITY_INTERNAL instead
of NETWORK_SETTINGS: change the permission adopted by shell on Q to
match the platform.

Test: atest CaptivePortalTest on a Q device
Bug: 150904735

Change-Id: I24b6907d164aba07df0f5a1a3715669e99cddd88
This commit is contained in:
Remi NGUYEN VAN
2020-05-25 18:22:22 +09:00
parent 2f5879f6c7
commit aa660b56cf

View File

@@ -16,6 +16,7 @@
package android.net.cts
import android.Manifest.permission.CONNECTIVITY_INTERNAL
import android.Manifest.permission.NETWORK_SETTINGS
import android.Manifest.permission.READ_DEVICE_CONFIG
import android.Manifest.permission.WRITE_DEVICE_CONFIG
@@ -31,6 +32,7 @@ import android.net.NetworkRequest
import android.net.Uri
import android.net.cts.util.CtsNetUtils
import android.net.wifi.WifiManager
import android.os.Build
import android.os.ConditionVariable
import android.platform.test.annotations.AppModeFull
import android.provider.DeviceConfig
@@ -164,7 +166,10 @@ class CaptivePortalTest {
"access."
assertNotEquals(network, cm.activeNetwork, wifiDefaultMessage)
doAsShell(NETWORK_SETTINGS) { cm.startCaptivePortalApp(network) }
val startPortalAppPermission =
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.Q) CONNECTIVITY_INTERNAL
else NETWORK_SETTINGS
doAsShell(startPortalAppPermission) { cm.startCaptivePortalApp(network) }
assertTrue(portalContentRequestCv.block(TEST_TIMEOUT_MS), "The captive portal login " +
"page was still not fetched ${TEST_TIMEOUT_MS}ms after startCaptivePortalApp.")