summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosep del Rio <joseprio@google.com>2024-04-23 12:44:48 +0000
committerAndroid Build Cherrypicker Worker <android-build-cherrypicker-worker@google.com>2024-04-23 12:44:48 +0000
commitefc350ac01235acc7c5bbca759a44fbeedfafebb (patch)
tree99ea8afc8889050cb590c0921a4ca828a525849b
parente8005a3164713b9c4a785bdffcf4a71c338eb6f0 (diff)
downloadcts-efc350ac01235acc7c5bbca759a44fbeedfafebb.tar.gz
Increase timeout for input device removal
While investigating a presubmit flakyness, we noticed that a particular test would fail because the notification arrived in 29 seconds, which exceeded the current 20 second wait. This will extend it to a minute, which should hopefully eliminate most of these sporadic failures. Test: Presubmit Bug: 329219118 (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:438188887a697dfceff31034fc1666bdc82dd8eb) Merged-In: I6419475695563715fab2a02021f6e1595542aaa9 Change-Id: I6419475695563715fab2a02021f6e1595542aaa9
-rw-r--r--libs/input/src/com/android/cts/input/VirtualInputDevice.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/libs/input/src/com/android/cts/input/VirtualInputDevice.java b/libs/input/src/com/android/cts/input/VirtualInputDevice.java
index e261f0bb2a4..cc58a4325dc 100644
--- a/libs/input/src/com/android/cts/input/VirtualInputDevice.java
+++ b/libs/input/src/com/android/cts/input/VirtualInputDevice.java
@@ -24,6 +24,7 @@ import android.hardware.input.InputManager;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.ParcelFileDescriptor;
+import android.os.SystemProperties;
import android.util.JsonReader;
import android.util.JsonToken;
import android.util.Log;
@@ -47,6 +48,8 @@ import java.util.concurrent.TimeUnit;
public abstract class VirtualInputDevice implements
InputManager.InputDeviceListener, AutoCloseable {
private static final String TAG = "VirtualInputDevice";
+ private static final int HW_TIMEOUT_MULTIPLIER = SystemProperties.getInt(
+ "ro.hw_timeout_multiplier", 1);
private InputStream mInputStream;
private OutputStream mOutputStream;
private Instrumentation mInstrumentation;
@@ -182,7 +185,7 @@ public abstract class VirtualInputDevice implements
// mResultThread should exit when stream is closed.
try {
// Wait for input device removed callback.
- mDeviceRemovedSignal.await(20L, TimeUnit.SECONDS);
+ mDeviceRemovedSignal.await(HW_TIMEOUT_MULTIPLIER * 20L, TimeUnit.SECONDS);
if (mDeviceRemovedSignal.getCount() != 0) {
throw new RuntimeException("Did not receive device removed notification in time");
}