Loading packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteAnimationTargetCompat.java +51 −11 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.shared.system; import static android.view.WindowManager.LayoutParams.INVALID_WINDOW_TYPE; import static android.view.WindowManager.TRANSIT_CHANGE; import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_OPEN; import static android.view.WindowManager.TRANSIT_TO_BACK; Loading @@ -31,6 +32,7 @@ import android.app.WindowConfiguration; import android.graphics.Point; import android.graphics.Rect; import android.util.ArrayMap; import android.util.SparseArray; import android.view.RemoteAnimationTarget; import android.view.SurfaceControl; import android.view.WindowManager; Loading @@ -55,7 +57,7 @@ public class RemoteAnimationTargetCompat { public static final int ACTIVITY_TYPE_ASSISTANT = WindowConfiguration.ACTIVITY_TYPE_ASSISTANT; public final int activityType; public final int taskId; public int taskId; public final SurfaceControl leash; public final boolean isTranslucent; public final Rect clipRect; Loading @@ -67,7 +69,7 @@ public class RemoteAnimationTargetCompat { public final Rect startScreenSpaceBounds; public final boolean isNotInRecents; public final Rect contentInsets; public final ActivityManager.RunningTaskInfo taskInfo; public ActivityManager.RunningTaskInfo taskInfo; public final boolean allowEnterPip; public final int rotationChange; public final int windowType; Loading Loading @@ -139,12 +141,21 @@ public class RemoteAnimationTargetCompat { // changes should be ordered top-to-bottom in z final int mode = change.getMode(); // Launcher animates leaf tasks directly, so always reparent all task leashes to root leash. // Don't move anything that isn't independent within its parents if (!TransitionInfo.isIndependent(change, info)) { if (mode == TRANSIT_OPEN || mode == TRANSIT_TO_FRONT || mode == TRANSIT_CHANGE) { t.setPosition(leash, change.getEndRelOffset().x, change.getEndRelOffset().y); } return; } final boolean hasParent = change.getParent() != null; if (!hasParent) { t.reparent(leash, info.getRootLeash()); t.setPosition(leash, change.getStartAbsBounds().left - info.getRootOffset().x, change.getStartAbsBounds().top - info.getRootOffset().y); t.show(leash); } // Put all the OPEN/SHOW on top if (mode == TRANSIT_OPEN || mode == TRANSIT_TO_FRONT) { if (isOpening) { Loading Loading @@ -181,8 +192,12 @@ public class RemoteAnimationTargetCompat { } SurfaceControl leashSurface = new SurfaceControl.Builder() .setName(change.getLeash().toString() + "_transition-leash") .setContainerLayer().setParent(change.getParent() == null ? info.getRootLeash() : info.getChange(change.getParent()).getLeash()).build(); .setContainerLayer() // Initial the surface visible to respect the visibility of the original surface. .setHidden(false) .setParent(change.getParent() == null ? info.getRootLeash() : info.getChange(change.getParent()).getLeash()) .build(); // Copied Transitions setup code (which expects bottom-to-top order, so we swap here) setupLeash(leashSurface, change, info.getChanges().size() - order, info, t); t.reparent(change.getLeash(), leashSurface); Loading Loading @@ -253,17 +268,42 @@ public class RemoteAnimationTargetCompat { public static RemoteAnimationTargetCompat[] wrap(TransitionInfo info, boolean wallpapers, SurfaceControl.Transaction t, ArrayMap<SurfaceControl, SurfaceControl> leashMap) { final ArrayList<RemoteAnimationTargetCompat> out = new ArrayList<>(); final SparseArray<RemoteAnimationTargetCompat> childTaskTargets = new SparseArray<>(); for (int i = 0; i < info.getChanges().size(); i++) { final TransitionInfo.Change change = info.getChanges().get(i); final boolean changeIsWallpaper = (change.getFlags() & TransitionInfo.FLAG_IS_WALLPAPER) != 0; if (wallpapers != changeIsWallpaper) continue; out.add(new RemoteAnimationTargetCompat(change, info.getChanges().size() - i, info, t)); final RemoteAnimationTargetCompat targetCompat = new RemoteAnimationTargetCompat(change, info.getChanges().size() - i, info, t); if (leashMap != null) { leashMap.put(change.getLeash(), out.get(out.size() - 1).leash); leashMap.put(change.getLeash(), targetCompat.leash); } final ActivityManager.RunningTaskInfo taskInfo = change.getTaskInfo(); if (taskInfo != null) { if (taskInfo.parentTaskId != -1) { // Cache child task targets to override its parent target later and exclude // child task while wrapping up animate targets. Otherwise the child task might // get transformed twice with the flow like RecentsView#redrawLiveTile. childTaskTargets.put(taskInfo.parentTaskId, targetCompat); continue; } final RemoteAnimationTargetCompat childTaskTarget = childTaskTargets.get(taskInfo.taskId); if (childTaskTarget != null) { // Launcher monitors leaf tasks to perform animation, hence override the parent // task target with child task info so Launcher can locate and animate root // surface directly with leaf task information. targetCompat.taskInfo = childTaskTarget.taskInfo; targetCompat.taskId = childTaskTarget.taskId; } } out.add(targetCompat); } return out.toArray(new RemoteAnimationTargetCompat[out.size()]); } Loading Loading
packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteAnimationTargetCompat.java +51 −11 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.shared.system; import static android.view.WindowManager.LayoutParams.INVALID_WINDOW_TYPE; import static android.view.WindowManager.TRANSIT_CHANGE; import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_OPEN; import static android.view.WindowManager.TRANSIT_TO_BACK; Loading @@ -31,6 +32,7 @@ import android.app.WindowConfiguration; import android.graphics.Point; import android.graphics.Rect; import android.util.ArrayMap; import android.util.SparseArray; import android.view.RemoteAnimationTarget; import android.view.SurfaceControl; import android.view.WindowManager; Loading @@ -55,7 +57,7 @@ public class RemoteAnimationTargetCompat { public static final int ACTIVITY_TYPE_ASSISTANT = WindowConfiguration.ACTIVITY_TYPE_ASSISTANT; public final int activityType; public final int taskId; public int taskId; public final SurfaceControl leash; public final boolean isTranslucent; public final Rect clipRect; Loading @@ -67,7 +69,7 @@ public class RemoteAnimationTargetCompat { public final Rect startScreenSpaceBounds; public final boolean isNotInRecents; public final Rect contentInsets; public final ActivityManager.RunningTaskInfo taskInfo; public ActivityManager.RunningTaskInfo taskInfo; public final boolean allowEnterPip; public final int rotationChange; public final int windowType; Loading Loading @@ -139,12 +141,21 @@ public class RemoteAnimationTargetCompat { // changes should be ordered top-to-bottom in z final int mode = change.getMode(); // Launcher animates leaf tasks directly, so always reparent all task leashes to root leash. // Don't move anything that isn't independent within its parents if (!TransitionInfo.isIndependent(change, info)) { if (mode == TRANSIT_OPEN || mode == TRANSIT_TO_FRONT || mode == TRANSIT_CHANGE) { t.setPosition(leash, change.getEndRelOffset().x, change.getEndRelOffset().y); } return; } final boolean hasParent = change.getParent() != null; if (!hasParent) { t.reparent(leash, info.getRootLeash()); t.setPosition(leash, change.getStartAbsBounds().left - info.getRootOffset().x, change.getStartAbsBounds().top - info.getRootOffset().y); t.show(leash); } // Put all the OPEN/SHOW on top if (mode == TRANSIT_OPEN || mode == TRANSIT_TO_FRONT) { if (isOpening) { Loading Loading @@ -181,8 +192,12 @@ public class RemoteAnimationTargetCompat { } SurfaceControl leashSurface = new SurfaceControl.Builder() .setName(change.getLeash().toString() + "_transition-leash") .setContainerLayer().setParent(change.getParent() == null ? info.getRootLeash() : info.getChange(change.getParent()).getLeash()).build(); .setContainerLayer() // Initial the surface visible to respect the visibility of the original surface. .setHidden(false) .setParent(change.getParent() == null ? info.getRootLeash() : info.getChange(change.getParent()).getLeash()) .build(); // Copied Transitions setup code (which expects bottom-to-top order, so we swap here) setupLeash(leashSurface, change, info.getChanges().size() - order, info, t); t.reparent(change.getLeash(), leashSurface); Loading Loading @@ -253,17 +268,42 @@ public class RemoteAnimationTargetCompat { public static RemoteAnimationTargetCompat[] wrap(TransitionInfo info, boolean wallpapers, SurfaceControl.Transaction t, ArrayMap<SurfaceControl, SurfaceControl> leashMap) { final ArrayList<RemoteAnimationTargetCompat> out = new ArrayList<>(); final SparseArray<RemoteAnimationTargetCompat> childTaskTargets = new SparseArray<>(); for (int i = 0; i < info.getChanges().size(); i++) { final TransitionInfo.Change change = info.getChanges().get(i); final boolean changeIsWallpaper = (change.getFlags() & TransitionInfo.FLAG_IS_WALLPAPER) != 0; if (wallpapers != changeIsWallpaper) continue; out.add(new RemoteAnimationTargetCompat(change, info.getChanges().size() - i, info, t)); final RemoteAnimationTargetCompat targetCompat = new RemoteAnimationTargetCompat(change, info.getChanges().size() - i, info, t); if (leashMap != null) { leashMap.put(change.getLeash(), out.get(out.size() - 1).leash); leashMap.put(change.getLeash(), targetCompat.leash); } final ActivityManager.RunningTaskInfo taskInfo = change.getTaskInfo(); if (taskInfo != null) { if (taskInfo.parentTaskId != -1) { // Cache child task targets to override its parent target later and exclude // child task while wrapping up animate targets. Otherwise the child task might // get transformed twice with the flow like RecentsView#redrawLiveTile. childTaskTargets.put(taskInfo.parentTaskId, targetCompat); continue; } final RemoteAnimationTargetCompat childTaskTarget = childTaskTargets.get(taskInfo.taskId); if (childTaskTarget != null) { // Launcher monitors leaf tasks to perform animation, hence override the parent // task target with child task info so Launcher can locate and animate root // surface directly with leaf task information. targetCompat.taskInfo = childTaskTarget.taskInfo; targetCompat.taskId = childTaskTarget.taskId; } } out.add(targetCompat); } return out.toArray(new RemoteAnimationTargetCompat[out.size()]); } Loading