Merge "Add support for a hw_timeout_multiplier system property." into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
127cb3ff8f
@@ -34,6 +34,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;
|
||||
@@ -77,9 +78,9 @@ public final class JobServiceContext implements ServiceConnection {
|
||||
|
||||
private static final String TAG = "JobServiceContext";
|
||||
/** 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"
|
||||
|
||||
@@ -769,7 +769,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 */
|
||||
@@ -783,7 +783,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
|
||||
@@ -791,10 +792,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
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
24
core/java/android/os/InputConstants.java
Normal file
24
core/java/android/os/InputConstants.java
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.os;
|
||||
|
||||
/** @hide */
|
||||
public class InputConstants {
|
||||
public static final int DEFAULT_DISPATCHING_TIMEOUT_MILLIS =
|
||||
IInputConstants.UNMULTIPLIED_DEFAULT_DISPATCHING_TIMEOUT_MILLIS
|
||||
* Build.HW_TIMEOUT_MULTIPLIER;
|
||||
}
|
||||
@@ -75,7 +75,8 @@ public class Watchdog {
|
||||
// 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
|
||||
|
||||
@@ -178,14 +178,14 @@ public final class ActiveServices {
|
||||
private static final boolean SHOW_DUNGEON_NOTIFICATION = false;
|
||||
|
||||
// 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;
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY;
|
||||
import static android.content.pm.PackageManager.MATCH_UNINSTALLED_PACKAGES;
|
||||
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||
import static android.os.FactoryTest.FACTORY_TEST_OFF;
|
||||
import static android.os.IInputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
|
||||
import static android.os.InputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
|
||||
import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_CRITICAL;
|
||||
import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_HIGH;
|
||||
import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_NORMAL;
|
||||
@@ -452,7 +452,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
|
||||
// How long we wait for a launched process to attach to the activity manager
|
||||
// before we decide it's never going to come up for real.
|
||||
static final int PROC_START_TIMEOUT = 10*1000;
|
||||
static final int PROC_START_TIMEOUT = 10 * 1000 * Build.HW_TIMEOUT_MULTIPLIER;
|
||||
// How long we wait to kill an application zygote, after the last process using
|
||||
// it has gone away.
|
||||
static final int KILL_APP_ZYGOTE_DELAY_MS = 5 * 1000;
|
||||
@@ -464,8 +464,8 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
static final int PROC_START_TIMEOUT_WITH_WRAPPER = 1200*1000;
|
||||
|
||||
// How long we allow a receiver to run before giving up on it.
|
||||
static final int BROADCAST_FG_TIMEOUT = 10*1000;
|
||||
static final int BROADCAST_BG_TIMEOUT = 60*1000;
|
||||
static final int BROADCAST_FG_TIMEOUT = 10 * 1000 * Build.HW_TIMEOUT_MULTIPLIER;
|
||||
static final int BROADCAST_BG_TIMEOUT = 60 * 1000 * Build.HW_TIMEOUT_MULTIPLIER;
|
||||
|
||||
public static final int MY_PID = myPid();
|
||||
|
||||
@@ -513,7 +513,8 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
private static final int MAX_BUGREPORT_TITLE_SIZE = 50;
|
||||
private static final int MAX_BUGREPORT_DESCRIPTION_SIZE = 150;
|
||||
|
||||
private static final int NATIVE_DUMP_TIMEOUT_MS = 2000; // 2 seconds;
|
||||
private static final int NATIVE_DUMP_TIMEOUT_MS =
|
||||
2000 * Build.HW_TIMEOUT_MULTIPLIER; // 2 seconds;
|
||||
private static final int JAVA_DUMP_MINIMUM_SIZE = 100; // 100 bytes.
|
||||
|
||||
OomAdjuster mOomAdjuster;
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.server.am;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.database.ContentObserver;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.provider.Settings;
|
||||
import android.util.KeyValueListParser;
|
||||
@@ -42,12 +43,13 @@ public class BroadcastConstants {
|
||||
"bcast_allow_bg_activity_start_timeout";
|
||||
|
||||
// All time intervals are in milliseconds
|
||||
private static final long DEFAULT_TIMEOUT = 10_000;
|
||||
private static final long DEFAULT_SLOW_TIME = 5_000;
|
||||
private static final long DEFAULT_DEFERRAL = 5_000;
|
||||
private static final long DEFAULT_TIMEOUT = 10_000 * Build.HW_TIMEOUT_MULTIPLIER;
|
||||
private static final long DEFAULT_SLOW_TIME = 5_000 * Build.HW_TIMEOUT_MULTIPLIER;
|
||||
private static final long DEFAULT_DEFERRAL = 5_000 * Build.HW_TIMEOUT_MULTIPLIER;
|
||||
private static final float DEFAULT_DEFERRAL_DECAY_FACTOR = 0.75f;
|
||||
private static final long DEFAULT_DEFERRAL_FLOOR = 0;
|
||||
private static final long DEFAULT_ALLOW_BG_ACTIVITY_START_TIMEOUT = 10_000;
|
||||
private static final long DEFAULT_ALLOW_BG_ACTIVITY_START_TIMEOUT =
|
||||
10_000 * Build.HW_TIMEOUT_MULTIPLIER;
|
||||
|
||||
// All time constants are in milliseconds
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||
import static android.os.FactoryTest.FACTORY_TEST_HIGH_LEVEL;
|
||||
import static android.os.FactoryTest.FACTORY_TEST_LOW_LEVEL;
|
||||
import static android.os.FactoryTest.FACTORY_TEST_OFF;
|
||||
import static android.os.IInputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
|
||||
import static android.os.InputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
|
||||
import static android.os.Process.FIRST_APPLICATION_UID;
|
||||
import static android.os.Process.SYSTEM_UID;
|
||||
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
|
||||
|
||||
@@ -109,6 +109,7 @@ import android.content.pm.UserInfo;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Binder;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Debug;
|
||||
import android.os.Handler;
|
||||
@@ -165,13 +166,13 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
|
||||
static final String TAG_TASKS = TAG + POSTFIX_TASKS;
|
||||
|
||||
/** How long we wait until giving up on the last activity telling us it is idle. */
|
||||
private static final int IDLE_TIMEOUT = 10 * 1000;
|
||||
private static final int IDLE_TIMEOUT = 10 * 1000 * Build.HW_TIMEOUT_MULTIPLIER;
|
||||
|
||||
/** How long we can hold the sleep wake lock before giving up. */
|
||||
private static final int SLEEP_TIMEOUT = 5 * 1000;
|
||||
private static final int SLEEP_TIMEOUT = 5 * 1000 * Build.HW_TIMEOUT_MULTIPLIER;
|
||||
|
||||
// How long we can hold the launch wake lock before giving up.
|
||||
private static final int LAUNCH_TIMEOUT = 10 * 1000;
|
||||
private static final int LAUNCH_TIMEOUT = 10 * 1000 * Build.HW_TIMEOUT_MULTIPLIER;
|
||||
|
||||
/** How long we wait until giving up on the activity telling us it released the top state. */
|
||||
private static final int TOP_RESUMED_STATE_LOSS_TIMEOUT = 500;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.server.wm;
|
||||
|
||||
import static android.os.IInputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
|
||||
import static android.os.InputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
|
||||
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_INTERCEPT_GLOBAL_DRAG_AND_DROP;
|
||||
|
||||
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_ORIENTATION;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.server.wm;
|
||||
|
||||
import static android.os.IInputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
|
||||
import static android.os.InputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
|
||||
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.server.wm;
|
||||
|
||||
import static android.os.IInputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
|
||||
import static android.os.InputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
|
||||
import static android.view.SurfaceControl.HIDDEN;
|
||||
|
||||
import android.graphics.Color;
|
||||
|
||||
@@ -18,7 +18,7 @@ package com.android.server.wm;
|
||||
|
||||
import static android.app.ActivityTaskManager.RESIZE_MODE_USER;
|
||||
import static android.app.ActivityTaskManager.RESIZE_MODE_USER_FORCED;
|
||||
import static android.os.IInputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
|
||||
import static android.os.InputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
|
||||
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
|
||||
|
||||
import static com.android.internal.policy.TaskResizingAlgorithm.CTRL_BOTTOM;
|
||||
|
||||
@@ -33,7 +33,7 @@ import static android.app.admin.DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER
|
||||
import static android.content.pm.PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT;
|
||||
import static android.content.pm.PackageManager.FEATURE_PC;
|
||||
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||
import static android.os.IInputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
|
||||
import static android.os.InputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
|
||||
import static android.os.Process.SYSTEM_UID;
|
||||
import static android.os.Process.myPid;
|
||||
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
|
||||
|
||||
@@ -19,7 +19,7 @@ package com.android.server.wm;
|
||||
import static android.app.ActivityManager.PROCESS_STATE_NONEXISTENT;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
|
||||
import static android.os.Build.VERSION_CODES.Q;
|
||||
import static android.os.IInputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
|
||||
import static android.os.InputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
|
||||
|
||||
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_CONFIGURATION;
|
||||
import static com.android.internal.util.Preconditions.checkArgument;
|
||||
|
||||
@@ -26,7 +26,7 @@ import static android.app.WindowConfiguration.isSplitScreenWindowingMode;
|
||||
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
|
||||
import static android.graphics.GraphicsProtos.dumpPointProto;
|
||||
import static android.hardware.input.InputManager.BLOCK_UNTRUSTED_TOUCHES;
|
||||
import static android.os.IInputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
|
||||
import static android.os.InputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
|
||||
import static android.os.PowerManager.DRAW_WAKE_LOCK;
|
||||
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
|
||||
import static android.view.InsetsState.ITYPE_IME;
|
||||
|
||||
Reference in New Issue
Block a user