Merge "Removing RemoteAnimationTargetCompat and using RemoteAnimationTarget directly" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
db5c8259e4
@@ -194,12 +194,8 @@ public class ActivityManagerWrapper {
|
||||
Rect homeContentInsets, Rect minimizedHomeBounds) {
|
||||
final RecentsAnimationControllerCompat controllerCompat =
|
||||
new RecentsAnimationControllerCompat(controller);
|
||||
final RemoteAnimationTargetCompat[] appsCompat =
|
||||
RemoteAnimationTargetCompat.wrap(apps);
|
||||
final RemoteAnimationTargetCompat[] wallpapersCompat =
|
||||
RemoteAnimationTargetCompat.wrap(wallpapers);
|
||||
animationHandler.onAnimationStart(controllerCompat, appsCompat,
|
||||
wallpapersCompat, homeContentInsets, minimizedHomeBounds);
|
||||
animationHandler.onAnimationStart(controllerCompat, apps,
|
||||
wallpapers, homeContentInsets, minimizedHomeBounds);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -210,12 +206,7 @@ public class ActivityManagerWrapper {
|
||||
|
||||
@Override
|
||||
public void onTasksAppeared(RemoteAnimationTarget[] apps) {
|
||||
final RemoteAnimationTargetCompat[] compats =
|
||||
new RemoteAnimationTargetCompat[apps.length];
|
||||
for (int i = 0; i < apps.length; ++i) {
|
||||
compats[i] = new RemoteAnimationTargetCompat(apps[i]);
|
||||
}
|
||||
animationHandler.onTasksAppeared(compats);
|
||||
animationHandler.onTasksAppeared(apps);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.systemui.shared.system;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.view.RemoteAnimationTarget;
|
||||
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||
|
||||
@@ -27,7 +28,7 @@ public interface RecentsAnimationListener {
|
||||
* Called when the animation into Recents can start. This call is made on the binder thread.
|
||||
*/
|
||||
void onAnimationStart(RecentsAnimationControllerCompat controller,
|
||||
RemoteAnimationTargetCompat[] apps, RemoteAnimationTargetCompat[] wallpapers,
|
||||
RemoteAnimationTarget[] apps, RemoteAnimationTarget[] wallpapers,
|
||||
Rect homeContentInsets, Rect minimizedHomeBounds);
|
||||
|
||||
/**
|
||||
@@ -39,7 +40,7 @@ public interface RecentsAnimationListener {
|
||||
* Called when the task of an activity that has been started while the recents animation
|
||||
* was running becomes ready for control.
|
||||
*/
|
||||
void onTasksAppeared(RemoteAnimationTargetCompat[] app);
|
||||
void onTasksAppeared(RemoteAnimationTarget[] app);
|
||||
|
||||
/**
|
||||
* Called to request that the current task tile be switched out for a screenshot (if not
|
||||
|
||||
@@ -83,12 +83,6 @@ public class RemoteAnimationAdapterCompat {
|
||||
RemoteAnimationTarget[] wallpapers,
|
||||
RemoteAnimationTarget[] nonApps,
|
||||
final IRemoteAnimationFinishedCallback finishedCallback) {
|
||||
final RemoteAnimationTargetCompat[] appsCompat =
|
||||
RemoteAnimationTargetCompat.wrap(apps);
|
||||
final RemoteAnimationTargetCompat[] wallpapersCompat =
|
||||
RemoteAnimationTargetCompat.wrap(wallpapers);
|
||||
final RemoteAnimationTargetCompat[] nonAppsCompat =
|
||||
RemoteAnimationTargetCompat.wrap(nonApps);
|
||||
final Runnable animationFinishedCallback = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -100,8 +94,8 @@ public class RemoteAnimationAdapterCompat {
|
||||
}
|
||||
}
|
||||
};
|
||||
remoteAnimationAdapter.onAnimationStart(transit, appsCompat, wallpapersCompat,
|
||||
nonAppsCompat, animationFinishedCallback);
|
||||
remoteAnimationAdapter.onAnimationStart(transit, apps, wallpapers,
|
||||
nonApps, animationFinishedCallback);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -121,12 +115,12 @@ public class RemoteAnimationAdapterCompat {
|
||||
SurfaceControl.Transaction t,
|
||||
IRemoteTransitionFinishedCallback finishCallback) {
|
||||
final ArrayMap<SurfaceControl, SurfaceControl> leashMap = new ArrayMap<>();
|
||||
final RemoteAnimationTargetCompat[] appsCompat =
|
||||
final RemoteAnimationTarget[] apps =
|
||||
RemoteAnimationTargetCompat.wrapApps(info, t, leashMap);
|
||||
final RemoteAnimationTargetCompat[] wallpapersCompat =
|
||||
final RemoteAnimationTarget[] wallpapers =
|
||||
RemoteAnimationTargetCompat.wrapNonApps(
|
||||
info, true /* wallpapers */, t, leashMap);
|
||||
final RemoteAnimationTargetCompat[] nonAppsCompat =
|
||||
final RemoteAnimationTarget[] nonApps =
|
||||
RemoteAnimationTargetCompat.wrapNonApps(
|
||||
info, false /* wallpapers */, t, leashMap);
|
||||
|
||||
@@ -189,9 +183,9 @@ public class RemoteAnimationAdapterCompat {
|
||||
}
|
||||
}
|
||||
// Make wallpaper visible immediately since launcher apparently won't do this.
|
||||
for (int i = wallpapersCompat.length - 1; i >= 0; --i) {
|
||||
t.show(wallpapersCompat[i].leash);
|
||||
t.setAlpha(wallpapersCompat[i].leash, 1.f);
|
||||
for (int i = wallpapers.length - 1; i >= 0; --i) {
|
||||
t.show(wallpapers[i].leash);
|
||||
t.setAlpha(wallpapers[i].leash, 1.f);
|
||||
}
|
||||
} else {
|
||||
if (launcherTask != null) {
|
||||
@@ -237,7 +231,7 @@ public class RemoteAnimationAdapterCompat {
|
||||
}
|
||||
// TODO(bc-unlcok): Pass correct transit type.
|
||||
remoteAnimationAdapter.onAnimationStart(TRANSIT_OLD_NONE,
|
||||
appsCompat, wallpapersCompat, nonAppsCompat, () -> {
|
||||
apps, wallpapers, nonApps, () -> {
|
||||
synchronized (mFinishRunnables) {
|
||||
if (mFinishRunnables.remove(token) == null) return;
|
||||
}
|
||||
|
||||
@@ -16,11 +16,12 @@
|
||||
|
||||
package com.android.systemui.shared.system;
|
||||
|
||||
import android.view.RemoteAnimationTarget;
|
||||
import android.view.WindowManager;
|
||||
|
||||
public interface RemoteAnimationRunnerCompat {
|
||||
void onAnimationStart(@WindowManager.TransitionOldType int transit,
|
||||
RemoteAnimationTargetCompat[] apps, RemoteAnimationTargetCompat[] wallpapers,
|
||||
RemoteAnimationTargetCompat[] nonApps, Runnable finishedCallback);
|
||||
RemoteAnimationTarget[] apps, RemoteAnimationTarget[] wallpapers,
|
||||
RemoteAnimationTarget[] nonApps, Runnable finishedCallback);
|
||||
void onAnimationCancelled();
|
||||
}
|
||||
@@ -11,12 +11,15 @@
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.systemui.shared.system;
|
||||
|
||||
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
|
||||
import static android.view.RemoteAnimationTarget.MODE_CHANGING;
|
||||
import static android.view.RemoteAnimationTarget.MODE_CLOSING;
|
||||
import static android.view.RemoteAnimationTarget.MODE_OPENING;
|
||||
import static android.view.WindowManager.LayoutParams.INVALID_WINDOW_TYPE;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
|
||||
import static android.view.WindowManager.TRANSIT_CLOSE;
|
||||
@@ -29,88 +32,28 @@ import static android.window.TransitionInfo.FLAG_STARTING_WINDOW_TRANSFER_RECIPI
|
||||
import static com.android.wm.shell.common.split.SplitScreenConstants.FLAG_IS_DIVIDER_BAR;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.TaskInfo;
|
||||
import android.app.WindowConfiguration;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.SparseArray;
|
||||
import android.util.SparseBooleanArray;
|
||||
import android.view.RemoteAnimationTarget;
|
||||
import android.view.SurfaceControl;
|
||||
import android.view.WindowManager;
|
||||
import android.window.TransitionInfo;
|
||||
import android.window.TransitionInfo.Change;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.function.BiPredicate;
|
||||
|
||||
/**
|
||||
* @see RemoteAnimationTarget
|
||||
* Some utility methods for creating {@link RemoteAnimationTarget} instances.
|
||||
*/
|
||||
public class RemoteAnimationTargetCompat {
|
||||
|
||||
public static final int MODE_OPENING = RemoteAnimationTarget.MODE_OPENING;
|
||||
public static final int MODE_CLOSING = RemoteAnimationTarget.MODE_CLOSING;
|
||||
public static final int MODE_CHANGING = RemoteAnimationTarget.MODE_CHANGING;
|
||||
public final int mode;
|
||||
|
||||
public static final int ACTIVITY_TYPE_UNDEFINED = WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
|
||||
public static final int ACTIVITY_TYPE_STANDARD = WindowConfiguration.ACTIVITY_TYPE_STANDARD;
|
||||
public static final int ACTIVITY_TYPE_HOME = WindowConfiguration.ACTIVITY_TYPE_HOME;
|
||||
public static final int ACTIVITY_TYPE_RECENTS = WindowConfiguration.ACTIVITY_TYPE_RECENTS;
|
||||
public static final int ACTIVITY_TYPE_ASSISTANT = WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;
|
||||
public final int activityType;
|
||||
|
||||
public final int taskId;
|
||||
public final SurfaceControl leash;
|
||||
public final boolean isTranslucent;
|
||||
public final Rect clipRect;
|
||||
public final int prefixOrderIndex;
|
||||
public final Point position;
|
||||
public final Rect localBounds;
|
||||
public final Rect sourceContainerBounds;
|
||||
public final Rect screenSpaceBounds;
|
||||
public final Rect startScreenSpaceBounds;
|
||||
public final boolean isNotInRecents;
|
||||
public final Rect contentInsets;
|
||||
public final ActivityManager.RunningTaskInfo taskInfo;
|
||||
public final boolean allowEnterPip;
|
||||
public final int rotationChange;
|
||||
public final int windowType;
|
||||
public final WindowConfiguration windowConfiguration;
|
||||
|
||||
private final SurfaceControl mStartLeash;
|
||||
|
||||
// Fields used only to unwrap into RemoteAnimationTarget
|
||||
private final Rect startBounds;
|
||||
|
||||
public final boolean willShowImeOnTarget;
|
||||
|
||||
public RemoteAnimationTargetCompat(RemoteAnimationTarget app) {
|
||||
taskId = app.taskId;
|
||||
mode = app.mode;
|
||||
leash = app.leash;
|
||||
isTranslucent = app.isTranslucent;
|
||||
clipRect = app.clipRect;
|
||||
position = app.position;
|
||||
localBounds = app.localBounds;
|
||||
sourceContainerBounds = app.sourceContainerBounds;
|
||||
screenSpaceBounds = app.screenSpaceBounds;
|
||||
startScreenSpaceBounds = screenSpaceBounds;
|
||||
prefixOrderIndex = app.prefixOrderIndex;
|
||||
isNotInRecents = app.isNotInRecents;
|
||||
contentInsets = app.contentInsets;
|
||||
activityType = app.windowConfiguration.getActivityType();
|
||||
taskInfo = app.taskInfo;
|
||||
allowEnterPip = app.allowEnterPip;
|
||||
rotationChange = app.rotationChange;
|
||||
|
||||
mStartLeash = app.startLeash;
|
||||
windowType = app.windowType;
|
||||
windowConfiguration = app.windowConfiguration;
|
||||
startBounds = app.startBounds;
|
||||
willShowImeOnTarget = app.willShowImeOnTarget;
|
||||
}
|
||||
|
||||
private static int newModeToLegacyMode(int newMode) {
|
||||
switch (newMode) {
|
||||
case WindowManager.TRANSIT_OPEN:
|
||||
@@ -120,21 +63,10 @@ public class RemoteAnimationTargetCompat {
|
||||
case WindowManager.TRANSIT_TO_BACK:
|
||||
return MODE_CLOSING;
|
||||
default:
|
||||
return 2; // MODE_CHANGING
|
||||
return MODE_CHANGING;
|
||||
}
|
||||
}
|
||||
|
||||
public RemoteAnimationTarget unwrap() {
|
||||
final RemoteAnimationTarget target = new RemoteAnimationTarget(
|
||||
taskId, mode, leash, isTranslucent, clipRect, contentInsets,
|
||||
prefixOrderIndex, position, localBounds, screenSpaceBounds, windowConfiguration,
|
||||
isNotInRecents, mStartLeash, startBounds, taskInfo, allowEnterPip, windowType
|
||||
);
|
||||
target.setWillShowImeOnTarget(willShowImeOnTarget);
|
||||
target.setRotationChange(rotationChange);
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Almost a copy of Transitions#setupStartState.
|
||||
* TODO: remove when there is proper cross-process transaction sync.
|
||||
@@ -206,54 +138,61 @@ public class RemoteAnimationTargetCompat {
|
||||
return leashSurface;
|
||||
}
|
||||
|
||||
public RemoteAnimationTargetCompat(TransitionInfo.Change change, int order,
|
||||
TransitionInfo info, SurfaceControl.Transaction t) {
|
||||
mode = newModeToLegacyMode(change.getMode());
|
||||
/**
|
||||
* Creates a new RemoteAnimationTarget from the provided change info
|
||||
*/
|
||||
public static RemoteAnimationTarget newTarget(TransitionInfo.Change change, int order,
|
||||
TransitionInfo info, SurfaceControl.Transaction t,
|
||||
@Nullable ArrayMap<SurfaceControl, SurfaceControl> leashMap) {
|
||||
int taskId;
|
||||
boolean isNotInRecents;
|
||||
ActivityManager.RunningTaskInfo taskInfo;
|
||||
WindowConfiguration windowConfiguration;
|
||||
|
||||
taskInfo = change.getTaskInfo();
|
||||
if (taskInfo != null) {
|
||||
taskId = taskInfo.taskId;
|
||||
isNotInRecents = !taskInfo.isRunning;
|
||||
activityType = taskInfo.getActivityType();
|
||||
windowConfiguration = taskInfo.configuration.windowConfiguration;
|
||||
} else {
|
||||
taskId = INVALID_TASK_ID;
|
||||
isNotInRecents = true;
|
||||
activityType = ACTIVITY_TYPE_UNDEFINED;
|
||||
windowConfiguration = new WindowConfiguration();
|
||||
}
|
||||
|
||||
// TODO: once we can properly sync transactions across process, then get rid of this leash.
|
||||
leash = createLeash(info, change, order, t);
|
||||
|
||||
isTranslucent = (change.getFlags() & TransitionInfo.FLAG_TRANSLUCENT) != 0;
|
||||
clipRect = null;
|
||||
position = null;
|
||||
localBounds = new Rect(change.getEndAbsBounds());
|
||||
Rect localBounds = new Rect(change.getEndAbsBounds());
|
||||
localBounds.offsetTo(change.getEndRelOffset().x, change.getEndRelOffset().y);
|
||||
sourceContainerBounds = null;
|
||||
screenSpaceBounds = new Rect(change.getEndAbsBounds());
|
||||
startScreenSpaceBounds = new Rect(change.getStartAbsBounds());
|
||||
|
||||
prefixOrderIndex = order;
|
||||
// TODO(shell-transitions): I guess we need to send content insets? evaluate how its used.
|
||||
contentInsets = new Rect(0, 0, 0, 0);
|
||||
allowEnterPip = change.getAllowEnterPip();
|
||||
mStartLeash = null;
|
||||
rotationChange = change.getEndRotation() - change.getStartRotation();
|
||||
windowType = (change.getFlags() & FLAG_IS_DIVIDER_BAR) != 0
|
||||
? TYPE_DOCK_DIVIDER : INVALID_WINDOW_TYPE;
|
||||
|
||||
startBounds = change.getStartAbsBounds();
|
||||
willShowImeOnTarget = (change.getFlags() & TransitionInfo.FLAG_WILL_IME_SHOWN) != 0;
|
||||
}
|
||||
|
||||
public static RemoteAnimationTargetCompat[] wrap(RemoteAnimationTarget[] apps) {
|
||||
final int length = apps != null ? apps.length : 0;
|
||||
final RemoteAnimationTargetCompat[] appsCompat = new RemoteAnimationTargetCompat[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
appsCompat[i] = new RemoteAnimationTargetCompat(apps[i]);
|
||||
RemoteAnimationTarget target = new RemoteAnimationTarget(
|
||||
taskId,
|
||||
newModeToLegacyMode(change.getMode()),
|
||||
// TODO: once we can properly sync transactions across process,
|
||||
// then get rid of this leash.
|
||||
createLeash(info, change, order, t),
|
||||
(change.getFlags() & TransitionInfo.FLAG_TRANSLUCENT) != 0,
|
||||
null,
|
||||
// TODO(shell-transitions): we need to send content insets? evaluate how its used.
|
||||
new Rect(0, 0, 0, 0),
|
||||
order,
|
||||
null,
|
||||
localBounds,
|
||||
new Rect(change.getEndAbsBounds()),
|
||||
windowConfiguration,
|
||||
isNotInRecents,
|
||||
null,
|
||||
new Rect(change.getStartAbsBounds()),
|
||||
taskInfo,
|
||||
change.getAllowEnterPip(),
|
||||
(change.getFlags() & FLAG_IS_DIVIDER_BAR) != 0
|
||||
? TYPE_DOCK_DIVIDER : INVALID_WINDOW_TYPE
|
||||
);
|
||||
target.setWillShowImeOnTarget(
|
||||
(change.getFlags() & TransitionInfo.FLAG_WILL_IME_SHOWN) != 0);
|
||||
target.setRotationChange(change.getEndRotation() - change.getStartRotation());
|
||||
if (leashMap != null) {
|
||||
leashMap.put(change.getLeash(), target.leash);
|
||||
}
|
||||
return appsCompat;
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -262,35 +201,20 @@ public class RemoteAnimationTargetCompat {
|
||||
* @param leashMap Temporary map of change leash -> launcher leash. Is an output, so should be
|
||||
* populated by this function. If null, it is ignored.
|
||||
*/
|
||||
public static RemoteAnimationTargetCompat[] wrapApps(TransitionInfo info,
|
||||
public static RemoteAnimationTarget[] wrapApps(TransitionInfo info,
|
||||
SurfaceControl.Transaction t, ArrayMap<SurfaceControl, SurfaceControl> leashMap) {
|
||||
final ArrayList<RemoteAnimationTargetCompat> out = new ArrayList<>();
|
||||
final SparseArray<TransitionInfo.Change> childTaskTargets = new SparseArray<>();
|
||||
for (int i = 0; i < info.getChanges().size(); i++) {
|
||||
final TransitionInfo.Change change = info.getChanges().get(i);
|
||||
if (change.getTaskInfo() == null) continue;
|
||||
|
||||
final ActivityManager.RunningTaskInfo taskInfo = change.getTaskInfo();
|
||||
SparseBooleanArray childTaskTargets = new SparseBooleanArray();
|
||||
return wrap(info, t, leashMap, (change, taskInfo) -> {
|
||||
// Children always come before parent since changes are in top-to-bottom z-order.
|
||||
if (taskInfo != null) {
|
||||
if (childTaskTargets.contains(taskInfo.taskId)) {
|
||||
// has children, so not a leaf. Skip.
|
||||
continue;
|
||||
}
|
||||
if (taskInfo.hasParentTask()) {
|
||||
childTaskTargets.put(taskInfo.parentTaskId, change);
|
||||
}
|
||||
if ((taskInfo == null) || childTaskTargets.get(taskInfo.taskId)) {
|
||||
// has children, so not a leaf. Skip.
|
||||
return false;
|
||||
}
|
||||
|
||||
final RemoteAnimationTargetCompat targetCompat =
|
||||
new RemoteAnimationTargetCompat(change, info.getChanges().size() - i, info, t);
|
||||
if (leashMap != null) {
|
||||
leashMap.put(change.getLeash(), targetCompat.leash);
|
||||
if (taskInfo.hasParentTask()) {
|
||||
childTaskTargets.put(taskInfo.parentTaskId, true);
|
||||
}
|
||||
out.add(targetCompat);
|
||||
}
|
||||
|
||||
return out.toArray(new RemoteAnimationTargetCompat[out.size()]);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -301,38 +225,22 @@ public class RemoteAnimationTargetCompat {
|
||||
* @param leashMap Temporary map of change leash -> launcher leash. Is an output, so should be
|
||||
* populated by this function. If null, it is ignored.
|
||||
*/
|
||||
public static RemoteAnimationTargetCompat[] wrapNonApps(TransitionInfo info, boolean wallpapers,
|
||||
public static RemoteAnimationTarget[] wrapNonApps(TransitionInfo info, boolean wallpapers,
|
||||
SurfaceControl.Transaction t, ArrayMap<SurfaceControl, SurfaceControl> leashMap) {
|
||||
final ArrayList<RemoteAnimationTargetCompat> out = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < info.getChanges().size(); i++) {
|
||||
final TransitionInfo.Change change = info.getChanges().get(i);
|
||||
if (change.getTaskInfo() != null) continue;
|
||||
|
||||
final boolean changeIsWallpaper =
|
||||
(change.getFlags() & TransitionInfo.FLAG_IS_WALLPAPER) != 0;
|
||||
if (wallpapers != changeIsWallpaper) continue;
|
||||
|
||||
final RemoteAnimationTargetCompat targetCompat =
|
||||
new RemoteAnimationTargetCompat(change, info.getChanges().size() - i, info, t);
|
||||
if (leashMap != null) {
|
||||
leashMap.put(change.getLeash(), targetCompat.leash);
|
||||
}
|
||||
out.add(targetCompat);
|
||||
}
|
||||
|
||||
return out.toArray(new RemoteAnimationTargetCompat[out.size()]);
|
||||
return wrap(info, t, leashMap, (change, taskInfo) -> (taskInfo == null)
|
||||
&& wallpapers == ((change.getFlags() & TransitionInfo.FLAG_IS_WALLPAPER) != 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SurfaceControl#release()
|
||||
*/
|
||||
public void release() {
|
||||
if (leash != null) {
|
||||
leash.release();
|
||||
}
|
||||
if (mStartLeash != null) {
|
||||
mStartLeash.release();
|
||||
private static RemoteAnimationTarget[] wrap(TransitionInfo info,
|
||||
SurfaceControl.Transaction t, ArrayMap<SurfaceControl, SurfaceControl> leashMap,
|
||||
BiPredicate<Change, TaskInfo> filter) {
|
||||
final ArrayList<RemoteAnimationTarget> out = new ArrayList<>();
|
||||
for (int i = 0; i < info.getChanges().size(); i++) {
|
||||
TransitionInfo.Change change = info.getChanges().get(i);
|
||||
if (filter.test(change, change.getTaskInfo())) {
|
||||
out.add(newTarget(change, info.getChanges().size() - i, info, t, leashMap));
|
||||
}
|
||||
}
|
||||
return out.toArray(new RemoteAnimationTarget[out.size()]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
package com.android.systemui.shared.system;
|
||||
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
|
||||
import static android.view.RemoteAnimationTarget.MODE_CLOSING;
|
||||
import static android.view.WindowManager.TRANSIT_CHANGE;
|
||||
import static android.view.WindowManager.TRANSIT_CLOSE;
|
||||
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
|
||||
@@ -27,8 +29,7 @@ import static android.view.WindowManager.TRANSIT_TO_BACK;
|
||||
import static android.view.WindowManager.TRANSIT_TO_FRONT;
|
||||
import static android.window.TransitionFilter.CONTAINER_ORDER_TOP;
|
||||
|
||||
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_RECENTS;
|
||||
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
|
||||
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.newTarget;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
@@ -45,6 +46,7 @@ import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.view.IRecentsAnimationController;
|
||||
import android.view.RemoteAnimationTarget;
|
||||
import android.view.SurfaceControl;
|
||||
import android.window.IRemoteTransition;
|
||||
import android.window.IRemoteTransitionFinishedCallback;
|
||||
@@ -127,9 +129,9 @@ public class RemoteTransitionCompat implements Parcelable {
|
||||
SurfaceControl.Transaction t,
|
||||
IRemoteTransitionFinishedCallback finishedCallback) {
|
||||
final ArrayMap<SurfaceControl, SurfaceControl> leashMap = new ArrayMap<>();
|
||||
final RemoteAnimationTargetCompat[] apps =
|
||||
final RemoteAnimationTarget[] apps =
|
||||
RemoteAnimationTargetCompat.wrapApps(info, t, leashMap);
|
||||
final RemoteAnimationTargetCompat[] wallpapers =
|
||||
final RemoteAnimationTarget[] wallpapers =
|
||||
RemoteAnimationTargetCompat.wrapNonApps(
|
||||
info, true /* wallpapers */, t, leashMap);
|
||||
// TODO(b/177438007): Move this set-up logic into launcher's animation impl.
|
||||
@@ -230,7 +232,7 @@ public class RemoteTransitionCompat implements Parcelable {
|
||||
private PictureInPictureSurfaceTransaction mPipTransaction = null;
|
||||
private IBinder mTransition = null;
|
||||
private boolean mKeyguardLocked = false;
|
||||
private RemoteAnimationTargetCompat[] mAppearedTargets;
|
||||
private RemoteAnimationTarget[] mAppearedTargets;
|
||||
private boolean mWillFinishToHome = false;
|
||||
|
||||
void setup(RecentsAnimationControllerCompat wrapped, TransitionInfo info,
|
||||
@@ -325,18 +327,15 @@ public class RemoteTransitionCompat implements Parcelable {
|
||||
final int layer = mInfo.getChanges().size() * 3;
|
||||
mOpeningLeashes = new ArrayList<>();
|
||||
mOpeningHome = cancelRecents;
|
||||
final RemoteAnimationTargetCompat[] targets =
|
||||
new RemoteAnimationTargetCompat[openingTasks.size()];
|
||||
final RemoteAnimationTarget[] targets =
|
||||
new RemoteAnimationTarget[openingTasks.size()];
|
||||
for (int i = 0; i < openingTasks.size(); ++i) {
|
||||
final TransitionInfo.Change change = openingTasks.valueAt(i);
|
||||
mOpeningLeashes.add(change.getLeash());
|
||||
// We are receiving new opening tasks, so convert to onTasksAppeared.
|
||||
final RemoteAnimationTargetCompat target = new RemoteAnimationTargetCompat(
|
||||
change, layer, info, t);
|
||||
mLeashMap.put(mOpeningLeashes.get(i), target.leash);
|
||||
t.reparent(target.leash, mInfo.getRootLeash());
|
||||
t.setLayer(target.leash, layer);
|
||||
targets[i] = target;
|
||||
targets[i] = newTarget(change, layer, info, t, mLeashMap);
|
||||
t.reparent(targets[i].leash, mInfo.getRootLeash());
|
||||
t.setLayer(targets[i].leash, layer);
|
||||
}
|
||||
t.apply();
|
||||
mAppearedTargets = targets;
|
||||
|
||||
@@ -16,6 +16,11 @@
|
||||
|
||||
package com.android.systemui.shared.system;
|
||||
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
|
||||
import static android.view.RemoteAnimationTarget.MODE_CHANGING;
|
||||
import static android.view.RemoteAnimationTarget.MODE_CLOSING;
|
||||
import static android.view.RemoteAnimationTarget.MODE_OPENING;
|
||||
import static android.view.WindowManager.TRANSIT_CHANGE;
|
||||
import static android.view.WindowManager.TRANSIT_CLOSE;
|
||||
import static android.view.WindowManager.TRANSIT_OPEN;
|
||||
@@ -25,11 +30,6 @@ import static android.window.TransitionInfo.FLAG_SHOW_WALLPAPER;
|
||||
import static android.window.TransitionInfo.FLAG_TRANSLUCENT;
|
||||
|
||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
|
||||
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME;
|
||||
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_STANDARD;
|
||||
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CHANGING;
|
||||
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
|
||||
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
@@ -40,6 +40,7 @@ import android.app.ActivityManager;
|
||||
import android.graphics.Rect;
|
||||
import android.testing.AndroidTestingRunner;
|
||||
import android.testing.TestableLooper;
|
||||
import android.view.RemoteAnimationTarget;
|
||||
import android.view.SurfaceControl;
|
||||
import android.view.WindowManager;
|
||||
import android.window.TransitionInfo;
|
||||
@@ -73,12 +74,12 @@ public class RemoteTransitionTest extends SysuiTestCase {
|
||||
.addChange(TRANSIT_OPEN, FLAG_IS_WALLPAPER, null /* taskInfo */)
|
||||
.addChange(TRANSIT_CHANGE, FLAG_FIRST_CUSTOM, null /* taskInfo */).build();
|
||||
// Check apps extraction
|
||||
RemoteAnimationTargetCompat[] wrapped = RemoteAnimationTargetCompat.wrapApps(combined,
|
||||
RemoteAnimationTarget[] wrapped = RemoteAnimationTargetCompat.wrapApps(combined,
|
||||
mock(SurfaceControl.Transaction.class), null /* leashes */);
|
||||
assertEquals(2, wrapped.length);
|
||||
int changeLayer = -1;
|
||||
int closeLayer = -1;
|
||||
for (RemoteAnimationTargetCompat t : wrapped) {
|
||||
for (RemoteAnimationTarget t : wrapped) {
|
||||
if (t.mode == MODE_CHANGING) {
|
||||
changeLayer = t.prefixOrderIndex;
|
||||
} else if (t.mode == MODE_CLOSING) {
|
||||
@@ -91,14 +92,14 @@ public class RemoteTransitionTest extends SysuiTestCase {
|
||||
assertTrue(closeLayer < changeLayer);
|
||||
|
||||
// Check wallpaper extraction
|
||||
RemoteAnimationTargetCompat[] wallps = RemoteAnimationTargetCompat.wrapNonApps(combined,
|
||||
RemoteAnimationTarget[] wallps = RemoteAnimationTargetCompat.wrapNonApps(combined,
|
||||
true /* wallpapers */, mock(SurfaceControl.Transaction.class), null /* leashes */);
|
||||
assertEquals(1, wallps.length);
|
||||
assertTrue(wallps[0].prefixOrderIndex < closeLayer);
|
||||
assertEquals(MODE_OPENING, wallps[0].mode);
|
||||
|
||||
// Check non-apps extraction
|
||||
RemoteAnimationTargetCompat[] nonApps = RemoteAnimationTargetCompat.wrapNonApps(combined,
|
||||
RemoteAnimationTarget[] nonApps = RemoteAnimationTargetCompat.wrapNonApps(combined,
|
||||
false /* wallpapers */, mock(SurfaceControl.Transaction.class), null /* leashes */);
|
||||
assertEquals(1, nonApps.length);
|
||||
assertTrue(nonApps[0].prefixOrderIndex < closeLayer);
|
||||
@@ -115,9 +116,9 @@ public class RemoteTransitionTest extends SysuiTestCase {
|
||||
change.setTaskInfo(createTaskInfo(1 /* taskId */, ACTIVITY_TYPE_HOME));
|
||||
change.setEndAbsBounds(endBounds);
|
||||
change.setEndRelOffset(0, 0);
|
||||
final RemoteAnimationTargetCompat wrapped = new RemoteAnimationTargetCompat(change,
|
||||
0 /* order */, tinfo, mock(SurfaceControl.Transaction.class));
|
||||
assertEquals(ACTIVITY_TYPE_HOME, wrapped.activityType);
|
||||
RemoteAnimationTarget wrapped = RemoteAnimationTargetCompat.newTarget(
|
||||
change, 0 /* order */, tinfo, mock(SurfaceControl.Transaction.class), null);
|
||||
assertEquals(ACTIVITY_TYPE_HOME, wrapped.windowConfiguration.getActivityType());
|
||||
assertEquals(new Rect(0, 0, 100, 140), wrapped.localBounds);
|
||||
assertEquals(endBounds, wrapped.screenSpaceBounds);
|
||||
assertTrue(wrapped.isTranslucent);
|
||||
|
||||
Reference in New Issue
Block a user