Fix getAnimationTargets so that it returns valid animation target

AppTransitionController#getAnimationTargets traverse ancestors of
activity to find animation targets. Previously it can reach
DisplayContent#mWindowContainers which does not inherit
WindowContainer#createRemoteAnimationTarget thus cannot be a remote
animation target.

After this CL, getAnimationTargets stops traversing if it reaches
WindowContainer which cannot be a remote animation target.

Bug: 149716548
Test: None
Change-Id: Ie94ab8ecd35e9dcc28d0b8f7aaeb058e15b0f80b
This commit is contained in:
Daichi Hirono
2020-02-18 16:28:03 +09:00
parent bb4af580d1
commit 8ecfc6b2df
4 changed files with 15 additions and 1 deletions

View File

@@ -7568,6 +7568,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
record.mStartBounds);
}
@Override
boolean canCreateRemoteAnimationTarget() {
return true;
}
@Override
void getAnimationFrames(Rect outFrame, Rect outInsets, Rect outStableInsets,
Rect outSurfaceInsets) {

View File

@@ -446,7 +446,7 @@ public class AppTransitionController {
siblings.add(current);
boolean canPromote = true;
if (parent == null) {
if (parent == null || !parent.canCreateRemoteAnimationTarget()) {
canPromote = false;
} else {
// In case a descendant of the parent belongs to the other group, we cannot promote

View File

@@ -3087,6 +3087,11 @@ class Task extends WindowContainer<WindowContainer> {
return activity != null ? activity.createRemoteAnimationTarget(record) : null;
}
@Override
boolean canCreateRemoteAnimationTarget() {
return true;
}
WindowState getTopVisibleAppMainWindow() {
final ActivityRecord activity = getTopVisibleActivity();
return activity != null ? activity.findMainWindow() : null;

View File

@@ -2186,6 +2186,10 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
return null;
}
boolean canCreateRemoteAnimationTarget() {
return false;
}
boolean okToDisplay() {
final DisplayContent dc = getDisplayContent();
return dc != null && dc.okToDisplay();