summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2014-08-07 15:55:37 -0700
committerWinson Chung <winsonc@google.com>2014-08-07 16:10:24 -0700
commite41ab847a5c12cb7a6a5b2d0f40e101bc9ea6b59 (patch)
treefc519681b58af6102f52a2439abbafc1573c6203 /packages
parent0a4ea30c796a458074512a48f41e4b274b948ad2 (diff)
downloadframeworks_base-e41ab847a5c12cb7a6a5b2d0f40e101bc9ea6b59.zip
frameworks_base-e41ab847a5c12cb7a6a5b2d0f40e101bc9ea6b59.tar.gz
frameworks_base-e41ab847a5c12cb7a6a5b2d0f40e101bc9ea6b59.tar.bz2
Fixing regression with scrolling and launching an out-of-view task. (Bug 16875419)
Change-Id: Ib64e18f9a0f1de02de28a29251dd1d159d5d89ee
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java24
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewLayoutAlgorithm.java15
4 files changed, 25 insertions, 18 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
index a55c0f2..bb5fe54 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
@@ -328,7 +328,7 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
TaskStackViewLayoutAlgorithm algo = tsv.getStackAlgorithm();
Rect taskStackBounds = new Rect(mTaskStackBounds);
taskStackBounds.bottom -= mSystemInsets.bottom;
- tsv.computeRects(mWindowRect.width(), mWindowRect.height(), taskStackBounds);
+ tsv.computeRects(mWindowRect.width(), mWindowRect.height(), taskStackBounds, mTriggeredFromAltTab);
tsv.getScroller().setStackScrollToInitialState();
// Find the running task in the TaskStack
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 58d5df7..34e8860 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
@@ -386,7 +386,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
sourceView = stackView;
transform = stackView.getStackAlgorithm().getStackTransform(task, stackScroll, transform, null);
offsetX = transform.rect.left;
- offsetY = Math.min(transform.rect.top, mConfig.displayRect.height());
+ offsetY = mConfig.displayRect.height();
} else {
transform = stackView.getStackAlgorithm().getStackTransform(task, stackScroll, transform, 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 9e7dbf4..46996bb 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -349,9 +349,9 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
}
/** Updates the min and max virtual scroll bounds */
- void updateMinMaxScroll(boolean boundScrollToNewMinMax) {
+ void updateMinMaxScroll(boolean boundScrollToNewMinMax, boolean launchedWithAltTab) {
// Compute the min and max scroll values
- mLayoutAlgorithm.computeMinMaxScroll(mStack.getTasks());
+ mLayoutAlgorithm.computeMinMaxScroll(mStack.getTasks(), launchedWithAltTab);
// Debug logging
if (boundScrollToNewMinMax) {
@@ -388,17 +388,17 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
};
}
+ // Scroll the view into position (just center it in the curve)
if (scrollToNewPosition) {
- // Scroll the view into position
- // XXX: We probably want this to be centered in view instead of p = 0f
- float newScroll = mStackScroller.getBoundedStackScroll(
- mLayoutAlgorithm.getStackScrollForTaskIndex(t));
+ float newScroll = mLayoutAlgorithm.getStackScrollForTaskIndex(t) - 0.5f;
+ newScroll = mStackScroller.getBoundedStackScroll(newScroll);
mStackScroller.animateScroll(mStackScroller.getStackScroll(), newScroll, postScrollRunnable);
} else {
if (postScrollRunnable != null) {
postScrollRunnable.run();
}
}
+
}
}
@@ -435,12 +435,13 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
}
/** Computes the stack and task rects */
- public void computeRects(int windowWidth, int windowHeight, Rect taskStackBounds) {
+ public void computeRects(int windowWidth, int windowHeight, Rect taskStackBounds,
+ boolean launchedWithAltTab) {
// Compute the rects in the stack algorithm
mLayoutAlgorithm.computeRects(windowWidth, windowHeight, taskStackBounds);
// Update the scroll bounds
- updateMinMaxScroll(false);
+ updateMinMaxScroll(false, launchedWithAltTab);
}
/**
@@ -455,7 +456,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
// Compute our stack/task rects
Rect taskStackBounds = new Rect(mTaskStackBounds);
taskStackBounds.bottom -= mConfig.systemInsets.bottom;
- computeRects(width, height, taskStackBounds);
+ computeRects(width, height, taskStackBounds, mConfig.launchedWithAltTab);
// If this is the first layout, then scroll to the front of the stack and synchronize the
// stack views immediately to load all the views
@@ -543,9 +544,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
mStartEnterAnimationContext = null;
}
- // Update the focused task index to be the next item to the top task
+ // When Alt-Tabbing, we scroll to and focus the previous task
if (mConfig.launchedWithAltTab) {
- // When alt-tabbing, we focus the next previous task
focusTask(Math.max(0, mStack.getTaskCount() - 2), false);
}
}
@@ -661,7 +661,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
mCb.onTaskViewDismissed(removedTask);
// Update the min/max scroll and animate other task views into their new positions
- updateMinMaxScroll(true);
+ updateMinMaxScroll(true, mConfig.launchedWithAltTab);
requestSynchronizeStackViewsWithModel(200);
// Update the new front most task
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewLayoutAlgorithm.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewLayoutAlgorithm.java
index b1482bb..633e6fa 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewLayoutAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewLayoutAlgorithm.java
@@ -18,7 +18,6 @@ package com.android.systemui.recents.views;
import android.graphics.Rect;
import com.android.systemui.recents.RecentsConfiguration;
-import com.android.systemui.recents.misc.Console;
import com.android.systemui.recents.misc.Utilities;
import com.android.systemui.recents.model.Task;
@@ -87,8 +86,9 @@ public class TaskStackViewLayoutAlgorithm {
left + size, mStackRect.top + size);
}
- /** Computes the minimum and maximum scroll progress values */
- void computeMinMaxScroll(ArrayList<Task> tasks) {
+ /** Computes the minimum and maximum scroll progress values. This method may be called before
+ * the RecentsConfiguration is set, so we need to pass in the alt-tab state. */
+ void computeMinMaxScroll(ArrayList<Task> tasks, boolean launchedWithAltTab) {
// Clear the progress map
mTaskProgressMap.clear();
@@ -130,7 +130,12 @@ public class TaskStackViewLayoutAlgorithm {
mMinScrollP = 0f;
mMaxScrollP = pAtFrontMostCardTop - ((1f - pTaskHeightOffset - pNavBarOffset));
- mInitialScrollP = pAtSecondFrontMostCardTop - ((1f - pTaskHeightOffset - pNavBarOffset));
+ if (launchedWithAltTab) {
+ // Center the second most task, since that will be focused first
+ mInitialScrollP = pAtSecondFrontMostCardTop - 0.5f;
+ } else {
+ mInitialScrollP = pAtSecondFrontMostCardTop - ((1f - pTaskHeightOffset - pNavBarOffset));
+ }
}
/** Update/get the transform */
@@ -151,6 +156,7 @@ public class TaskStackViewLayoutAlgorithm {
// If the task top is outside of the bounds below the screen, then immediately reset it
if (pTaskRelative > 1f) {
transformOut.reset();
+ transformOut.rect.set(mTaskRect);
return transformOut;
}
// The check for the top is trickier, since we want to show the next task if it is at all
@@ -158,6 +164,7 @@ public class TaskStackViewLayoutAlgorithm {
if (pTaskRelative < 0f) {
if (prevTransform != null && Float.compare(prevTransform.p, 0f) <= 0) {
transformOut.reset();
+ transformOut.rect.set(mTaskRect);
return transformOut;
}
}