WifiManagerTest: Add test for isTdls & isStaApConcurrency supported

Bug: 150236894
Test: atest android.net.wifi.cts
Change-Id: Id532a189b0d3e6848408e7a798acda13669ffb52
diff --git a/tests/tests/net/src/android/net/wifi/cts/WifiManagerTest.java b/tests/tests/net/src/android/net/wifi/cts/WifiManagerTest.java
index 46d4e7f..2368d1b 100644
--- a/tests/tests/net/src/android/net/wifi/cts/WifiManagerTest.java
+++ b/tests/tests/net/src/android/net/wifi/cts/WifiManagerTest.java
@@ -1472,6 +1472,45 @@
         mWifiManager.isPreferredNetworkOffloadSupported();
     }
 
+    /**
+     * Tests {@link WifiManager#isTdlsSupported()} does not crash.
+     */
+    public void testIsTdlsSupported() throws Exception {
+        if (!WifiFeature.isWifiSupported(getContext())) {
+            // skip the test if WiFi is not supported
+            return;
+        }
+        mWifiManager.isTdlsSupported();
+    }
+
+    /**
+     * Tests {@link WifiManager#isStaApConcurrencySupported().
+     */
+    public void testIsStaApConcurrencySupported() throws Exception {
+        if (!WifiFeature.isWifiSupported(getContext())) {
+            // skip the test if WiFi is not supported
+            return;
+        }
+        // check that softap mode is supported by the device
+        if (!mWifiManager.isPortableHotspotSupported()) {
+            return;
+        }
+        assertTrue(mWifiManager.isWifiEnabled());
+
+        boolean isStaApConcurrencySupported = mWifiManager.isStaApConcurrencySupported();
+        // start local only hotspot.
+        TestLocalOnlyHotspotCallback callback = startLocalOnlyHotspot();
+        if (isStaApConcurrencySupported) {
+            assertTrue(mWifiManager.isWifiEnabled());
+        } else {
+            // no concurrency, wifi should be disabled.
+            assertFalse(mWifiManager.isWifiEnabled());
+        }
+        stopLocalOnlyHotspot(callback, true);
+
+        assertTrue(mWifiManager.isWifiEnabled());
+    }
+
     private static class TestTrafficStateCallback implements WifiManager.TrafficStateCallback {
         private final Object mLock;
         public boolean onStateChangedCalled = false;