Merge "Do not use mock(WifiManager.class) in tests"
diff --git a/Android.bp b/Android.bp
index 5be7de4..4a118cb 100644
--- a/Android.bp
+++ b/Android.bp
@@ -31,7 +31,6 @@
         "captiveportal-lib",
     ],
     manifest: "AndroidManifest.xml",
-    plugins: ["java_api_finder"],
     lint: { strict_updatability_linting: true },
     optimize: {
         ignore_warnings: false,
diff --git a/res/values-en-rCA/strings.xml b/res/values-en-rCA/strings.xml
index e2cd23b..b0baf18 100644
--- a/res/values-en-rCA/strings.xml
+++ b/res/values-en-rCA/strings.xml
@@ -6,7 +6,7 @@
     <string name="action_do_not_use_network" msgid="6324702363356892396">"Do not use this network"</string>
     <string name="action_bar_label" msgid="2023171629563754892">"Sign in to network"</string>
     <string name="action_bar_title" msgid="2566334512545554724">"Sign in to %1$s"</string>
-    <string name="ssl_error_warning" msgid="494203210316238046">"The network that you’re trying to join has security issues."</string>
+    <string name="ssl_error_warning" msgid="494203210316238046">"The network you’re trying to join has security issues."</string>
     <string name="ssl_error_example" msgid="4574594291839092653">"For example, the login page may not belong to the organization shown."</string>
     <string name="no_bypass_error_vpnwarning" msgid="5263739853101734851">"Additionally, it is not possible to bypass this error because the device is currently running a VPN."</string>
     <string name="error_continue_via_browser" msgid="7091550471744444659">"Continue anyway via browser"</string>
@@ -19,7 +19,7 @@
     <string name="ssl_error_unknown" msgid="3751419329218834886">"Unknown certificate error."</string>
     <string name="ssl_security_warning_title" msgid="7912335118289529802">"Security warning"</string>
     <string name="ssl_error_view_certificate" msgid="3447891108083278449">"View certificate"</string>
-    <string name="custom_scheme_warning" msgid="1809266150423969087">"The network that you are trying to join is requesting to open another application."</string>
+    <string name="custom_scheme_warning" msgid="1809266150423969087">"The network you are trying to join is requesting to open another application."</string>
     <string name="custom_scheme_example" msgid="7126568152528588592">"For example, the login page may require a specific application for authentication"</string>
     <string name="ok" msgid="6584612582120777209">"OK"</string>
     <string name="page_info_address" msgid="1290683284404217554">"Address:"</string>
@@ -27,7 +27,7 @@
     <string name="downloading_paramfile" msgid="685182551665849043">"Downloading %1$s"</string>
     <string name="download_completed" msgid="5430865338124330584">"Download completed"</string>
     <string name="error_downloading_paramfile" msgid="2431082160412515409">"Could not download %1$s"</string>
-    <string name="channel_name_downloads" msgid="8446786286617933444">"Download"</string>
+    <string name="channel_name_downloads" msgid="8446786286617933444">"Downloads"</string>
     <string name="channel_description_downloads" msgid="8751992699855833481">"Notifications showing completed or cancelled downloads"</string>
     <string name="channel_name_download_progress" msgid="6805362260479605374">"Download progress"</string>
     <string name="channel_description_download_progress" msgid="5788105841492070647">"Notifications showing the progress of file downloads"</string>
diff --git a/res/values-ne/strings.xml b/res/values-ne/strings.xml
index 1b38521..bbeeb12 100644
--- a/res/values-ne/strings.xml
+++ b/res/values-ne/strings.xml
@@ -20,7 +20,7 @@
     <string name="ssl_security_warning_title" msgid="7912335118289529802">"सुरक्षासम्बन्धी चेतावनी"</string>
     <string name="ssl_error_view_certificate" msgid="3447891108083278449">"प्रमाणपत्र हेर्नुहोस्‌"</string>
     <string name="custom_scheme_warning" msgid="1809266150423969087">"तपाईं जोडिन खोजिरहनुभएको नेटवर्कले अर्को एप खोल्न अनुरोध गरिरहेको छ।"</string>
-    <string name="custom_scheme_example" msgid="7126568152528588592">"उदाहरणका लागि, लग इन पृष्ठले कुनै निश्चित अनुप्रयोगमार्फत परिचय प्रमाणित गर्न आवश्यकता जनाउन सक्छ"</string>
+    <string name="custom_scheme_example" msgid="7126568152528588592">"उदाहरणका लागि, लग इन पृष्ठले कुनै निश्चित एपमार्फत परिचय प्रमाणित गर्न आवश्यकता जनाउन सक्छ"</string>
     <string name="ok" msgid="6584612582120777209">"ठिक छ"</string>
     <string name="page_info_address" msgid="1290683284404217554">"ठेगाना:"</string>
     <string name="page_info" msgid="46593086046896385">"पृष्ठको जानकारी"</string>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 3586fba..bf0241e 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1,7 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-
-    <string name="app_name">CaptivePortalLogin</string>
+    <!-- When the user connects to a network that has a captive portal (for example the login page
+    of some coffee shop wifi), the system uses an integrated app to show the user the login page.
+    This is the name of this app. It should be translated in each language (not used as-is). -->
+    <string name="app_name">Captive Portal Login</string>
     <string name="action_use_network">Use this network as is</string>
     <string name="action_do_not_use_network">Do not use this network</string>
     <string name="action_bar_label">Sign in to network</string>
diff --git a/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java b/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java
index 3cd696c..64f7ce5 100755
--- a/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java
+++ b/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java
@@ -115,8 +115,6 @@
     public static final String HTTP_LOCATION_HEADER_NAME = "Location";
     private static final String DEFAULT_CAPTIVE_PORTAL_HTTP_URL =
             "http://connectivitycheck.gstatic.com/generate_204";
-    public static final String DISMISS_PORTAL_IN_VALIDATED_NETWORK =
-            "dismiss_portal_in_validated_network";
     // This should match the FileProvider authority specified in the app manifest.
     private static final String FILE_PROVIDER_AUTHORITY =
             "com.android.captiveportallogin.fileprovider";
diff --git a/tests/src/com/android/captiveportallogin/CaptivePortalLoginActivityTest.java b/tests/src/com/android/captiveportallogin/CaptivePortalLoginActivityTest.java
index 6d29b34..230acbe 100644
--- a/tests/src/com/android/captiveportallogin/CaptivePortalLoginActivityTest.java
+++ b/tests/src/com/android/captiveportallogin/CaptivePortalLoginActivityTest.java
@@ -369,8 +369,7 @@
         Intents.init();
     }
 
