diff options
8 files changed, 47 insertions, 70 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java index fe7ac711e8c1..b89c2f67a220 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java @@ -338,7 +338,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD 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, diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java index 77f77393d7ab..71610534f1e6 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java @@ -29,10 +29,9 @@ public class RecentsActivityLaunchState { 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; @@ -40,18 +39,10 @@ public class RecentsActivityLaunchState { 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; } /** diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java index 40613f0d753e..73c6e6e89c58 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java @@ -80,12 +80,4 @@ public class RecentsConfiguration { 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(); - } } diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java index c52d17f3a58c..ffc037dba5e5 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java @@ -43,7 +43,6 @@ import com.android.internal.logging.MetricsLogger; 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; @@ -208,7 +207,6 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener public void onConfigurationChanged() { reloadHeaderBarLayout(); updateHeaderBarLayout(null /* stack */); - Recents.getConfiguration().updateOnConfigurationChange(); } /** @@ -852,13 +850,12 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener // 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)); diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java index a1ba49338c36..b23b01f93320 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java @@ -184,7 +184,7 @@ public class RecentsView extends FrameLayout { // 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 { @@ -564,7 +564,7 @@ public class RecentsView extends FrameLayout { 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); diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackAnimationHelper.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackAnimationHelper.java index 1c7d6096950e..8db81f73f700 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackAnimationHelper.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackAnimationHelper.java @@ -20,7 +20,6 @@ import android.animation.Animator; 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; @@ -152,30 +151,26 @@ public class TaskStackAnimationHelper { 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); } } } @@ -223,7 +218,7 @@ public class TaskStackAnimationHelper { 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, @@ -262,7 +257,7 @@ public class TaskStackAnimationHelper { 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 + diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java index 8a1727a20271..4b1faf3ef395 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java @@ -552,7 +552,7 @@ public class TaskStackLayoutAlgorithm { 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; diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java index 90328714c51e..04f153fb7996 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java @@ -28,6 +28,7 @@ import android.content.Context; 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; @@ -60,8 +61,8 @@ import com.android.systemui.recents.events.activity.ConfigurationChangedEvent; 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; @@ -117,8 +118,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal 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}) @@ -598,17 +597,14 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal 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 { @@ -1215,7 +1211,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal 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 @@ -1225,7 +1221,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal } // 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 @@ -1266,7 +1262,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal 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) { @@ -1274,8 +1270,9 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal 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) { @@ -1287,16 +1284,21 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal /** * 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. */ @@ -1509,7 +1511,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal } addViewInLayout(tv, insertIndex, params, true /* preventRequestLayout */); measureTaskView(tv); - layoutTaskView(tv); + layoutTaskView(true /* changed */, tv); } } else { attachViewToParent(tv, insertIndex, tv.getLayoutParams()); |