summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/app/Activity.java6
-rw-r--r--core/java/android/app/Instrumentation.java42
2 files changed, 8 insertions, 40 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index b198811416cd..4782205e3b21 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -1027,9 +1027,6 @@ public class Activity extends ContextThemeWrapper
/** The autofill client controller. Always access via {@link #getAutofillClientController()}. */
private AutofillClientController mAutofillClientController;
- /** @hide */
- boolean mEnterAnimationComplete;
-
private boolean mIsInMultiWindowMode;
/** @hide */
boolean mIsInPictureInPictureMode;
@@ -2898,7 +2895,6 @@ public class Activity extends ContextThemeWrapper
mCalled = true;
getAutofillClientController().onActivityStopped(mIntent, mChangingConfigurations);
- mEnterAnimationComplete = false;
notifyVoiceInteractionManagerServiceActivityEvent(
VoiceInteractionSession.VOICE_INTERACTION_ACTIVITY_EVENT_STOP);
@@ -8594,8 +8590,6 @@ public class Activity extends ContextThemeWrapper
* @hide
*/
public void dispatchEnterAnimationComplete() {
- mEnterAnimationComplete = true;
- mInstrumentation.onEnterAnimationComplete();
onEnterAnimationComplete();
if (getWindow() != null && getWindow().getDecorView() != null) {
View decorView = getWindow().getDecorView();
diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java
index 7eacaac29d4b..b611acf79bc3 100644
--- a/core/java/android/app/Instrumentation.java
+++ b/core/java/android/app/Instrumentation.java
@@ -59,7 +59,6 @@ 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;
@@ -137,7 +136,6 @@ public class Instrumentation {
private PerformanceCollector mPerformanceCollector;
private Bundle mPerfMetrics = new Bundle();
private UiAutomation mUiAutomation;
- private final Object mAnimationCompleteLock = new Object();
@RavenwoodKeep
public Instrumentation() {
@@ -455,31 +453,6 @@ public class Instrumentation {
idler.waitForIdle();
}
- private void waitForEnterAnimationComplete(Activity activity) {
- synchronized (mAnimationCompleteLock) {
- long timeout = 5000;
- try {
- // We need to check that this specified Activity completed the animation, not just
- // any Activity. If it was another Activity, then decrease the timeout by how long
- // it's already waited and wait for the thread to wakeup again.
- while (timeout > 0 && !activity.mEnterAnimationComplete) {
- long startTime = System.currentTimeMillis();
- mAnimationCompleteLock.wait(timeout);
- long totalTime = System.currentTimeMillis() - startTime;
- timeout -= totalTime;
- }
- } catch (InterruptedException e) {
- }
- }
- }
-
- /** @hide */
- public void onEnterAnimationComplete() {
- synchronized (mAnimationCompleteLock) {
- mAnimationCompleteLock.notifyAll();
- }
- }
-
/**
* Execute a call on the application's main thread, blocking until it is
* complete. Useful for doing things that are not thread-safe, such as
@@ -640,13 +613,14 @@ public class Instrumentation {
activity = aw.activity;
}
- // Do not call this method within mSync, lest it could block the main thread.
- waitForEnterAnimationComplete(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);
+ // Typically, callers expect that the launched activity can receive input events after this
+ // method returns, so wait until a stable state, i.e. animation is finished and input info
+ // is updated.
+ try {
+ WindowManagerGlobal.getWindowManagerService()
+ .syncInputTransactions(true /* waitForAnimations */);
+ } catch (RemoteException e) {
+ e.rethrowFromSystemServer();
}
return activity;
}