-    // TODO (b/244275469): figure out why first test is slow to start and revert 10min timeout
-    @Test(timeout = 600_000L)
+    @Test
     public void testonCreateWithNullCaptivePortal() throws Exception {
         final Context ctx = getInstrumentation().getContext();
         final Intent intent = new Intent(ctx, InstrumentedCaptivePortalLoginActivity.class)
@@ -431,8 +430,7 @@
         doReturn(vpnCapabilities).when(sConnectivityManager).getNetworkCapabilities(network2);
     }
 
-    // TODO (b/244275469): figure out why first test is slow to start and revert 10min timeout
-    @Test(timeout = 600_000L)
+    @Test
     public void testHasVpnNetwork() throws Exception {
         initActivity(TEST_URL);
         // Test non-vpn case.
@@ -444,8 +442,7 @@
         mActivityScenario.onActivity(activity -> assertTrue(activity.hasVpnNetwork()));
     }
 
-    // TODO (b/244275469): figure out why first test is slow to start and revert 10min timeout
-    @Test(timeout = 600_000L)
+    @Test
     public void testIsAlwaysOnVpnEnabled() throws Exception {
         initActivity(TEST_URL);
         doReturn(false).when(sMockDevicePolicyManager).isAlwaysOnVpnLockdownEnabled(any());
@@ -478,8 +475,7 @@
                         (useVpnMatcher ? vpnMatcher : linkMatcher))));
     }
 
-    // TODO (b/244275469): figure out why first test is slow to start and revert 10min timeout
-    @Test(timeout = 600_000L) @SdkSuppress(maxSdkVersion = Build.VERSION_CODES.Q)
+    @Test @SdkSuppress(maxSdkVersion = Build.VERSION_CODES.Q)
     public void testVpnMsgOrLinkToBrowser_BeforeR() throws Exception {
         // Before Android R, CaptivePortalLogin cannot call isAlwaysOnVpnLockdownEnabled() due to
         // permission denied. So CaptivePortalLogin doesn't know the status of VPN always-on, and it
@@ -487,8 +483,7 @@
         runVpnMsgOrLinkToBrowser(false /* useVpnMatcher */);
     }
 
-    // TODO (b/244275469): figure out why first test is slow to start and revert 10min timeout
-    @Test(timeout = 600_000L) @SdkSuppress(minSdkVersion = Build.VERSION_CODES.R)
+    @Test @SdkSuppress(minSdkVersion = Build.VERSION_CODES.R)
     public void testVpnMsgOrLinkToBrowser() throws Exception {
         // After Android R(including), DevicePolicyManager allows the caller who has the
         // PERMISSION_MAINLINE_NETWORK_STACK can call the isAlwaysOnVpnLockdownEnabled() to get the
@@ -534,8 +529,7 @@
         }
     }
 
-    // TODO (b/244275469): figure out why first test is slow to start and revert 10min timeout
-    @Test(timeout = 600_000L) @SdkSuppress(minSdkVersion = Build.VERSION_CODES.R)
+    @Test @SdkSuppress(minSdkVersion = Build.VERSION_CODES.R)
     public void testNetworkCapabilitiesUpdate_RAndLater() throws Exception {
         initActivity(TEST_URL);
         // NetworkCapabilities updates w/o NET_CAPABILITY_VALIDATED.
@@ -552,8 +546,7 @@
         waitForDestroyedState();
     }
 
