Merge "WM: Fix input dispatch timeout for instrumented processes"
This commit is contained in:
@@ -95,6 +95,7 @@ import static android.content.res.Configuration.UI_MODE_TYPE_MASK;
|
||||
import static android.content.res.Configuration.UI_MODE_TYPE_VR_HEADSET;
|
||||
import static android.os.Build.VERSION_CODES.HONEYCOMB;
|
||||
import static android.os.Build.VERSION_CODES.O;
|
||||
import static android.os.InputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
|
||||
import static android.os.Process.SYSTEM_UID;
|
||||
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
|
||||
import static android.view.Display.COLOR_MODE_DEFAULT;
|
||||
@@ -635,7 +636,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
private boolean mOccludesParent;
|
||||
|
||||
// The input dispatching timeout for this application token in milliseconds.
|
||||
long mInputDispatchingTimeoutMillis;
|
||||
long mInputDispatchingTimeoutMillis = DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
|
||||
|
||||
private boolean mShowWhenLocked;
|
||||
private boolean mInheritShownWhenLocked;
|
||||
@@ -1443,7 +1444,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
if (oldParent == null && newParent != null) {
|
||||
// First time we are adding the activity to the system.
|
||||
mVoiceInteraction = newTask.voiceSession != null;
|
||||
mInputDispatchingTimeoutMillis = getInputDispatchingTimeoutMillisLocked(this);
|
||||
|
||||
// TODO(b/36505427): Maybe this call should be moved inside
|
||||
// updateOverrideConfiguration()
|
||||
@@ -1995,6 +1995,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
task.setRootProcess(proc);
|
||||
}
|
||||
proc.addActivityIfNeeded(this);
|
||||
mInputDispatchingTimeoutMillis = getInputDispatchingTimeoutMillisLocked(this);
|
||||
|
||||
// Update the associated task fragment after setting the process, since it's required for
|
||||
// filtering to only report activities that belong to the same process.
|
||||
@@ -3578,6 +3579,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
app.removeActivity(this, false /* keepAssociation */);
|
||||
}
|
||||
app = null;
|
||||
mInputDispatchingTimeoutMillis = DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
|
||||
}
|
||||
|
||||
void makeFinishingLocked() {
|
||||
|
||||
@@ -40,6 +40,7 @@ import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET;
|
||||
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
|
||||
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
|
||||
import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
|
||||
import static android.os.InputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
|
||||
import static android.os.Process.NOBODY_UID;
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
import static android.view.InsetsState.ITYPE_IME;
|
||||
@@ -83,6 +84,7 @@ import static com.android.server.wm.ActivityRecord.State.RESUMED;
|
||||
import static com.android.server.wm.ActivityRecord.State.STARTED;
|
||||
import static com.android.server.wm.ActivityRecord.State.STOPPED;
|
||||
import static com.android.server.wm.ActivityRecord.State.STOPPING;
|
||||
import static com.android.server.wm.ActivityTaskManagerService.INSTRUMENTATION_KEY_DISPATCHING_TIMEOUT_MILLIS;
|
||||
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION;
|
||||
import static com.android.server.wm.TaskFragment.TASK_FRAGMENT_VISIBILITY_INVISIBLE;
|
||||
import static com.android.server.wm.TaskFragment.TASK_FRAGMENT_VISIBILITY_VISIBLE;
|
||||
@@ -3305,6 +3307,29 @@ public class ActivityRecordTests extends WindowTestsBase {
|
||||
CAMERA_COMPAT_CONTROL_TREATMENT_APPLIED);
|
||||
}
|
||||
|
||||
@Test // b/162542125
|
||||
public void testInputDispatchTimeout() throws RemoteException {
|
||||
final ActivityRecord activity = createActivityWithTask();
|
||||
final WindowProcessController wpc = activity.app;
|
||||
spyOn(wpc);
|
||||
doReturn(true).when(wpc).isInstrumenting();
|
||||
final ActivityRecord instrumentingActivity = createActivityOnDisplay(
|
||||
true /* defaultDisplay */, wpc);
|
||||
assertEquals(INSTRUMENTATION_KEY_DISPATCHING_TIMEOUT_MILLIS,
|
||||
instrumentingActivity.mInputDispatchingTimeoutMillis);
|
||||
|
||||
doReturn(false).when(wpc).isInstrumenting();
|
||||
final ActivityRecord nonInstrumentingActivity = createActivityOnDisplay(
|
||||
true /* defaultDisplay */, wpc);
|
||||
assertEquals(DEFAULT_DISPATCHING_TIMEOUT_MILLIS,
|
||||
nonInstrumentingActivity.mInputDispatchingTimeoutMillis);
|
||||
|
||||
final ActivityRecord noProcActivity = createActivityOnDisplay(true /* defaultDisplay */,
|
||||
null);
|
||||
assertEquals(DEFAULT_DISPATCHING_TIMEOUT_MILLIS,
|
||||
noProcActivity.mInputDispatchingTimeoutMillis);
|
||||
}
|
||||
|
||||
private ICompatCameraControlCallback getCompatCameraControlCallback() {
|
||||
return new ICompatCameraControlCallback.Stub() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user