From 23710588f9069743387fc7f870fbeeb27978f188 Mon Sep 17 00:00:00 2001 From: Luke Huang Date: Wed, 10 Jun 2020 00:45:26 +0800 Subject: [PATCH] Fix MultinetworkApiTest fail problem in instant mode CtsNetUtils#storePrivateDnsSetting might require WRITE_SECURE_SETTINGS permission to run. Therefore, move it from setUp to only belong to the required test case. Bug: 158538281 Test: run cts --include-filter "arm64-v8a CtsNetTestCases[instant] android.net.cts.MultinetworkApiTest" Change-Id: I8ecadd134824a4023a3c6e173d52ba088d46b103 --- tests/cts/net/src/android/net/cts/MultinetworkApiTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cts/net/src/android/net/cts/MultinetworkApiTest.java b/tests/cts/net/src/android/net/cts/MultinetworkApiTest.java index 985e313a92..6d3db8912d 100644 --- a/tests/cts/net/src/android/net/cts/MultinetworkApiTest.java +++ b/tests/cts/net/src/android/net/cts/MultinetworkApiTest.java @@ -68,7 +68,6 @@ public class MultinetworkApiTest extends AndroidTestCase { mCM = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE); mCR = getContext().getContentResolver(); mCtsNetUtils = new CtsNetUtils(getContext()); - mCtsNetUtils.storePrivateDnsSetting(); } @Override @@ -223,6 +222,7 @@ public class MultinetworkApiTest extends AndroidTestCase { @AppModeFull(reason = "WRITE_SECURE_SETTINGS permission can't be granted to instant apps") public void testResNApiNXDomainPrivateDns() throws InterruptedException { + mCtsNetUtils.storePrivateDnsSetting(); // Enable private DNS strict mode and set server to dns.google before doing NxDomain test. // b/144521720 try {