Merge remote-tracking branch 'goog/cw-f-dev' into fix_merger

Bug: 32849428
* goog/cw-f-dev: (122 commits)
  Fixed CTS unit tests
  Fixing layout of several test suites for round screens.
  Fix test case context which is not fully visible on wear.
  Fix build for nyc-dr1-dev
  Check that H.264 is available before checking max frame rate
  DO NOT MERGE: Bump CTS and CTS Verifier to 5.1_r14
  DO NOT MERGE: Bump CTS and CTS Verifier to 6.0_r13
  Run DynamicConfig setup twice
  DO NOT MERGE: Bump CTS and CTS Verifier to 7.0_r4
  Fix UserRestrictionsTest.testUserRestrictions_secondaryProfileOwnerOnly
  Generate and include checksum data with CTS report submissions Test: Used exploratory tests and unit tests in ChecksumReporterTest.java to verify the behavior. * All TestResults are added from an InvocationResult * Able to verify TestResult against previously calculated checksum * CRCs are created for all files in a directory including subdirectories * Checksum integrity is maintained while serializing to/from disk * When possible checksum data is compressed before report submission
  Add retry logic for adoptable storage tests
  Catch case where browser is protected by a permission
  Fix failure due to accessibility node not updated after scrolling.
  Fix DO/PO Wifi CTS
  Test: Fix testFindAll result listener not set issue
  Updating CTS Security patch to 2017-01
  DO NOT MERGE ANYWHERE: bump cts for 201701 security public bulletin
  DO NOT MERGE ANYWHERE: bump cts for 201701 security public bulletin
  CTS Test for security vulnerability fix: Effect command might allow negative indexes
  ...

Change-Id: I07b3bb0249eebcae5760d08c98cdde1ac5b01601
diff --git a/tests/cts/hostside/aidl/Android.mk b/tests/cts/hostside/aidl/Android.mk
index a7ec6ef..4aa55b6 100644
--- a/tests/cts/hostside/aidl/Android.mk
+++ b/tests/cts/hostside/aidl/Android.mk
@@ -19,4 +19,4 @@
 LOCAL_SDK_VERSION := current
 LOCAL_SRC_FILES := com/android/cts/net/hostside/IRemoteSocketFactory.aidl
 LOCAL_MODULE := CtsHostsideNetworkTestsAidl
-include $(BUILD_JAVA_LIBRARY)
+include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/cts/hostside/app/src/com/android/cts/net/hostside/VpnTest.java b/tests/cts/hostside/app/src/com/android/cts/net/hostside/VpnTest.java
index 12fe625..a8ad2b8 100755
--- a/tests/cts/hostside/app/src/com/android/cts/net/hostside/VpnTest.java
+++ b/tests/cts/hostside/app/src/com/android/cts/net/hostside/VpnTest.java
@@ -84,6 +84,11 @@
  *   https://android-review.googlesource.com/#/c/99225/
  *   https://android-review.googlesource.com/#/c/100557/
  *
+ * To ensure that the kernel has the required commits, run the kernel unit
+ * tests described at:
+ *
+ *   https://source.android.com/devices/tech/config/kernel_network_tests.html
+ *
  */
 public class VpnTest extends InstrumentationTestCase {
 
diff --git a/tests/cts/net/jni/NativeDnsJni.c b/tests/cts/net/jni/NativeDnsJni.c
index 4eb3c7a..352c0c5 100644
--- a/tests/cts/net/jni/NativeDnsJni.c
+++ b/tests/cts/net/jni/NativeDnsJni.c
@@ -126,7 +126,7 @@
         return JNI_FALSE;
     }
 
