diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-01-21 21:09:35 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2022-01-21 21:09:35 +0000 |
commit | 2ec105d74c718525774712ae1be6eee762834e60 (patch) | |
tree | b79345993759107071cadfcc2248e9be892970cf | |
parent | 6853682f9f56fb93562c432de94fa629f25aa622 (diff) | |
parent | b4f105bac6f18f8bcb4e5c87737086ab040c95e5 (diff) | |
download | cts-2ec105d74c718525774712ae1be6eee762834e60.tar.gz |
Merge "Snap for 8103809 from 543526f4c2fb90396c63df47d070c796aaf821ca to android12-tests-release" into android12-tests-releaseandroid-vts-12.0_r3
4 files changed, 32 insertions, 5 deletions
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/usb/device/UsbDeviceTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/usb/device/UsbDeviceTestActivity.java index faee07a36ff..e68983b2b10 100644 --- a/apps/CtsVerifier/src/com/android/cts/verifier/usb/device/UsbDeviceTestActivity.java +++ b/apps/CtsVerifier/src/com/android/cts/verifier/usb/device/UsbDeviceTestActivity.java @@ -84,6 +84,7 @@ public class UsbDeviceTestActivity extends PassFailButtons.Activity { private Thread mTestThread; private TextView mStatus; private ProgressBar mProgress; + private UsbDevice mDevice; /** * Some N and older accessories do not send a zero sized package after a request that is a @@ -156,7 +157,6 @@ public class UsbDeviceTestActivity extends PassFailButtons.Activity { case ACTION_USB_PERMISSION: boolean granted = intent.getBooleanExtra( UsbManager.EXTRA_PERMISSION_GRANTED, false); - if (granted) { if (!AoapInterface.isDeviceInAoapMode(device)) { mStatus.setText(R.string.usb_device_test_step3); @@ -194,7 +194,6 @@ public class UsbDeviceTestActivity extends PassFailButtons.Activity { } } }; - registerReceiver(mUsbDeviceConnectionReceiver, filter); } @@ -1557,6 +1556,15 @@ public class UsbDeviceTestActivity extends PassFailButtons.Activity { connection.close(); } + private void syncReconnectDevice(@NonNull UsbDevice device) { + this.mDevice = device; + } + + private UsbDevice getReconnectDevice() { + return mDevice; + } + + /** * <p> This attachedtask the requests and does not care about them anymore after the * system took them. The {@link attachedTask} handles the test after the main test done. @@ -1600,6 +1608,8 @@ public class UsbDeviceTestActivity extends PassFailButtons.Activity { public void onReceive(Context context, Intent intent) { synchronized (UsbDeviceTestActivity.this) { UsbDevice device = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE); + syncReconnectDevice(device); + switch (intent.getAction()) { case ACTION_USB_PERMISSION: boolean granted = intent.getBooleanExtra( @@ -2267,6 +2277,12 @@ public class UsbDeviceTestActivity extends PassFailButtons.Activity { // If reconnect timeout make the test fail assertEquals(0, errors.size()); + // Update connection handle after reconnect + device = getReconnectDevice(); + assertNotNull(device); + connection = mUsbManager.openDevice(device); + assertNotNull(connection); + connection.close(); // We should not be able to communicate with the device anymore diff --git a/tests/filesystem/AndroidTest.xml b/tests/filesystem/AndroidTest.xml index df140d658c7..3f0ddc08609 100644 --- a/tests/filesystem/AndroidTest.xml +++ b/tests/filesystem/AndroidTest.xml @@ -26,8 +26,8 @@ <test class="com.android.tradefed.testtype.AndroidJUnitTest" > <option name="package" value="android.filesystem.cts" /> <option name="runtime-hint" value="14m48s" /> - <!-- test-timeout unit is ms, value = 60 min --> - <option name="test-timeout" value="3600000" /> + <!-- test-timeout unit is ms, value = 70 min --> + <option name="test-timeout" value="4200000" /> <!-- shell-timeout unit is ms, value = 180 min for AlmostFullTest --> <option name="shell-timeout" value="10800000" /> <!-- disable isolated storage so tests can write report log --> diff --git a/tests/tests/hardware/src/android/hardware/input/cts/tests/InputTestCase.java b/tests/tests/hardware/src/android/hardware/input/cts/tests/InputTestCase.java index ce9746b7a41..209b9122565 100644 --- a/tests/tests/hardware/src/android/hardware/input/cts/tests/InputTestCase.java +++ b/tests/tests/hardware/src/android/hardware/input/cts/tests/InputTestCase.java @@ -82,6 +82,7 @@ public abstract class InputTestCase { @Before public void setUp() throws Exception { mActivityRule.getActivity().clearUnhandleKeyCode(); + mActivityRule.getActivity().setInputCallback(mInputListener); mDecorView = mActivityRule.getActivity().getWindow().getDecorView(); mParser = new InputJsonParser(mInstrumentation.getTargetContext()); mVid = mParser.readVendorId(mRegisterResourceId); @@ -228,7 +229,6 @@ public abstract class InputTestCase { } protected void verifyEvents(List<InputEvent> events) { - mActivityRule.getActivity().setInputCallback(mInputListener); // Make sure we received the expected input events if (events.size() == 0) { // If no event is expected we need to wait for event until timeout and fail on diff --git a/tests/tests/wifi/src/android/net/wifi/cts/WifiNetworkSpecifierTest.java b/tests/tests/wifi/src/android/net/wifi/cts/WifiNetworkSpecifierTest.java index 65bee684512..c84525c1ae9 100644 --- a/tests/tests/wifi/src/android/net/wifi/cts/WifiNetworkSpecifierTest.java +++ b/tests/tests/wifi/src/android/net/wifi/cts/WifiNetworkSpecifierTest.java @@ -70,10 +70,13 @@ import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.security.spec.InvalidKeySpecException; import java.security.spec.PKCS8EncodedKeySpec; + import java.util.List; import java.util.ArrayList; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + /** * Tests the entire connection flow using {@link WifiNetworkSpecifier} embedded in a @@ -227,6 +230,8 @@ public class WifiNetworkSpecifierTest extends WifiJUnit4TestBase { () -> wifiManager.getPrivilegedConfiguredNetworks()); assertWithMessage("Need at least one saved network") .that(savedNetworks.isEmpty()).isFalse(); + savedNetworks = savedNetworks.stream() + .filter(a -> !isEnterpriseConfig(a)).collect(Collectors.toList()); // Pick any network in range. sTestNetwork = TestHelper.findMatchingSavedNetworksWithBssid(wifiManager, savedNetworks) @@ -601,4 +606,10 @@ public class WifiNetworkSpecifierTest extends WifiJUnit4TestBase { assertThat(redacted.equals(specifier)).isTrue(); } } + + private static boolean isEnterpriseConfig(WifiConfiguration config) { + WifiEnterpriseConfig enterpriseConfig = config.enterpriseConfig; + return enterpriseConfig != null + && enterpriseConfig.getEapMethod() != WifiEnterpriseConfig.Eap.NONE; + } } |