diff options
8 files changed, 40 insertions, 36 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/events/activity/TaskStackUpdatedEvent.java b/packages/SystemUI/src/com/android/systemui/recents/events/activity/TaskStackUpdatedEvent.java index 7579cd8b82a0..f87f6de3be7c 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/events/activity/TaskStackUpdatedEvent.java +++ b/packages/SystemUI/src/com/android/systemui/recents/events/activity/TaskStackUpdatedEvent.java @@ -22,7 +22,7 @@ import com.android.systemui.recents.model.TaskStack; /** * This is sent by the activity whenever the task stach has changed. */ -public class TaskStackUpdatedEvent extends EventBus.Event { +public class TaskStackUpdatedEvent extends EventBus.AnimatedEvent { /** * A new TaskStack instance representing the latest stack state. diff --git a/packages/SystemUI/src/com/android/systemui/recents/events/ui/dragndrop/DragStartInitializeDropTargetsEvent.java b/packages/SystemUI/src/com/android/systemui/recents/events/ui/dragndrop/DragStartInitializeDropTargetsEvent.java index b450b1fdcaec..7030729d2a04 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/events/ui/dragndrop/DragStartInitializeDropTargetsEvent.java +++ b/packages/SystemUI/src/com/android/systemui/recents/events/ui/dragndrop/DragStartInitializeDropTargetsEvent.java @@ -19,6 +19,7 @@ package com.android.systemui.recents.events.ui.dragndrop; import com.android.systemui.recents.events.EventBus; import com.android.systemui.recents.model.Task; import com.android.systemui.recents.views.RecentsViewTouchHandler; +import com.android.systemui.recents.views.TaskView; /** * This event is sent by the drag manager when it requires drop targets to register themselves for @@ -27,10 +28,13 @@ import com.android.systemui.recents.views.RecentsViewTouchHandler; public class DragStartInitializeDropTargetsEvent extends EventBus.Event { public final Task task; + public final TaskView taskView; public final RecentsViewTouchHandler handler; - public DragStartInitializeDropTargetsEvent(Task task, RecentsViewTouchHandler handler) { + public DragStartInitializeDropTargetsEvent(Task task, TaskView taskView, + RecentsViewTouchHandler handler) { this.task = task; + this.taskView = taskView; this.handler = handler; } } diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java index 9bf48bbc1b56..aa8efa711550 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java +++ b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java @@ -400,7 +400,12 @@ public class TaskStack { // Calculate the task stack bounds from the new window bounds Rect searchBarSpaceBounds = new Rect(); Rect taskStackBounds = new Rect(); - config.getTaskStackBounds(newWindowBounds, insets.top, insets.right, + // If the task stack bounds is specifically under the dock area, then ignore the top + // inset + int top = dockArea.bottom < 1f + ? 0 + : insets.top; + config.getTaskStackBounds(newWindowBounds, top, insets.right, searchBarSpaceBounds, taskStackBounds); return taskStackBounds; } diff --git a/packages/SystemUI/src/com/android/systemui/recents/tv/RecentsTvActivity.java b/packages/SystemUI/src/com/android/systemui/recents/tv/RecentsTvActivity.java index b4ee42bb60cd..fb86214b04d5 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/tv/RecentsTvActivity.java +++ b/packages/SystemUI/src/com/android/systemui/recents/tv/RecentsTvActivity.java @@ -320,22 +320,6 @@ public class RecentsTvActivity extends Activity implements OnPreDrawListener { } @Override - public void onMultiWindowModeChanged(boolean multiWindowMode) { - super.onMultiWindowModeChanged(multiWindowMode); - if (!multiWindowMode) { - RecentsTaskLoader loader = Recents.getTaskLoader(); - RecentsTaskLoadPlan.Options launchOpts = new RecentsTaskLoadPlan.Options(); - launchOpts.loadIcons = false; - launchOpts.loadThumbnails = false; - launchOpts.onlyLoadForCache = true; - RecentsTaskLoadPlan loadPlan = loader.createLoadPlan(this); - loader.preloadTasks(loadPlan, -1, false); - loader.loadTasks(this, loadPlan, launchOpts); - EventBus.getDefault().send(new TaskStackUpdatedEvent(loadPlan.getTaskStack())); - } - } - - @Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_DPAD_UP: { diff --git a/packages/SystemUI/src/com/android/systemui/recents/tv/views/RecentsTvView.java b/packages/SystemUI/src/com/android/systemui/recents/tv/views/RecentsTvView.java index 9193114760cf..b175855c0d3d 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/tv/views/RecentsTvView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/tv/views/RecentsTvView.java @@ -227,12 +227,6 @@ public class RecentsTvView extends FrameLayout { EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(null)); } - public final void onBusEvent(TaskStackUpdatedEvent event) { - mStack.setTasks(event.stack.computeAllTasksList(), true /* notifyStackChanges */); - mStack.createAffiliatedGroupings(getContext()); - } - - public final void onBusEvent(RecentsVisibilityChangedEvent event) { if (!event.visible) { // Reset the view state @@ -240,7 +234,6 @@ public class RecentsTvView extends FrameLayout { } } - public void setTaskStackViewAdapter(TaskStackHorizontalViewAdapter taskStackViewAdapter) { if(mTaskStackHorizontalView != null) { mTaskStackHorizontalView.setAdapter(taskStackViewAdapter); diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsViewTouchHandler.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsViewTouchHandler.java index 288fcab8cc08..346ce167cd17 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsViewTouchHandler.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsViewTouchHandler.java @@ -150,7 +150,8 @@ public class RecentsViewTouchHandler { } // Request other drop targets to register themselves - EventBus.getDefault().send(new DragStartInitializeDropTargetsEvent(event.task, this)); + EventBus.getDefault().send(new DragStartInitializeDropTargetsEvent(event.task, + event.taskView, this)); } public final void onBusEvent(DragEndEvent event) { 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 264cede8e71a..7079ff44ef6a 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java @@ -59,6 +59,7 @@ import com.android.systemui.recents.events.activity.LaunchTaskStartedEvent; import com.android.systemui.recents.events.activity.PackagesChangedEvent; import com.android.systemui.recents.events.activity.ShowHistoryButtonEvent; import com.android.systemui.recents.events.activity.ShowHistoryEvent; +import com.android.systemui.recents.events.activity.TaskStackUpdatedEvent; import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent; import com.android.systemui.recents.events.ui.AllTaskViewsDismissedEvent; import com.android.systemui.recents.events.ui.DeleteTaskDataEvent; @@ -142,6 +143,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal Rect mStableStackBounds = new Rect(); // The current stack bounds are dynamic and may change as the user drags and drops Rect mStackBounds = new Rect(); + int[] mTmpVisibleRange = new int[2]; Rect mTmpRect = new Rect(); ArrayMap<Task.TaskKey, TaskView> mTmpTaskViewMap = new ArrayMap<>(); @@ -860,8 +862,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal // TODO: Center the newly focused task view, only if not freeform float newScroll = mLayoutAlgorithm.getStackScrollForTask(newFocusedTask); if (Float.compare(newScroll, mStackScroller.getStackScroll()) != 0) { - mStackScroller.animateScroll(mStackScroller.getStackScroll(), newScroll, - focusTaskRunnable); + mStackScroller.animateScroll(newScroll, focusTaskRunnable); willScroll = true; } else { focusTaskRunnable.run(); @@ -1586,8 +1587,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal public final void onBusEvent(DragStartEvent event) { if (event.task.isFreeformTask()) { // Animate to the front of the stack - mStackScroller.animateScroll(mStackScroller.getStackScroll(), - mLayoutAlgorithm.mInitialScrollP, null); + mStackScroller.animateScroll(mLayoutAlgorithm.mInitialScrollP, null); } // Enlarge the dragged view slightly @@ -1613,7 +1613,6 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal if (event.dropTarget instanceof TaskStack.DockState) { // Calculate the new task stack bounds that matches the window size that Recents will // have after the drop - addIgnoreTask(event.task); final TaskStack.DockState dockState = (TaskStack.DockState) event.dropTarget; mStackBounds.set(dockState.getDockedTaskStackBounds(getMeasuredWidth(), getMeasuredHeight(), mDividerSize, mLayoutAlgorithm.mSystemInsets, @@ -1775,6 +1774,17 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal mAnimationHelper.startHideHistoryAnimation(); } + public final void onBusEvent(TaskStackUpdatedEvent event) { + // Scroll the stack to the front after it has been updated + event.addPostAnimationCallback(new Runnable() { + @Override + public void run() { + mStackScroller.animateScroll(mLayoutAlgorithm.mMaxScrollP, + null /* postScrollRunnable */); + } + }); + } + /** * Removes the task from the stack, and updates the focus to the next task in the stack if the * removed TaskView was focused. diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewScroller.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewScroller.java index 7884bd331742..ced5d4b500f4 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewScroller.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewScroller.java @@ -27,6 +27,8 @@ import android.widget.OverScroller; import com.android.systemui.Interpolators; import com.android.systemui.R; +import com.android.systemui.recents.Recents; +import com.android.systemui.recents.misc.SystemServicesProxy; import com.android.systemui.recents.misc.Utilities; /* The scrolling logic for a TaskStackView */ @@ -111,8 +113,13 @@ public class TaskStackViewScroller { * @return whether the stack progress changed. */ public boolean setStackScrollToInitialState() { + SystemServicesProxy ssp = Recents.getSystemServices(); float prevStackScrollP = mStackScrollP; - setStackScroll(getBoundedStackScroll(mLayoutAlgorithm.mInitialScrollP)); + if (ssp.hasDockedTask()) { + setStackScroll(mLayoutAlgorithm.mMaxScrollP); + } else { + setStackScroll(mLayoutAlgorithm.mInitialScrollP); + } return Float.compare(prevStackScrollP, mStackScrollP) != 0; } @@ -169,13 +176,13 @@ public class TaskStackViewScroller { float newScroll = getBoundedStackScroll(curScroll); if (Float.compare(newScroll, curScroll) != 0) { // Start a new scroll animation - animateScroll(curScroll, newScroll, null); + animateScroll(newScroll, null /* postScrollRunnable */); } return mScrollAnimator; } /** Animates the stack scroll */ - void animateScroll(float curScroll, float newScroll, final Runnable postRunnable) { + void animateScroll(float newScroll, final Runnable postRunnable) { // Finish any current scrolling animations if (mScrollAnimator != null && mScrollAnimator.isRunning()) { setStackScroll(mFinalAnimatedScroll); @@ -185,7 +192,7 @@ public class TaskStackViewScroller { stopBoundScrollAnimation(); mFinalAnimatedScroll = newScroll; - mScrollAnimator = ObjectAnimator.ofFloat(this, STACK_SCROLL, curScroll, newScroll); + mScrollAnimator = ObjectAnimator.ofFloat(this, STACK_SCROLL, getStackScroll(), newScroll); mScrollAnimator.setDuration(mContext.getResources().getInteger( R.integer.recents_animate_task_stack_scroll_duration)); mScrollAnimator.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN); |