-    memset(buf, sizeof(buf), 0);
+    memset(buf, 0, sizeof(buf));
     res = getnameinfo((const struct sockaddr*)&sa6, sizeof(sa6), buf, sizeof(buf), NULL, 0, flags);
     if (res != 0) {
         ALOGD("getnameinfo(%s (GoogleDNS) ) gave error %d (%s)", GoogleDNSIpV6Address2,
diff --git a/tests/cts/net/jni/NativeMultinetworkJni.c b/tests/cts/net/jni/NativeMultinetworkJni.c
index ad56b51..6990efa 100644
--- a/tests/cts/net/jni/NativeMultinetworkJni.c
+++ b/tests/cts/net/jni/NativeMultinetworkJni.c
@@ -30,7 +30,7 @@
 #include <sys/time.h>
 #include <android/multinetwork.h>
 
-#define UNUSED(X) ((void) X)
+#define UNUSED(X) ((void) (X))
 
 static const char kHostname[] = "connectivitycheck.android.com";
 
diff --git a/tests/cts/net/src/android/net/http/cts/HttpResponseCacheTest.java b/tests/cts/net/src/android/net/http/cts/HttpResponseCacheTest.java
index 545541d..7987a50 100644
--- a/tests/cts/net/src/android/net/http/cts/HttpResponseCacheTest.java
+++ b/tests/cts/net/src/android/net/http/cts/HttpResponseCacheTest.java
@@ -38,10 +38,11 @@
 public final class HttpResponseCacheTest extends TestCase {
 
     private File cacheDir;
-    private MockWebServer server = new MockWebServer();
+    private MockWebServer server;
 
     @Override public void setUp() throws Exception {
         super.setUp();
+        server = new MockWebServer();
         String tmp = System.getProperty("java.io.tmpdir");
         cacheDir = new File(tmp, "HttpCache-" + UUID.randomUUID());
         cacheDir.mkdirs();
diff --git a/tests/cts/net/src/android/net/wifi/cts/WifiEnterpriseConfigTest.java b/tests/cts/net/src/android/net/wifi/cts/WifiEnterpriseConfigTest.java
index f3eb4e9..a074f14 100644
--- a/tests/cts/net/src/android/net/wifi/cts/WifiEnterpriseConfigTest.java
+++ b/tests/cts/net/src/android/net/wifi/cts/WifiEnterpriseConfigTest.java
@@ -532,4 +532,15 @@
         }
         return false;
     }
+
+    public void testEnterpriseConfigDoesNotPrintPassword() {
+        WifiEnterpriseConfig enterpriseConfig = new WifiEnterpriseConfig();
+        final String identity = "IdentityIsOkayToBeDisplayedHere";
+        final String password = "PasswordIsNotOkayToBeDisplayedHere";
+        enterpriseConfig.setIdentity(identity);
+        enterpriseConfig.setPassword(password);
+        final String stringRepresentation = enterpriseConfig.toString();
+        assertTrue(stringRepresentation.contains(identity));
+        assertFalse(stringRepresentation.contains(password));
+    }
 }
diff --git a/tests/cts/net/src/android/net/wifi/cts/WifiInfoTest.java b/tests/cts/net/src/android/net/wifi/cts/WifiInfoTest.java
index 8719b6b..696d215 100644
--- a/tests/cts/net/src/android/net/wifi/cts/WifiInfoTest.java
+++ b/tests/cts/net/src/android/net/wifi/cts/WifiInfoTest.java
@@ -26,6 +26,7 @@
 import android.net.wifi.WifiInfo;
 import android.net.wifi.WifiManager;
 import android.net.wifi.WifiManager.WifiLock;
+import android.net.wifi.WifiSsid;
 import android.test.AndroidTestCase;
 
 import java.util.concurrent.Callable;
@@ -123,7 +124,7 @@
         SupplicantState.isValidState(wifiInfo.getSupplicantState());
         WifiInfo.getDetailedStateOf(SupplicantState.DISCONNECTED);
         String ssid = wifiInfo.getSSID();
-        if (ssid.startsWith("0x") == false) {
+        if (!ssid.startsWith("0x") && !ssid.equals(WifiSsid.NONE)) {
             // Non-hex string should be quoted
             assertTrue(ssid.charAt(0) == '"');
             assertTrue(ssid.charAt(ssid.length() - 1) == '"');