Merge "Adding isNotInRecents to RemoteAnimationTarget" into pi-dev

This commit is contained in:
TreeHugger Robot
2018-03-10 01:11:27 +00:00
committed by Android (Google) Code Review
7 changed files with 47 additions and 15 deletions

View File

@@ -109,9 +109,14 @@ public class RemoteAnimationTarget implements Parcelable {
*/
public final WindowConfiguration windowConfiguration;
/**
* Whether the task is not presented in Recents UI.
*/
public boolean isNotInRecents;
public RemoteAnimationTarget(int taskId, int mode, SurfaceControl leash, boolean isTranslucent,
Rect clipRect, Rect contentInsets, int prefixOrderIndex, Point position,
Rect sourceContainerBounds, WindowConfiguration windowConfig) {
Rect sourceContainerBounds, WindowConfiguration windowConfig, boolean isNotInRecents) {
this.mode = mode;
this.taskId = taskId;
this.leash = leash;
@@ -122,6 +127,7 @@ public class RemoteAnimationTarget implements Parcelable {
this.position = new Point(position);
this.sourceContainerBounds = new Rect(sourceContainerBounds);
this.windowConfiguration = windowConfig;
this.isNotInRecents = isNotInRecents;
}
public RemoteAnimationTarget(Parcel in) {
@@ -135,6 +141,7 @@ public class RemoteAnimationTarget implements Parcelable {
position = in.readParcelable(null);
sourceContainerBounds = in.readParcelable(null);
windowConfiguration = in.readParcelable(null);
isNotInRecents = in.readBoolean();
}
@Override
@@ -154,6 +161,7 @@ public class RemoteAnimationTarget implements Parcelable {
dest.writeParcelable(position, 0 /* flags */);
dest.writeParcelable(sourceContainerBounds, 0 /* flags */);
dest.writeParcelable(windowConfiguration, 0 /* flags */);
dest.writeBoolean(isNotInRecents);
}
public static final Creator<RemoteAnimationTarget> CREATOR

View File

@@ -18,7 +18,6 @@ package com.android.systemui.shared.system;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;
import android.app.WindowConfiguration;
import android.graphics.Point;
import android.graphics.Rect;
import android.view.RemoteAnimationTarget;
@@ -39,6 +38,7 @@ public class RemoteAnimationTargetCompat {
public final int prefixOrderIndex;
public final Point position;
public final Rect sourceContainerBounds;
public final boolean isNotInRecents;
private final RemoteAnimationTarget mTarget;
@@ -52,6 +52,7 @@ public class RemoteAnimationTargetCompat {
position = app.position;
sourceContainerBounds = app.sourceContainerBounds;
prefixOrderIndex = app.prefixOrderIndex;
isNotInRecents = app.isNotInRecents;
}
public static RemoteAnimationTargetCompat[] wrap(RemoteAnimationTarget[] apps) {

View File

@@ -827,6 +827,25 @@ class RecentTasks {
return mTasks;
}
/**
* @return ids of tasks that are presented in Recents UI.
*/
SparseBooleanArray getRecentTaskIds() {
final SparseBooleanArray res = new SparseBooleanArray();
final int size = mTasks.size();
int numVisibleTasks = 0;
for (int i = 0; i < size; i++) {
final TaskRecord tr = mTasks.get(i);
if (isVisibleRecentTask(tr)) {
numVisibleTasks++;
if (isInVisibleRange(tr, numVisibleTasks)) {
res.put(tr.taskId, true);
}
}
}
return res;
}
/**
* @return the task in the task list with the given {@param id} if one exists.
*/

View File

@@ -16,7 +16,6 @@
package com.android.server.am;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION;
@@ -139,7 +138,7 @@ class RecentsAnimation implements RecentsAnimationCallbacks {
// started
mWindowManager.cancelRecentsAnimation();
mWindowManager.initializeRecentsAnimation(recentsAnimationRunner, this,
display.mDisplayId);
display.mDisplayId, mStackSupervisor.mRecentTasks.getRecentTaskIds());
// If we updated the launch-behind state, update the visibility of the activities after
// we fetch the visible tasks to be controlled by the animation

View File

@@ -29,12 +29,12 @@ import android.app.WindowConfiguration;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Binder;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.SystemClock;
import android.util.ArraySet;
import android.util.Log;
import android.util.Slog;
import android.util.SparseBooleanArray;
import android.view.IRecentsAnimationController;
import android.view.IRecentsAnimationRunner;
import android.view.RemoteAnimationTarget;
@@ -175,7 +175,7 @@ public class RecentsAnimationController {
* because it may call cancelAnimation() which needs to properly clean up the controller
* in the window manager.
*/
public void initialize() {
public void initialize(SparseBooleanArray recentTaskIds) {
// Make leashes for each of the visible tasks and add it to the recents animation to be
// started
final DisplayContent dc = mService.mRoot.getDisplayContent(mDisplayId);
@@ -189,7 +189,7 @@ public class RecentsAnimationController {
|| config.getActivityType() == ACTIVITY_TYPE_HOME) {
continue;
}
addAnimation(task);
addAnimation(task, !recentTaskIds.get(task.mTaskId));
}
// Skip the animation if there is nothing to animate
@@ -216,11 +216,12 @@ public class RecentsAnimationController {
mService.mWindowPlacerLocked.performSurfacePlacement();
}
private void addAnimation(Task task) {
private void addAnimation(Task task, boolean isRecentTaskInvisible) {
if (DEBUG) Log.d(TAG, "addAnimation(" + task.getName() + ")");
final SurfaceAnimator anim = new SurfaceAnimator(task, null /* animationFinishedCallback */,
mService);
final TaskAnimationAdapter taskAdapter = new TaskAnimationAdapter(task);
final TaskAnimationAdapter taskAdapter = new TaskAnimationAdapter(task,
isRecentTaskInvisible);
anim.startAnimation(task.getPendingTransaction(), taskAdapter, false /* hidden */);
task.commitPendingTransaction();
mPendingAnimations.add(taskAdapter);
@@ -343,12 +344,14 @@ public class RecentsAnimationController {
private class TaskAnimationAdapter implements AnimationAdapter {
private Task mTask;
private final Task mTask;
private SurfaceControl mCapturedLeash;
private OnAnimationFinishedCallback mCapturedFinishCallback;
private final boolean mIsRecentTaskInvisible;
TaskAnimationAdapter(Task task) {
TaskAnimationAdapter(Task task, boolean isRecentTaskInvisible) {
mTask = task;
mIsRecentTaskInvisible = isRecentTaskInvisible;
}
RemoteAnimationTarget createRemoteAnimationApp() {
@@ -361,7 +364,7 @@ public class RecentsAnimationController {
return new RemoteAnimationTarget(mTask.mTaskId, MODE_CLOSING, mCapturedLeash,
!mTask.fillsParent(), mainWindow.mWinAnimator.mLastClipRect,
mainWindow.mContentInsets, mTask.getPrefixOrderIndex(), position, bounds,
mTask.getWindowConfiguration());
mTask.getWindowConfiguration(), mIsRecentTaskInvisible);
}
@Override

View File

@@ -214,7 +214,7 @@ class RemoteAnimationController {
mCapturedLeash, !mAppWindowToken.fillsParent(),
mainWindow.mWinAnimator.mLastClipRect, mainWindow.mContentInsets,
mAppWindowToken.getPrefixOrderIndex(), mPosition, mStackBounds,
task.getWindowConfiguration());
task.getWindowConfiguration(), false /*isNotInRecents*/);
}
private int getMode() {

View File

@@ -181,6 +181,7 @@ import android.util.MergedConfiguration;
import android.util.Pair;
import android.util.Slog;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
import android.util.SparseIntArray;
import android.util.TimeUtils;
import android.util.TypedValue;
@@ -2660,11 +2661,12 @@ public class WindowManagerService extends IWindowManager.Stub
public void initializeRecentsAnimation(
IRecentsAnimationRunner recentsAnimationRunner,
RecentsAnimationController.RecentsAnimationCallbacks callbacks, int displayId) {
RecentsAnimationController.RecentsAnimationCallbacks callbacks, int displayId,
SparseBooleanArray recentTaskIds) {
synchronized (mWindowMap) {
mRecentsAnimationController = new RecentsAnimationController(this,
recentsAnimationRunner, callbacks, displayId);
mRecentsAnimationController.initialize();
mRecentsAnimationController.initialize(recentTaskIds);
}
}