diff options
| author | Prabir Pradhan <prabirmsp@google.com> | 2019-07-26 14:21:21 -0700 |
|---|---|---|
| committer | android-build-team Robot <android-build-team-robot@google.com> | 2019-08-14 00:22:41 +0000 |
| commit | ec177f86e1dbfd81bc2374e6214153028ebe0c3b (patch) | |
| tree | f63bdbf75bc7569b7d2587dac234a95965506a79 /core/java | |
| parent | 5c388cd605598db18dd03e8265b2a09aff54e3b4 (diff) | |
apply empty transaction in startActivitySync
Force SurfaceFlinger to update synchronously by applying an empty
transaction. Without this, SurfaceFlinger will only update after the
next vsync, which may only happen after the instrumentation already
starts.
Since InputFlinger will only have the proper InputWindowInfo after
SurfaceFlinger updates, waiting for the vsync caused some
instruemntation tests to be flaky.
Bug: 138263890
Test: atest android.view.cts.HoverTest
Change-Id: I5457ab67ac574530dc1aa84549ca11e7e3f0d714
(cherry picked from commit 03dde38efcb3c06c6317f9fcf1265e37a66811d9)
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/app/Instrumentation.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java index 41733b3af058..9720e9f47f83 100644 --- a/core/java/android/app/Instrumentation.java +++ b/core/java/android/app/Instrumentation.java @@ -50,6 +50,7 @@ import android.view.InputDevice; import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.MotionEvent; +import android.view.SurfaceControl; import android.view.ViewConfiguration; import android.view.Window; import android.view.WindowManagerGlobal; @@ -528,6 +529,12 @@ public class Instrumentation { } while (mWaitingActivities.contains(aw)); waitForEnterAnimationComplete(aw.activity); + + // Apply an empty transaction to ensure SF has a chance to update before + // the Activity is ready (b/138263890). + try (SurfaceControl.Transaction t = new SurfaceControl.Transaction()) { + t.apply(true); + } return aw.activity; } } |
