Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1dec957d authored by Peter Collingbourne's avatar Peter Collingbourne Committed by Automerger Merge Worker
Browse files

Merge "Add support for a hw_timeout_multiplier system property." am: 7fe1ca63 am: 3c8dbe30

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1556750

Change-Id: Iaec0f4e259ebb1251c534fbf01081f89272c44b7
parents 3561e4ac 3c8dbe30
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.content.Intent;
import android.content.ServiceConnection;
import android.net.Uri;
import android.os.Binder;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
@@ -73,11 +74,12 @@ public final class JobServiceContext implements ServiceConnection {

    private static final String TAG = "JobServiceContext";
    /** Amount of time a job is allowed to execute for before being considered timed-out. */
    public static final long EXECUTING_TIMESLICE_MILLIS = 10 * 60 * 1000;  // 10mins.
    public static final long EXECUTING_TIMESLICE_MILLIS =
            10 * 60 * 1000 * Build.HW_TIMEOUT_MULTIPLIER; // 10mins.
    /** Amount of time the JobScheduler waits for the initial service launch+bind. */
    private static final long OP_BIND_TIMEOUT_MILLIS = 18 * 1000;
    private static final long OP_BIND_TIMEOUT_MILLIS = 18 * 1000 * Build.HW_TIMEOUT_MULTIPLIER;
    /** Amount of time the JobScheduler will wait for a response from an app for a message. */
    private static final long OP_TIMEOUT_MILLIS = 8 * 1000;
    private static final long OP_TIMEOUT_MILLIS = 8 * 1000 * Build.HW_TIMEOUT_MULTIPLIER;

    private static final String[] VERB_STRINGS = {
            "VERB_BINDING", "VERB_STARTING", "VERB_EXECUTING", "VERB_STOPPING", "VERB_FINISHED"
+6 −4
Original line number Diff line number Diff line
@@ -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
+12 −0
Original line number Diff line number Diff line
@@ -1115,6 +1115,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.
     *
+2 −1
Original line number Diff line number Diff line
@@ -75,7 +75,8 @@ public class Watchdog extends Thread {
    //         can trigger the watchdog.
    // Note 2: The debug value is already below the wait time in ZygoteConnection. Wrapped
    //         applications may not work with a debug build. CTS will fail.
    private static final long DEFAULT_TIMEOUT = DB ? 10 * 1000 : 60 * 1000;
    private static final long DEFAULT_TIMEOUT =
            (DB ? 10 * 1000 : 60 * 1000) * Build.HW_TIMEOUT_MULTIPLIER;
    private static final long CHECK_INTERVAL = DEFAULT_TIMEOUT / 2;

    // These are temporally ordered: larger values as lateness increases
+2 −2
Original line number Diff line number Diff line
@@ -140,14 +140,14 @@ public final class ActiveServices {
    private static final int DEBUG_FGS_ENFORCE_TYPE = 1;

    // How long we wait for a service to finish executing.
    static final int SERVICE_TIMEOUT = 20*1000;
    static final int SERVICE_TIMEOUT = 20 * 1000 * Build.HW_TIMEOUT_MULTIPLIER;

    // How long we wait for a service to finish executing.
    static final int SERVICE_BACKGROUND_TIMEOUT = SERVICE_TIMEOUT * 10;

    // How long the startForegroundService() grace period is to get around to
    // calling startForeground() before we ANR + stop it.
    static final int SERVICE_START_FOREGROUND_TIMEOUT = 10*1000;
    static final int SERVICE_START_FOREGROUND_TIMEOUT = 10 * 1000 * Build.HW_TIMEOUT_MULTIPLIER;

    final ActivityManagerService mAm;

Loading