From 6c1746564868af86693404189f999d9a817858e3 Mon Sep 17 00:00:00 2001
From: wilsonshih <wilsonshih@google.com>
Date: Wed, 10 Apr 2024 10:48:30 +0800
Subject: [PATCH] Remove onBackInvoked workaround for recents animation.

Legacy recents animation was broken for a while after enable shell
transition, it's unnecessary to maintain it.
For shell transition, after introduce RecentsTransitionHandler, it
will set focus window to recents activity in setInputConsumerEnabled
(ref I10e397db956cad90a4510c326163600f0ed63514), so onBackCallback can
handled by focus window directly.

Bug: 333428882
Test: tried back gesture work in recents when either enable/disable
enable_predictive_back_gesture.

Change-Id: I2e2d6dc7adf0dd9b821b65ff328e434c2600bcf5
---
 data/etc/services.core.protolog.json          |  6 ------
 .../server/wm/BackNavigationController.java   | 21 -------------------
 2 files changed, 27 deletions(-)

diff --git a/data/etc/services.core.protolog.json b/data/etc/services.core.protolog.json
index d410d5f5400e..1cd3d12aba1c 100644
--- a/data/etc/services.core.protolog.json
+++ b/data/etc/services.core.protolog.json
@@ -1057,12 +1057,6 @@
       "group": "WM_DEBUG_BACK_PREVIEW",
       "at": "com\/android\/server\/wm\/BackNavigationController.java"
     },
-    "-1459414342866553129": {
-      "message": "Current focused window being animated by recents. Overriding back callback to recents controller callback.",
-      "level": "DEBUG",
-      "group": "WM_DEBUG_BACK_PREVIEW",
-      "at": "com\/android\/server\/wm\/BackNavigationController.java"
-    },
     "2881085074175114605": {
       "message": "Focused window didn't have a valid surface drawn.",
       "level": "DEBUG",
diff --git a/services/core/java/com/android/server/wm/BackNavigationController.java b/services/core/java/com/android/server/wm/BackNavigationController.java
index f7b4a6748411..b9979adbafd0 100644
--- a/services/core/java/com/android/server/wm/BackNavigationController.java
+++ b/services/core/java/com/android/server/wm/BackNavigationController.java
@@ -174,27 +174,6 @@ class BackNavigationController {
                 }
             }
 
-            // This is needed to bridge the old and new back behavior with recents.  While in
-            // Overview with live tile enabled, the previous app is technically focused but we
-            // add an input consumer to capture all input that would otherwise go to the apps
-            // being controlled by the animation. This means that the window resolved is not
-            // the right window to consume back while in overview, so we need to route it to
-            // launcher and use the legacy behavior of injecting KEYCODE_BACK since the existing
-            // compat callback in VRI only works when the window is focused.
-            // This symptom also happen while shell transition enabled, we can check that by
-            // isTransientLaunch to know whether the focus window is point to live tile.
-            final RecentsAnimationController recentsAnimationController =
-                    wmService.getRecentsAnimationController();
-            final ActivityRecord tmpAR = window.mActivityRecord;
-            if ((tmpAR != null && tmpAR.isActivityTypeHomeOrRecents()
-                    && tmpAR.mTransitionController.isTransientLaunch(tmpAR))
-                    || (recentsAnimationController != null
-                    && recentsAnimationController.shouldApplyInputConsumer(tmpAR))) {
-                ProtoLog.d(WM_DEBUG_BACK_PREVIEW, "Current focused window being animated by "
-                        + "recents. Overriding back callback to recents controller callback.");
-                return null;
-            }
-
             if (!window.isDrawn()) {
                 ProtoLog.d(WM_DEBUG_BACK_PREVIEW,
                         "Focused window didn't have a valid surface drawn.");
-- 
GitLab