From b576faec5c70f661c4d392c4a73baa7974341378 Mon Sep 17 00:00:00 2001 From: Galia Peycheva Date: Fri, 16 Sep 2022 14:29:35 +0200 Subject: [PATCH] Make transit to home activity always be close transit Previously, we used the wallpaper transition when going to the home activity. The idea was that on devices that have no wallpaper, this is safe. However, the check for the wallpaper was incorrect. A better approach is to detect when a task open transition is happening and check if it's the home task that is being brought to front. If yes, then we use a close transition, closing the previous activity to show the home activity Bug: 237371677 Bug: 220024691 Test: m && manually check that keyevent HOME fades out the top app Change-Id: I46ba3d363b581f07e153e032689261821cbbe9e4 --- .../server/wm/AppTransitionController.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/services/core/java/com/android/server/wm/AppTransitionController.java b/services/core/java/com/android/server/wm/AppTransitionController.java index 7e62c61572d6d..2ea6a3f14f642 100644 --- a/services/core/java/com/android/server/wm/AppTransitionController.java +++ b/services/core/java/com/android/server/wm/AppTransitionController.java @@ -467,16 +467,6 @@ public class AppTransitionController { return TRANSIT_OLD_WALLPAPER_OPEN; } - // Some devices don't show a wallpaper. In that case we should still trigger wallpaper - // transitions when animating to/from the home activity - if (wallpaperTarget == null) { - if (topOpeningApp != null && topOpeningApp.isActivityTypeHome()) { - return TRANSIT_OLD_WALLPAPER_OPEN; - } else if (topClosingApp != null && topClosingApp.isActivityTypeHome()) { - return TRANSIT_OLD_WALLPAPER_CLOSE; - } - } - final ArraySet openingWcs = getAnimationTargets( openingApps, closingApps, true /* visible */); final ArraySet closingWcs = getAnimationTargets( @@ -488,6 +478,11 @@ public class AppTransitionController { @TransitContainerType int openingType = getTransitContainerType(openingContainer); @TransitContainerType int closingType = getTransitContainerType(closingContainer); if (appTransition.containsTransitRequest(TRANSIT_TO_FRONT) && openingType == TYPE_TASK) { + if (topOpeningApp != null && topOpeningApp.isActivityTypeHome()) { + // If we are opening the home task, we want to play an animation as if + // the task on top is being brought to back. + return TRANSIT_OLD_TASK_TO_BACK; + } return TRANSIT_OLD_TASK_TO_FRONT; } if (appTransition.containsTransitRequest(TRANSIT_TO_BACK) && closingType == TYPE_TASK) {