Merge "[DO NOT MERGE] Parameterize compat tests, so tests consistently pass on sc-v2" into android12L-tests-dev
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/bokeh/CameraBokehActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/bokeh/CameraBokehActivity.java
index 3f27a2d..55791c6 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/bokeh/CameraBokehActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/bokeh/CameraBokehActivity.java
@@ -59,6 +59,7 @@
 import android.view.View;
 import android.view.Surface;
 import android.view.TextureView;
+import android.widget.Adapter;
 import android.widget.AdapterView;
 import android.widget.ArrayAdapter;
 import android.widget.Button;
@@ -98,6 +99,7 @@
                         1f,    1.772f,        0f, 0f, -226.816f,
                         0f,        0f,        0f, 1f,        0f
                     });
+    private static final String CAMERA_ID_PREFIX = "Camera ";
 
     private TextureView mPreviewView;
     private SurfaceTexture mPreviewTexture;
@@ -262,7 +264,7 @@
         String[] cameraNames = new String[cameraIdSet.size()];
         int i = 0;
         for (String id : cameraIdSet) {
-            cameraNames[i++] = "Camera " + id;
+            cameraNames[i++] = CAMERA_ID_PREFIX + id;
         }
         mCameraSpinner = (Spinner) findViewById(R.id.cameras_selection);
         mCameraSpinner.setAdapter(
@@ -592,11 +594,10 @@
         shutdownCamera();
 
         mCurrentCameraIndex = index;
+        Adapter adapter = mCameraSpinner.getAdapter();
+        String idDisplayed = (String) adapter.getItem(index);
+        mCameraId = idDisplayed.substring(CAMERA_ID_PREFIX.length());
 
-        Set<String> cameraIdSet = mTestCases.keySet();
-        List<String> stringsList = new ArrayList<>(cameraIdSet);
-
-        mCameraId = stringsList.get(index);
         try {
             mCameraCharacteristics = mCameraManager.getCameraCharacteristics(mCameraId);
             mCameraDevice = mBlockingCameraManager.openCamera(mCameraId,
@@ -761,7 +762,8 @@
 
     private void startPreview() {
         try {
-            if (mPreviewSize == null || !mPreviewSize.equals(mNextCombination.mPreviewSize)) {
+            if (mPreviewSize == null || !mPreviewSize.equals(mNextCombination.mPreviewSize) ||
+                    mYuvImageReader == null) {
                 mPreviewSize = mNextCombination.mPreviewSize;
 
                 mYuvImageReader = ImageReader.newInstance(mPreviewSize.getWidth(),
diff --git a/tools/cts-tradefed/res/config/cts-known-failures.xml b/tools/cts-tradefed/res/config/cts-known-failures.xml
index 7d139c3..9c8b51bc 100644
--- a/tools/cts-tradefed/res/config/cts-known-failures.xml
+++ b/tools/cts-tradefed/res/config/cts-known-failures.xml
@@ -260,4 +260,7 @@
     <!-- b/203177211 -->
     <option name="compatibility:exclude-filter" value="CtsAppSecurityHostTestCases android.appsecurity.cts.ListeningPortsTest#testNoRemotelyAccessibleListeningUdpPorts" />
 
+    <!-- b/223640691 -->
+    <option name="compatibility:exclude-filter" value="CtsInputMethodTestCases android.view.inputmethod.cts.KeyboardVisibilityControlTest#testRestoreImeVisibility" />
+
 </configuration>