From 168084eb372aad011b43e2fc29dcc58bd36af117 Mon Sep 17 00:00:00 2001 From: Galia Peycheva Date: Fri, 10 Jun 2022 11:32:25 +0200 Subject: [PATCH] Use TRANSIT_WALLPAPER_OPEN when going to home activity Some devices don't show a wallpaper when the home activity is shown. This triggers a TRANSIT_TASK_TO_FRONT transition when e.g. pressing the home button. TRANSIT_TASK_TO_FRONT is normally used when an old activity is started on top of the old one. Normally the new activity is put on top of the old one by adjusting the Z order for the duration of the animation (via mNeedsZBoost). However, the home activity can not be put higher in z order than other regular activities. The z boostinga logic defines three groups of activities - home, regular and always-on-top. The z boosting works only within a group. Hence, home can't be animated on top of the old activity, which breaks animations like fade in. This CL makes the transition to the home activity be classified as a wallpaper_open transition, which assumes that this is the bottom-most activity on the screen Bug: 220024691 Test: manual: start a random activity and press the home button - observe animation Change-Id: Ida53d274ea050cc64d3d27173e32b5b1adb2fe5f --- .../com/android/server/wm/AppTransitionController.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/services/core/java/com/android/server/wm/AppTransitionController.java b/services/core/java/com/android/server/wm/AppTransitionController.java index 58864b16dda1e..f1686ab5666fa 100644 --- a/services/core/java/com/android/server/wm/AppTransitionController.java +++ b/services/core/java/com/android/server/wm/AppTransitionController.java @@ -440,6 +440,16 @@ 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(