From 80e1487735f41972efb646c5a6e504e2844cbbd0 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Mon, 26 Jul 2021 22:13:22 +0800 Subject: [PATCH] Allow task fragment to use higher animation level The method canCreateRemoteAnimationTarget was used to decide whether to promote the animation level for transition. E.g. If 2 activities in task fragment of the same task are opening, the animation target should be the task instead of the 2 activities individually. The method createRemoteAnimationTarget is also moved from Task to TaskFragment for consistency of the ability to create the animation target. Test: Move a task with embedded activities to front. Bug: 194673563 Change-Id: I51aed380d0a20ce7981bf5d1911dfa82d8b54165 --- services/core/java/com/android/server/wm/Task.java | 13 ------------- .../java/com/android/server/wm/TaskFragment.java | 13 +++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index 5ffe7b6eaf6db..abe62e9ea31b3 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -180,7 +180,6 @@ import android.util.TypedXmlSerializer; import android.util.proto.ProtoOutputStream; import android.view.DisplayInfo; import android.view.RemoteAnimationAdapter; -import android.view.RemoteAnimationTarget; import android.view.Surface; import android.view.SurfaceControl; import android.view.WindowManager; @@ -3031,18 +3030,6 @@ class Task extends TaskFragment { return isAnimating(CHILDREN, ANIMATION_TYPE_RECENTS); } - @Override - RemoteAnimationTarget createRemoteAnimationTarget( - RemoteAnimationController.RemoteAnimationRecord record) { - final ActivityRecord activity = getTopMostActivity(); - return activity != null ? activity.createRemoteAnimationTarget(record) : null; - } - - @Override - boolean canCreateRemoteAnimationTarget() { - return true; - } - WindowState getTopVisibleAppMainWindow() { final ActivityRecord activity = getTopVisibleActivity(); return activity != null ? activity.findMainWindow() : null; diff --git a/services/core/java/com/android/server/wm/TaskFragment.java b/services/core/java/com/android/server/wm/TaskFragment.java index 9159bbb626200..89165518a8863 100644 --- a/services/core/java/com/android/server/wm/TaskFragment.java +++ b/services/core/java/com/android/server/wm/TaskFragment.java @@ -83,6 +83,7 @@ import android.util.DisplayMetrics; import android.util.Slog; import android.util.proto.ProtoOutputStream; import android.view.DisplayInfo; +import android.view.RemoteAnimationTarget; import android.view.SurfaceControl; import android.window.ITaskFragmentOrganizer; import android.window.TaskFragmentInfo; @@ -1486,6 +1487,18 @@ class TaskFragment extends WindowContainer { // No app transition applied to the task fragment. } + @Override + RemoteAnimationTarget createRemoteAnimationTarget( + RemoteAnimationController.RemoteAnimationRecord record) { + final ActivityRecord activity = getTopMostActivity(); + return activity != null ? activity.createRemoteAnimationTarget(record) : null; + } + + @Override + boolean canCreateRemoteAnimationTarget() { + return true; + } + boolean shouldSleepActivities() { return false; }