summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2014-05-29 23:07:42 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-29 23:07:42 +0000
commit069707ed6fd1399ca90c57741960884773d3cc69 (patch)
treec7a01d0a407a399e5f30c89b257d0640fb0d9a4d /packages
parentc87bfbd2654d9a262c2918c62ba9b89285010e7e (diff)
parent4f70dbbc656e0affd0b480c7eceb888449cb6348 (diff)
downloadframeworks_base-069707ed6fd1399ca90c57741960884773d3cc69.zip
frameworks_base-069707ed6fd1399ca90c57741960884773d3cc69.tar.gz
frameworks_base-069707ed6fd1399ca90c57741960884773d3cc69.tar.bz2
Merge "Ensuring that the second card is maximally visible when you go into recents." into lmp-preview-dev
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java28
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/Constants.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsService.java17
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java13
4 files changed, 46 insertions, 16 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
index 2dc97e0..ca9bb94 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
@@ -63,12 +63,15 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
Bundle replyData = msg.getData().getParcelable(KEY_CONFIGURATION_DATA);
mSingleCountFirstTaskRect = replyData.getParcelable(KEY_SINGLE_TASK_STACK_RECT);
mSingleCountFirstTaskRect.offset(0, (int) statusBarHeight);
+ mTwoCountFirstTaskRect = replyData.getParcelable(KEY_TWO_TASK_STACK_RECT);
+ mTwoCountFirstTaskRect.offset(0, (int) statusBarHeight);
mMultipleCountFirstTaskRect = replyData.getParcelable(KEY_MULTIPLE_TASK_STACK_RECT);
mMultipleCountFirstTaskRect.offset(0, (int) statusBarHeight);
if (Console.Enabled) {
Console.log(Constants.Log.App.RecentsComponent,
"[RecentsComponent|RecentsMessageHandler|handleMessage]",
"singleTaskRect: " + mSingleCountFirstTaskRect +
+ " twoTaskRect: " + mTwoCountFirstTaskRect +
" multipleTaskRect: " + mMultipleCountFirstTaskRect);
}
@@ -132,6 +135,7 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
final public static String KEY_WINDOW_RECT = "recents.windowRect";
final public static String KEY_SYSTEM_INSETS = "recents.systemInsets";
final public static String KEY_SINGLE_TASK_STACK_RECT = "recents.singleCountTaskRect";
+ final public static String KEY_TWO_TASK_STACK_RECT = "recents.twoCountTaskRect";
final public static String KEY_MULTIPLE_TASK_STACK_RECT = "recents.multipleCountTaskRect";
@@ -157,6 +161,7 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
boolean mTriggeredFromAltTab;
Rect mSingleCountFirstTaskRect = new Rect();
+ Rect mTwoCountFirstTaskRect = new Rect();
Rect mMultipleCountFirstTaskRect = new Rect();
long mLastToggleTime;
@@ -263,8 +268,10 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
/** Returns whether we have valid task rects to animate to. */
boolean hasValidTaskRects() {
return mSingleCountFirstTaskRect != null && mSingleCountFirstTaskRect.width() > 0 &&
- mSingleCountFirstTaskRect.height() > 0 && mMultipleCountFirstTaskRect != null &&
- mMultipleCountFirstTaskRect.width() > 0 && mMultipleCountFirstTaskRect.height() > 0;
+ mSingleCountFirstTaskRect.height() > 0 && mTwoCountFirstTaskRect != null &&
+ mTwoCountFirstTaskRect.width() > 0 && mTwoCountFirstTaskRect.height() > 0 &&
+ mMultipleCountFirstTaskRect != null && mMultipleCountFirstTaskRect.width() > 0 &&
+ mMultipleCountFirstTaskRect.height() > 0;
}
/** Updates each of the task animation rects. */
@@ -305,8 +312,8 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
return null;
}
- /** Returns whether there is are multiple recents tasks */
- boolean hasMultipleRecentsTask(List<ActivityManager.RecentTaskInfo> tasks) {
+ /** Returns the proper rect to use for the animation, given the number of tasks. */
+ Rect getAnimationTaskRect(List<ActivityManager.RecentTaskInfo> tasks) {
// NOTE: Currently there's no method to get the number of non-home tasks, so we have to
// compute this ourselves
SystemServicesProxy ssp = mSystemServicesProxy;
@@ -320,7 +327,13 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
continue;
}
}
- return (tasks.size() > 1);
+ if (tasks.size() <= 1) {
+ return mSingleCountFirstTaskRect;
+ } else if (tasks.size() <= 2) {
+ return mTwoCountFirstTaskRect;
+ } else {
+ return mMultipleCountFirstTaskRect;
+ }
}
/** Converts from the device rotation to the degree */
@@ -474,9 +487,8 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
// which can differ depending on the number of items in the list.
SystemServicesProxy ssp = mSystemServicesProxy;
List<ActivityManager.RecentTaskInfo> recentTasks =
- ssp.getRecentTasks(2, UserHandle.CURRENT.getIdentifier());
- Rect taskRect = hasMultipleRecentsTask(recentTasks) ? mMultipleCountFirstTaskRect :
- mSingleCountFirstTaskRect;
+ ssp.getRecentTasks(3, UserHandle.CURRENT.getIdentifier());
+ Rect taskRect = getAnimationTaskRect(recentTasks);
boolean useThumbnailTransition = !isTopTaskHome &&
hasValidTaskRects();
diff --git a/packages/SystemUI/src/com/android/systemui/recents/Constants.java b/packages/SystemUI/src/com/android/systemui/recents/Constants.java
index ab2afb4..4db81bf 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/Constants.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/Constants.java
@@ -102,7 +102,7 @@ public class Constants {
public static final int FilterStartDelay = 25;
// The padding will be applied to the smallest dimension, and then applied to all sides
- public static final float StackPaddingPct = 0.1f;
+ public static final float StackPaddingPct = 0.085f;
// The overlap height relative to the task height
public static final float StackOverlapPct = 0.65f;
// The height of the peek space relative to the stack height
@@ -113,4 +113,4 @@ public class Constants {
public static final int StackPeekNumCards = 3;
}
}
-} \ No newline at end of file
+}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsService.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsService.java
index 9acb2bd..0c2c11d 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsService.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsService.java
@@ -83,20 +83,29 @@ class SystemUIMessageHandler extends Handler {
stack.addTask(new Task());
tsv.computeRects(taskStackBounds.width(), taskStackBounds.height() -
systemInsets.top - systemInsets.bottom, 0, 0);
- tsv.boundScroll();
+ tsv.setStackScrollToInitialState();
transform = tsv.getStackTransform(0, tsv.getStackScroll());
transform.rect.offset(taskStackBounds.left, taskStackBounds.top);
replyData.putParcelable(AlternateRecentsComponent.KEY_SINGLE_TASK_STACK_RECT,
new Rect(transform.rect));
- // Also calculate the target task rect when there are multiple tasks.
+ // Also calculate the target task rect when there are two tasks.
stack.addTask(new Task());
tsv.computeRects(taskStackBounds.width(), taskStackBounds.height() -
systemInsets.top - systemInsets.bottom, 0, 0);
- tsv.setStackScrollRaw(Integer.MAX_VALUE);
- tsv.boundScroll();
+ tsv.setStackScrollToInitialState();
transform = tsv.getStackTransform(1, tsv.getStackScroll());
transform.rect.offset(taskStackBounds.left, taskStackBounds.top);
+ replyData.putParcelable(AlternateRecentsComponent.KEY_TWO_TASK_STACK_RECT,
+ new Rect(transform.rect));
+
+ // Also calculate the target task rect when there are two tasks.
+ stack.addTask(new Task());
+ tsv.computeRects(taskStackBounds.width(), taskStackBounds.height() -
+ systemInsets.top - systemInsets.bottom, 0, 0);
+ tsv.setStackScrollToInitialState();
+ transform = tsv.getStackTransform(2, tsv.getStackScroll());
+ transform.rect.offset(taskStackBounds.left, taskStackBounds.top);
replyData.putParcelable(AlternateRecentsComponent.KEY_MULTIPLE_TASK_STACK_RECT,
new Rect(transform.rect));
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 6227013..1fbaf87 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -172,7 +172,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
}
// Set the alphas
- transform.dismissAlpha = Math.max(-1f, Math.min(0f, t)) + 1f;
+ transform.dismissAlpha = Math.max(-1f, Math.min(0f, t + 1)) + 1f;
// Update the rect and visibility
transform.rect.set(mTaskRect);
@@ -300,6 +300,15 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
public void setStackScrollRaw(int value) {
mStackScroll = value;
}
+ /** Sets the current stack scroll to the initial state when you first enter recents */
+ public void setStackScrollToInitialState() {
+ if (mStack.getTaskCount() > 2) {
+ int initialScroll = mMaxScroll - mTaskRect.height() / 2;
+ setStackScroll(initialScroll);
+ } else {
+ setStackScroll(mMaxScroll);
+ }
+ }
/**
* Returns the scroll to such that the task transform at that index will have t=0. (If the scroll
@@ -700,7 +709,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
// If this is the first layout, then scroll to the front of the stack and synchronize the
// stack views immediately
if (mAwaitingFirstLayout) {
- setStackScroll(mMaxScroll);
+ setStackScrollToInitialState();
requestSynchronizeStackViewsWithModel();
synchronizeStackViewsWithModel();
}