From fba736f1cd0dfd420490a4b854035b873600d52f Mon Sep 17 00:00:00 2001 From: Priyank Singh Date: Thu, 29 Aug 2024 04:55:38 +0000 Subject: Revert "Cleanup drop input for AE during legacy transition" This reverts commit 911018255d81911edddc2f9e5f10c5e3361c9199. Reason for revert: Bringing back legacy transitions test for automotive 24Q4. Remove them after 24Q4. Bug: 362992157 Bug: 339562797 Flag: EXEMPT Test: atest CtsWindowManagerJetpackTestCases Change-Id: I228a485b2388bba900e82e3ed275ccf220e9b510 --- .../core/java/com/android/server/wm/ActivityRecord.java | 16 +++++++++++++++- .../com/android/server/wm/RemoteAnimationController.java | 5 +++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 6bf70f0a471d..8df974f0cccc 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -813,6 +813,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A /** The last set {@link DropInputMode} for this activity surface. */ @DropInputMode private int mLastDropInputMode = DropInputMode.NONE; + /** Whether the input to this activity will be dropped during the current playing animation. */ + private boolean mIsInputDroppedForAnimation; /** * Whether the application has desk mode resources. Calculated and cached when @@ -1647,6 +1649,15 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } } + /** Sets if all input will be dropped as a protection during the client-driven animation. */ + void setDropInputForAnimation(boolean isInputDroppedForAnimation) { + if (mIsInputDroppedForAnimation == isInputDroppedForAnimation) { + return; + } + mIsInputDroppedForAnimation = isInputDroppedForAnimation; + updateUntrustedEmbeddingInputProtection(); + } + /** * Sets to drop input when obscured to activity if it is embedded in untrusted mode. * @@ -1659,7 +1670,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (getSurfaceControl() == null) { return; } - if (isEmbeddedInUntrustedMode()) { + if (mIsInputDroppedForAnimation) { + // Disable all input during the animation. + setDropInputMode(DropInputMode.ALL); + } else if (isEmbeddedInUntrustedMode()) { // Set drop input to OBSCURED when untrusted embedded. setDropInputMode(DropInputMode.OBSCURED); } else { diff --git a/services/core/java/com/android/server/wm/RemoteAnimationController.java b/services/core/java/com/android/server/wm/RemoteAnimationController.java index f8665c70c61d..432089ff2fcf 100644 --- a/services/core/java/com/android/server/wm/RemoteAnimationController.java +++ b/services/core/java/com/android/server/wm/RemoteAnimationController.java @@ -53,6 +53,7 @@ import com.android.server.wm.SurfaceAnimator.OnAnimationFinishedCallback; import java.io.PrintWriter; import java.io.StringWriter; import java.util.ArrayList; +import java.util.function.Consumer; /** * Helper class to run app animations in a remote process. @@ -348,6 +349,10 @@ class RemoteAnimationController implements DeathRecipient { } finally { mIsFinishing = false; } + // Reset input for all activities when the remote animation is finished. + final Consumer updateActivities = + activity -> activity.setDropInputForAnimation(false); + mDisplayContent.forAllActivities(updateActivities); } setRunningRemoteAnimation(false); ProtoLog.i(WM_DEBUG_REMOTE_ANIMATIONS, "Finishing remote animation"); -- cgit v1.2.3-59-g8ed1b