mRecentsView.updateStack(stack);
// Update the nav bar scrim, but defer the animation until the enter-window event
- boolean animateNavBarScrim = !launchState.launchedWhileDocking;
+ boolean animateNavBarScrim = !launchState.launchedViaDockGesture;
updateNavBarScrim(animateNavBarScrim, null);
// If this is a new instance relaunched by AM, without going through the normal mechanisms,
public boolean launchedWithAltTab;
public boolean launchedFromApp;
- public boolean launchedFromAppDocked;
public boolean launchedFromHome;
public boolean launchedViaDragGesture;
- public boolean launchedWhileDocking;
+ public boolean launchedViaDockGesture;
public int launchedToTaskId;
public int launchedNumVisibleTasks;
public int launchedNumVisibleThumbnails;
public void reset() {
launchedFromHome = false;
launchedFromApp = false;
- launchedFromAppDocked = false;
launchedToTaskId = -1;
launchedWithAltTab = false;
launchedViaDragGesture = false;
- launchedWhileDocking = false;
- }
-
- /** Called when the configuration has changed, and we want to reset any configuration specific
- * members. */
- public void updateOnConfigurationChange() {
- launchedViaDragGesture = false;
- launchedWhileDocking = false;
+ launchedViaDockGesture = false;
}
/**
public RecentsActivityLaunchState getLaunchState() {
return mLaunchState;
}
-
- /**
- * Called when the configuration has changed, and we want to reset any configuration specific
- * members.
- */
- public void updateOnConfigurationChange() {
- mLaunchState.updateOnConfigurationChange();
- }
}
import com.android.systemui.R;
import com.android.systemui.SystemUIApplication;
import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.events.EventBus.Event;
import com.android.systemui.recents.events.activity.DockedTopTaskEvent;
import com.android.systemui.recents.events.activity.EnterRecentsWindowLastAnimationFrameEvent;
import com.android.systemui.recents.events.activity.ForcedResizableEvent;
public void onConfigurationChanged() {
reloadHeaderBarLayout();
updateHeaderBarLayout(null /* stack */);
- Recents.getConfiguration().updateOnConfigurationChange();
}
/**
// Update the launch state
launchState.launchedFromHome = false;
launchState.launchedFromApp = mLaunchedWhileDocking;
+ launchState.launchedViaDockGesture = mLaunchedWhileDocking;
launchState.launchedToTaskId = (topTask != null) ? topTask.id : -1;
- launchState.launchedFromAppDocked = mLaunchedWhileDocking;
launchState.launchedWithAltTab = mTriggeredFromAltTab;
launchState.launchedNumVisibleTasks = stackVr.numVisibleTasks;
launchState.launchedNumVisibleThumbnails = stackVr.numVisibleThumbnails;
launchState.launchedViaDragGesture = mDraggingInRecents;
- launchState.launchedWhileDocking = mLaunchedWhileDocking;
if (!animate) {
startRecentsActivity(ActivityOptions.makeCustomAnimation(mContext, -1, -1));
// If we are already occluded by the app, then set the final background scrim alpha now.
// Otherwise, defer until the enter animation completes to animate the scrim alpha with
// the tasks for the home animation.
- if (launchState.launchedWhileDocking || launchState.launchedFromApp
+ if (launchState.launchedViaDockGesture || launchState.launchedFromApp
|| isTaskStackEmpty) {
mBackgroundScrim.setAlpha((int) (DEFAULT_SCRIM_ALPHA * 255));
} else {
public final void onBusEvent(EnterRecentsWindowAnimationCompletedEvent event) {
RecentsActivityLaunchState launchState = Recents.getConfiguration().getLaunchState();
- if (!launchState.launchedWhileDocking && !launchState.launchedFromApp
+ if (!launchState.launchedViaDockGesture && !launchState.launchedFromApp
&& mStack.getTaskCount() > 0) {
animateBackgroundScrim(DEFAULT_SCRIM_ALPHA,
TaskStackAnimationHelper.ENTER_FROM_HOME_TRANSLATION_DURATION);
import android.animation.AnimatorListenerAdapter;
import android.content.Context;
import android.content.res.Resources;
-import android.graphics.RectF;
import android.util.Log;
import android.view.View;
import android.view.animation.Interpolator;
if (hideTask) {
tv.setVisibility(View.INVISIBLE);
- } else if (launchState.launchedFromApp && !launchState.launchedWhileDocking) {
+ } else if (launchState.launchedFromApp && !launchState.launchedViaDockGesture) {
if (task.isLaunchTarget) {
tv.onPrepareLaunchTargetForEnterAnimation();
} else if (currentTaskOccludesLaunchTarget) {
// Move the task view slightly lower so we can animate it in
- RectF bounds = new RectF(mTmpTransform.rect);
- bounds.offset(0, taskViewAffiliateGroupEnterOffset);
+ mTmpTransform.rect.offset(0, taskViewAffiliateGroupEnterOffset);
+ mTmpTransform.alpha = 0f;
+ mStackView.updateTaskViewToTransform(tv, mTmpTransform,
+ AnimationProps.IMMEDIATE);
tv.setClipViewInStack(false);
- tv.setAlpha(0f);
- tv.setLeftTopRightBottom((int) bounds.left, (int) bounds.top,
- (int) bounds.right, (int) bounds.bottom);
}
} else if (launchState.launchedFromHome) {
// Move the task view off screen (below) so we can animate it in
- RectF bounds = new RectF(mTmpTransform.rect);
- bounds.offset(0, offscreenYOffset);
- tv.setAlpha(0f);
- tv.setLeftTopRightBottom((int) bounds.left, (int) bounds.top, (int) bounds.right,
- (int) bounds.bottom);
- } else if (launchState.launchedWhileDocking) {
- RectF bounds = new RectF(mTmpTransform.rect);
- bounds.offset(0, launchedWhileDockingOffset);
- tv.setLeftTopRightBottom((int) bounds.left, (int) bounds.top, (int) bounds.right,
- (int) bounds.bottom);
+ mTmpTransform.rect.offset(0, offscreenYOffset);
+ mTmpTransform.alpha = 0f;
+ mStackView.updateTaskViewToTransform(tv, mTmpTransform, AnimationProps.IMMEDIATE);
+ } else if (launchState.launchedViaDockGesture) {
+ mTmpTransform.rect.offset(0, launchedWhileDockingOffset);
+ mTmpTransform.alpha = 0f;
+ mStackView.updateTaskViewToTransform(tv, mTmpTransform, AnimationProps.IMMEDIATE);
}
}
}
stackLayout.getStackTransform(task, stackScroller.getStackScroll(), mTmpTransform,
null);
- if (launchState.launchedFromApp && !launchState.launchedWhileDocking) {
+ if (launchState.launchedFromApp && !launchState.launchedViaDockGesture) {
if (task.isLaunchTarget) {
tv.onStartLaunchTargetEnterAnimation(mTmpTransform,
taskViewEnterFromAppDuration, mStackView.mScreenPinningEnabled,
if (i == taskViewCount - 1) {
tv.onStartFrontTaskEnterAnimation(mStackView.mScreenPinningEnabled);
}
- } else if (launchState.launchedWhileDocking) {
+ } else if (launchState.launchedViaDockGesture) {
// Animate the tasks up
AnimationProps taskAnimation = new AnimationProps()
.setDuration(AnimationProps.BOUNDS, (int) (ENTER_WHILE_DOCKING_DURATION +
mMaxScrollP = Math.max(mMinScrollP, (mNumStackTasks - 1) -
Math.max(0, mUnfocusedRange.getAbsoluteX(maxBottomNormX)));
boolean scrollToFront = launchState.launchedFromHome ||
- launchState.launchedFromAppDocked;
+ launchState.launchedViaDockGesture;
if (scrollToFront) {
mInitialScrollP = Utilities.clamp(launchTaskIndex, mMinScrollP, mMaxScrollP);
mInitialNormX = null;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Rect;
+import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import com.android.systemui.recents.events.activity.DismissRecentsToHomeAnimationStarted;
import com.android.systemui.recents.events.activity.EnterRecentsTaskStackAnimationCompletedEvent;
import com.android.systemui.recents.events.activity.EnterRecentsWindowAnimationCompletedEvent;
-import com.android.systemui.recents.events.activity.HideStackActionButtonEvent;
import com.android.systemui.recents.events.activity.HideRecentsEvent;
+import com.android.systemui.recents.events.activity.HideStackActionButtonEvent;
import com.android.systemui.recents.events.activity.IterateRecentsEvent;
import com.android.systemui.recents.events.activity.LaunchNextTaskRequestEvent;
import com.android.systemui.recents.events.activity.LaunchTaskEvent;
private static final int LAUNCH_NEXT_SCROLL_BASE_DURATION = 216;
private static final int LAUNCH_NEXT_SCROLL_INCR_DURATION = 32;
- private static final ArraySet<Task.TaskKey> EMPTY_TASK_SET = new ArraySet<>();
-
// The actions to perform when resetting to initial state,
@Retention(RetentionPolicy.SOURCE)
@IntDef({INITIAL_STATE_UPDATE_NONE, INITIAL_STATE_UPDATE_ALL, INITIAL_STATE_UPDATE_LAYOUT_ONLY})
if (tv == null) {
tv = mViewPool.pickUpViewFromPool(task, task);
if (task.isFreeformTask()) {
- tv.updateViewPropertiesToTaskTransform(transform, AnimationProps.IMMEDIATE,
- mRequestUpdateClippingListener);
+ updateTaskViewToTransform(tv, transform, AnimationProps.IMMEDIATE);
} else {
if (transform.rect.top <= mLayoutAlgorithm.mStackRect.top) {
- tv.updateViewPropertiesToTaskTransform(
- mLayoutAlgorithm.getBackOfStackTransform(),
- AnimationProps.IMMEDIATE, mRequestUpdateClippingListener);
+ updateTaskViewToTransform(tv, mLayoutAlgorithm.getBackOfStackTransform(),
+ AnimationProps.IMMEDIATE);
} else {
- tv.updateViewPropertiesToTaskTransform(
- mLayoutAlgorithm.getFrontOfStackTransform(),
- AnimationProps.IMMEDIATE, mRequestUpdateClippingListener);
+ updateTaskViewToTransform(tv, mLayoutAlgorithm.getFrontOfStackTransform(),
+ AnimationProps.IMMEDIATE);
}
}
} else {
TaskStackLayoutAlgorithm.StackState.getStackStateForStack(mStack));
mLayoutAlgorithm.initialize(mWindowRect, mStackBounds,
TaskStackLayoutAlgorithm.StackState.getStackStateForStack(mStack));
- updateLayoutAlgorithm(false /* boundScroll */, EMPTY_TASK_SET);
+ updateLayoutAlgorithm(false /* boundScroll */, mIgnoreTasks);
// If this is the first layout, then scroll to the front of the stack, then update the
// TaskViews with the stack so that we can lay them out
}
// Rebind all the views, including the ignore ones
- bindVisibleTaskViews(mStackScroller.getStackScroll(), EMPTY_TASK_SET,
+ bindVisibleTaskViews(mStackScroller.getStackScroll(), mIgnoreTasks,
false /* ignoreTaskOverrides */);
// Measure each of the TaskViews
mTmpTaskViews.addAll(mViewPool.getViews());
int taskViewCount = mTmpTaskViews.size();
for (int i = 0; i < taskViewCount; i++) {
- layoutTaskView(mTmpTaskViews.get(i));
+ layoutTaskView(changed, mTmpTaskViews.get(i));
}
if (changed) {
mStackScroller.boundScroll();
}
}
+
// Relayout all of the task views including the ignored ones
- relayoutTaskViews(AnimationProps.IMMEDIATE, EMPTY_TASK_SET);
+ relayoutTaskViews(AnimationProps.IMMEDIATE, mIgnoreTasks);
clipTaskViews();
if (mAwaitingFirstLayout || !mEnterAnimationComplete) {
/**
* Lays out a TaskView.
*/
- private void layoutTaskView(TaskView tv) {
- if (tv.getBackground() != null) {
- tv.getBackground().getPadding(mTmpRect);
+ private void layoutTaskView(boolean changed, TaskView tv) {
+ if (changed) {
+ if (tv.getBackground() != null) {
+ tv.getBackground().getPadding(mTmpRect);
+ } else {
+ mTmpRect.setEmpty();
+ }
+ Rect taskRect = mStableLayoutAlgorithm.mTaskRect;
+ tv.cancelTransformAnimation();
+ tv.layout(taskRect.left - mTmpRect.left, taskRect.top - mTmpRect.top,
+ taskRect.right + mTmpRect.right, taskRect.bottom + mTmpRect.bottom);
} else {
- mTmpRect.setEmpty();
+ // If the layout has not changed, then just lay it out again in-place
+ tv.layout(tv.getLeft(), tv.getTop(), tv.getRight(), tv.getBottom());
}
- Rect taskRect = mStableLayoutAlgorithm.mTaskRect;
- tv.cancelTransformAnimation();
- tv.layout(taskRect.left - mTmpRect.left, taskRect.top - mTmpRect.top,
- taskRect.right + mTmpRect.right, taskRect.bottom + mTmpRect.bottom);
}
/** Handler for the first layout. */
}
addViewInLayout(tv, insertIndex, params, true /* preventRequestLayout */);
measureTaskView(tv);
- layoutTaskView(tv);
+ layoutTaskView(true /* changed */, tv);
}
} else {
attachViewToParent(tv, insertIndex, tv.getLayoutParams());