Merge "Use CONNECTIVITY_INTERNAL on Q for portal URL" am: 2a7cf08b8e am: 58ae094ec7 am: 1a7d76dba8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1490178 Change-Id: I382bdf976ef5e3635cfd7244484d279ee8263b5a
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package android.net.cts;
|
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.CONNECTIVITY_USE_RESTRICTED_NETWORKS;
|
||||||
import static android.Manifest.permission.NETWORK_SETTINGS;
|
import static android.Manifest.permission.NETWORK_SETTINGS;
|
||||||
import static android.content.pm.PackageManager.FEATURE_ETHERNET;
|
import static android.content.pm.PackageManager.FEATURE_ETHERNET;
|
||||||
@@ -1517,7 +1518,10 @@ public class ConnectivityManagerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetCaptivePortalServerUrl() {
|
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);
|
assertNotNull("getCaptivePortalServerUrl must not be null", url);
|
||||||
try {
|
try {
|
||||||
final URL parsedUrl = new URL(url);
|
final URL parsedUrl = new URL(url);
|
||||||
|
|||||||
Reference in New Issue
Block a user