Merge "[Shell-transition]: More checking animating state methods" into tm-dev

This commit is contained in:
TreeHugger Robot
2022-03-01 10:30:43 +00:00
committed by Android (Google) Code Review
4 changed files with 54 additions and 4 deletions

View File

@@ -3248,7 +3248,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
// the best capture timing (e.g. IME window capture), // the best capture timing (e.g. IME window capture),
// No need additional task capture while task is controlled by RecentsAnimation. // No need additional task capture while task is controlled by RecentsAnimation.
if (mAtmService.mWindowManager.mTaskSnapshotController != null if (mAtmService.mWindowManager.mTaskSnapshotController != null
&& !task.isAnimatingByRecents()) { && !(task.isAnimatingByRecents()
|| mTransitionController.inRecentsTransition(task))) {
final ArraySet<Task> tasks = Sets.newArraySet(task); final ArraySet<Task> tasks = Sets.newArraySet(task);
mAtmService.mWindowManager.mTaskSnapshotController.snapshotTasks(tasks); mAtmService.mWindowManager.mTaskSnapshotController.snapshotTasks(tasks);
mAtmService.mWindowManager.mTaskSnapshotController mAtmService.mWindowManager.mTaskSnapshotController

View File

@@ -534,7 +534,7 @@ class TaskSnapshotController {
// Since RecentsAnimation will handle task snapshot while switching apps with the // Since RecentsAnimation will handle task snapshot while switching apps with the
// best capture timing (e.g. IME window capture), // best capture timing (e.g. IME window capture),
// No need additional task capture while task is controlled by RecentsAnimation. // No need additional task capture while task is controlled by RecentsAnimation.
if (task.isAnimatingByRecents()) { if (isAnimatingByRecents(task)) {
mSkipClosingAppSnapshotTasks.add(task); mSkipClosingAppSnapshotTasks.add(task);
} }
// If the task of the app is not visible anymore, it means no other app in that task // If the task of the app is not visible anymore, it means no other app in that task
@@ -686,7 +686,7 @@ class TaskSnapshotController {
// Since RecentsAnimation will handle task snapshot while switching apps with the best // Since RecentsAnimation will handle task snapshot while switching apps with the best
// capture timing (e.g. IME window capture), No need additional task capture while task // capture timing (e.g. IME window capture), No need additional task capture while task
// is controlled by RecentsAnimation. // is controlled by RecentsAnimation.
if (task.isVisible() && !task.isAnimatingByRecents()) { if (task.isVisible() && !isAnimatingByRecents(task)) {
mTmpTasks.add(task); mTmpTasks.add(task);
} }
}); });
@@ -717,6 +717,11 @@ class TaskSnapshotController {
frame, Type.systemBars(), false /* ignoreVisibility */).toRect(); frame, Type.systemBars(), false /* ignoreVisibility */).toRect();
} }
private boolean isAnimatingByRecents(@NonNull Task task) {
return task.isAnimatingByRecents()
|| mService.mAtmService.getTransitionController().inRecentsTransition(task);
}
void dump(PrintWriter pw, String prefix) { void dump(PrintWriter pw, String prefix) {
pw.println(prefix + "mHighResTaskSnapshotScale=" + mHighResTaskSnapshotScale); pw.println(prefix + "mHighResTaskSnapshotScale=" + mHighResTaskSnapshotScale);
pw.println(prefix + "mTaskSnapshotEnabled=" + mTaskSnapshotEnabled); pw.println(prefix + "mTaskSnapshotEnabled=" + mTaskSnapshotEnabled);

View File

@@ -245,7 +245,7 @@ class TransitionController {
/** @return {@code true} if wc is in a participant subtree */ /** @return {@code true} if wc is in a participant subtree */
boolean inTransition(@NonNull WindowContainer wc) { boolean inTransition(@NonNull WindowContainer wc) {
if (isCollecting(wc)) return true; if (isCollecting(wc)) return true;
for (int i = mPlayingTransitions.size() - 1; i >= 0; --i) { for (int i = mPlayingTransitions.size() - 1; i >= 0; --i) {
for (WindowContainer p = wc; p != null; p = p.getParent()) { for (WindowContainer p = wc; p != null; p = p.getParent()) {
if (mPlayingTransitions.get(i).mParticipants.contains(p)) { if (mPlayingTransitions.get(i).mParticipants.contains(p)) {
@@ -256,6 +256,28 @@ class TransitionController {
return false; return false;
} }
boolean inRecentsTransition(@NonNull WindowContainer wc) {
for (WindowContainer p = wc; p != null; p = p.getParent()) {
// TODO(b/221417431): replace this with deterministic snapshots
if (mCollectingTransition == null) break;
if ((mCollectingTransition.getFlags() & TRANSIT_FLAG_IS_RECENTS) != 0
&& mCollectingTransition.mParticipants.contains(wc)) {
return true;
}
}
for (int i = mPlayingTransitions.size() - 1; i >= 0; --i) {
for (WindowContainer p = wc; p != null; p = p.getParent()) {
// TODO(b/221417431): replace this with deterministic snapshots
if ((mPlayingTransitions.get(i).getFlags() & TRANSIT_FLAG_IS_RECENTS) != 0
&& mPlayingTransitions.get(i).mParticipants.contains(p)) {
return true;
}
}
}
return false;
}
/** @return {@code true} if wc is in a participant subtree */ /** @return {@code true} if wc is in a participant subtree */
boolean isTransitionOnDisplay(@NonNull DisplayContent dc) { boolean isTransitionOnDisplay(@NonNull DisplayContent dc) {
if (mCollectingTransition != null && mCollectingTransition.isOnDisplay(dc)) { if (mCollectingTransition != null && mCollectingTransition.isOnDisplay(dc)) {

View File

@@ -47,6 +47,7 @@ import static com.android.server.wm.IdentifierProto.TITLE;
import static com.android.server.wm.IdentifierProto.USER_ID; import static com.android.server.wm.IdentifierProto.USER_ID;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_ALL; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_ALL;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_RECENTS;
import static com.android.server.wm.WindowContainer.AnimationFlags.CHILDREN; import static com.android.server.wm.WindowContainer.AnimationFlags.CHILDREN;
import static com.android.server.wm.WindowContainer.AnimationFlags.PARENTS; import static com.android.server.wm.WindowContainer.AnimationFlags.PARENTS;
import static com.android.server.wm.WindowContainer.AnimationFlags.TRANSITION; import static com.android.server.wm.WindowContainer.AnimationFlags.TRANSITION;
@@ -1173,6 +1174,27 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
return mTransitionController.inTransition(this); return mTransitionController.inTransition(this);
} }
boolean inAppOrRecentsTransition() {
if (!mTransitionController.isShellTransitionsEnabled()) {
return isAnimating(PARENTS | TRANSITION,
ANIMATION_TYPE_APP_TRANSITION | ANIMATION_TYPE_RECENTS);
}
for (WindowContainer p = this; p != null; p = p.getParent()) {
if (mTransitionController.isCollecting(p)) {
return true;
}
}
if (inTransition() || mTransitionController.inRecentsTransition(this)) return true;
for (int i = mChildren.size() - 1; i >= 0; --i) {
WindowContainer child = mChildren.get(i);
if (child.inAppOrRecentsTransition()) {
return true;
}
}
return false;
}
void sendAppVisibilityToClients() { void sendAppVisibilityToClients() {
for (int i = mChildren.size() - 1; i >= 0; --i) { for (int i = mChildren.size() - 1; i >= 0; --i) {
final WindowContainer wc = mChildren.get(i); final WindowContainer wc = mChildren.get(i);