summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorPeter Collingbourne <pcc@google.com>2021-03-11 12:51:25 -0800
committerPeter Collingbourne <pcc@google.com>2021-03-11 14:04:18 -0800
commit6353c57d570b6b873d5b49ee6ca738ceada51dbd (patch)
treeb4e363bbde54e7c9f1c21a75ee0d84c5c6786aa9 /core
parent1bec754c8b6724b5fc78995c374f3d8e40fb2075 (diff)
Add support for a hw_timeout_multiplier system property.
In order to test the platform in emulators that are orders of magnitude slower than real hardware we need to be able to avoid hitting timeouts that prevent it from coming up properly. For this purpose introduce a system property, ro.hw_timeout_multiplier, which may be set to an integer value that acts as a multiplier for various timeouts on the system. Bug: 178231152 Change-Id: I6d7710beed0c4c5b1720e74e7abe3a586778c678 Merged-In: I6d7710beed0c4c5b1720e74e7abe3a586778c678
Diffstat (limited to 'core')
-rw-r--r--core/java/android/content/ContentResolver.java10
-rwxr-xr-xcore/java/android/os/Build.java12
2 files changed, 18 insertions, 4 deletions
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java
index 32aa0377cd5f..d21462e02d92 100644
--- a/core/java/android/content/ContentResolver.java
+++ b/core/java/android/content/ContentResolver.java
@@ -744,7 +744,7 @@ public abstract class ContentResolver implements ContentInterface {
// Always log queries which take 500ms+; shorter queries are
// sampled accordingly.
private static final boolean ENABLE_CONTENT_SAMPLE = false;
- private static final int SLOW_THRESHOLD_MILLIS = 500;
+ private static final int SLOW_THRESHOLD_MILLIS = 500 * Build.HW_TIMEOUT_MULTIPLIER;
private final Random mRandom = new Random(); // guarded by itself
/** @hide */
@@ -758,7 +758,8 @@ public abstract class ContentResolver implements ContentInterface {
* before we decide it must be hung.
* @hide
*/
- public static final int CONTENT_PROVIDER_PUBLISH_TIMEOUT_MILLIS = 10 * 1000;
+ public static final int CONTENT_PROVIDER_PUBLISH_TIMEOUT_MILLIS =
+ 10 * 1000 * Build.HW_TIMEOUT_MULTIPLIER;
/**
* How long we wait for an provider to be published. Should be longer than
@@ -766,10 +767,11 @@ public abstract class ContentResolver implements ContentInterface {
* @hide
*/
public static final int CONTENT_PROVIDER_READY_TIMEOUT_MILLIS =
- CONTENT_PROVIDER_PUBLISH_TIMEOUT_MILLIS + 10 * 1000;
+ CONTENT_PROVIDER_PUBLISH_TIMEOUT_MILLIS + 10 * 1000 * Build.HW_TIMEOUT_MULTIPLIER;
// Timeout given a ContentProvider that has already been started and connected to.
- private static final int CONTENT_PROVIDER_TIMEOUT_MILLIS = 3 * 1000;
+ private static final int CONTENT_PROVIDER_TIMEOUT_MILLIS =
+ 3 * 1000 * Build.HW_TIMEOUT_MULTIPLIER;
// Should be >= {@link #CONTENT_PROVIDER_WAIT_TIMEOUT_MILLIS}, because that's how
// long ActivityManagerService is giving a content provider to get published if a new process
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index d7d3e5881219..9d5aa5e007e9 100755
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -1116,6 +1116,18 @@ public class Build {
}
/**
+ * A multiplier for various timeouts on the system.
+ *
+ * The intent is that products targeting software emulators that are orders of magnitude slower
+ * than real hardware may set this to a large number. On real devices and hardware-accelerated
+ * virtualized devices this should not be set.
+ *
+ * @hide
+ */
+ public static final int HW_TIMEOUT_MULTIPLIER =
+ SystemProperties.getInt("ro.hw_timeout_multiplier", 1);
+
+ /**
* True if Treble is enabled and required for this device.
*
* @hide