-    // TODO (b/244275469): figure out why first test is slow to start and revert 10min timeout
-    @Test(timeout = 600_000L) @SdkSuppress(maxSdkVersion = Build.VERSION_CODES.Q)
+    @Test @SdkSuppress(maxSdkVersion = Build.VERSION_CODES.Q)
     public void testNetworkCapabilitiesUpdate_Q() throws Exception {
         initActivity(TEST_URL);
         final NetworkCapabilities nc = new NetworkCapabilities();
@@ -578,8 +571,7 @@
         return server;
     }
 
-    // TODO (b/244275469): figure out why first test is slow to start and revert 10min timeout
-    @Test(timeout = 600_000L)
+    @Test
     public void testTelScheme() throws Exception {
         final String telUri = "tel:0123456789";
         final HttpServer server = runCustomSchemeTest(telUri);
@@ -591,8 +583,7 @@
         server.stop();
     }
 
-    // TODO (b/244275469): figure out why first test is slow to start and revert 10min timeout
-    @Test(timeout = 600_000L)
+    @Test
     public void testSmsScheme() throws Exception {
         final String telUri = "sms:0123456789";
         final HttpServer server = runCustomSchemeTest(telUri);
@@ -604,8 +595,7 @@
         server.stop();
     }
 
-    // TODO (b/244275469): figure out why first test is slow to start and revert 10min timeout
-    @Test(timeout = 600_000L)
+    @Test
     public void testUnsupportedScheme() throws Exception {
         final HttpServer server = runCustomSchemeTest("mailto:test@example.com");
         assertEquals(0, Intents.getIntents().size());
@@ -635,8 +625,7 @@
         server.stop();
     }
 
-    // TODO (b/244275469): figure out why first test is slow to start and revert 10min timeout
-    @Test(timeout = 600_000L)
+    @Test
     public void testDownload() throws Exception {
         // Setup the server with a single link on the portal page, leading to a download
         final HttpServer server = new HttpServer();
@@ -689,8 +678,7 @@
         server.stop();
     }
 
-    // TODO (b/244275469): figure out why first test is slow to start and revert 10min timeout
-    @Test(timeout = 600_000L)
+    @Test
     public void testVenueFriendlyNameTitle() throws Exception {
         assumeTrue(isAtLeastS());
         final LinkProperties linkProperties = new LinkProperties();
@@ -718,8 +706,7 @@
                         TEST_FRIENDLY_NAME), activity.getActionBar().getTitle()));
     }
 
-    // TODO (b/244275469): figure out why first test is slow to start and revert 10min timeout
-    @Test(timeout = 600_000L) @SdkSuppress(maxSdkVersion = Build.VERSION_CODES.Q)
+    @Test @SdkSuppress(maxSdkVersion = Build.VERSION_CODES.Q)
     public void testWifiSsid_Q() throws Exception {
         configNonVpnNetwork();
         initActivity("https://portal.example.com/");
@@ -730,8 +717,7 @@
 
     }
 
-    // TODO (b/244275469): figure out why first test is slow to start and revert 10min timeout
-    @Test(timeout = 600_000L) @SdkSuppress(minSdkVersion = Build.VERSION_CODES.R)
+    @Test @SdkSuppress(minSdkVersion = Build.VERSION_CODES.R)
     public void testWifiSsid() throws Exception {
         configNonVpnNetwork();
         initActivity("https://portal.example.com/");
@@ -895,8 +881,7 @@
         return messageFuture;
     }
 
-    // TODO (b/244275469): figure out why first test is slow to start and revert 10min timeout
-    @Test(timeout = 600_000L)
+    @Test
     public void testDirectlyOpen_onCreateDeleteFile() throws Exception {
         final String linkIdDownload = "download";
         final HttpServer server = prepareTestDirectlyOpen(linkIdDownload, "dl",
@@ -919,8 +904,7 @@
         server.stop();
     }
 
-    // TODO (b/244275469): figure out why first test is slow to start and revert 10min timeout
-    @Test(timeout = 600_000L)
+    @Test
     public void testDirectlyOpen_onDownloadAborted() throws Exception {
         initActivity(TEST_URL);
         final Uri mockFile = Uri.parse("content://mockdata");
@@ -935,8 +919,7 @@
 
     }
 
-    // TODO (b/244275469): figure out why first test is slow to start and revert 10min timeout
-    @Test(timeout = 600_000L)
+    @Test
     public void testDirectlyOpen_taskCancelToast() throws Exception {
         final String linkIdDownload = "download";
         final String expectMsg = getInstrumentation().getContext().getString(
@@ -955,8 +938,7 @@
         server.stop();
     }
 
-    // TODO (b/244275469): figure out why first test is slow to start and revert 10min timeout
-    @Test(timeout = 600_000L)
+    @Test
     public void testDirectlyOpen_cancelPendingTask() throws Exception {
         final String linkIdDownload = "download";
         final String downloadQuery = "dl";
@@ -991,8 +973,7 @@
         server.stop();
     }
 
-    // TODO (b/244275469): figure out why first test is slow to start and revert 10min timeout
-    @Test(timeout = 600_000L)
+    @Test
     public void testDirectlyOpen_successfullyDownload() throws Exception {
         final String linkIdDownload = "download";
         final String mimeType = TEST_WIFI_CONFIG_TYPE;