diff --git a/packages/SystemUI/res/layout/recents_history.xml b/packages/SystemUI/res/layout/recents_history.xml
index de70d303f199d..b65a5c58f6c73 100644
--- a/packages/SystemUI/res/layout/recents_history.xml
+++ b/packages/SystemUI/res/layout/recents_history.xml
@@ -19,16 +19,6 @@
android:layout_height="match_parent"
android:background="#99000000"
android:orientation="vertical">
-
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java
index 8dd9e47c3d863..43db6660fab31 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivityLaunchState.java
@@ -82,7 +82,11 @@ public class RecentsActivityLaunchState {
if (launchedFromHome) {
return numTasks - 1;
} else {
- return numTasks - 2;
+ if (flags.isFastToggleRecentsEnabled()) {
+ return numTasks - 1;
+ } else {
+ return numTasks - 2;
+ }
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryView.java b/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryView.java
index f48883fa175e7..9d3a99fc9e1dc 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryView.java
@@ -29,6 +29,8 @@ import android.view.animation.Interpolator;
import android.widget.LinearLayout;
import com.android.systemui.R;
+import com.android.systemui.recents.Recents;
+import com.android.systemui.recents.RecentsConfiguration;
import com.android.systemui.recents.misc.ReferenceCountedTrigger;
import com.android.systemui.recents.model.TaskStack;
@@ -43,6 +45,7 @@ public class RecentsHistoryView extends LinearLayout {
private RecyclerView mRecyclerView;
private RecentsHistoryAdapter mAdapter;
private boolean mIsVisible;
+ private Rect mSystemInsets = new Rect();
private Interpolator mFastOutSlowInInterpolator;
private Interpolator mFastOutLinearInInterpolator;
@@ -123,7 +126,8 @@ public class RecentsHistoryView extends LinearLayout {
* Updates the system insets of this history view to the provided values.
*/
public void setSystemInsets(Rect systemInsets) {
- setPadding(systemInsets.left, systemInsets.top, systemInsets.right, systemInsets.bottom);
+ mSystemInsets.set(systemInsets.left, systemInsets.top, systemInsets.right, systemInsets.bottom);
+ requestLayout();
}
/**
@@ -141,6 +145,26 @@ public class RecentsHistoryView extends LinearLayout {
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
}
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ RecentsConfiguration config = Recents.getConfiguration();
+ int width = MeasureSpec.getSize(widthMeasureSpec);
+ int height = MeasureSpec.getSize(heightMeasureSpec);
+
+ // Pad the view to align the history with the stack layout
+ Rect taskStackBounds = new Rect();
+ config.getTaskStackBounds(new Rect(0, 0, width, height), mSystemInsets.top,
+ mSystemInsets.right, new Rect() /* searchBarSpaceBounds */, taskStackBounds);
+ int stackWidthPadding = (int) (config.taskStackWidthPaddingPct * taskStackBounds.width());
+ int stackHeightPadding = mContext.getResources().getDimensionPixelSize(
+ R.dimen.recents_stack_top_padding);
+ mRecyclerView.setPadding(stackWidthPadding + mSystemInsets.left,
+ stackHeightPadding + mSystemInsets.top,
+ stackWidthPadding + mSystemInsets.right, mSystemInsets.bottom);
+
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ }
+
@Override
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
setSystemInsets(insets.getSystemWindowInsets());
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
index fb84a22e490f4..4a5956dbab97a 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
@@ -431,10 +431,11 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
.setStartDelay(0)
.setDuration(taskViewExitToAppDuration)
.setInterpolator(mFastOutLinearInInterpolator)
+ .withEndAction(postAnimRunnable)
.start();
} else {
// Hide the dismiss button
- mHeaderView.startLaunchTaskDismissAnimation();
+ mHeaderView.startLaunchTaskDismissAnimation(postAnimRunnable);
// If this is another view in the task grouping and is in front of the launch task,
// animate it away first
if (occludesLaunchTarget) {
@@ -670,21 +671,13 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
@Override
public void onTaskDataLoaded() {
SystemServicesProxy ssp = Recents.getSystemServices();
- RecentsConfiguration config = Recents.getConfiguration();
if (mThumbnailView != null && mHeaderView != null) {
// Bind each of the views to the new task data
mThumbnailView.rebindToTask(mTask);
mHeaderView.rebindToTask(mTask);
// Rebind any listeners
mActionButtonView.setOnClickListener(this);
-
- // Only enable long-click if we have a freeform workspace to drag to/from, or if we
- // aren't already docked
- if (ssp.hasFreeformWorkspaceSupport() || !config.hasDockedTasks) {
- setOnLongClickListener(this);
- } else {
- setOnLongClickListener(null);
- }
+ setOnLongClickListener(this);
}
mTaskDataLoaded = true;
}
@@ -724,7 +717,8 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
@Override
public boolean onLongClick(View v) {
- if (v == this) {
+ SystemServicesProxy ssp = Recents.getSystemServices();
+ if (v == this && !ssp.hasDockedTask()) {
// Start listening for drag events
setClipViewInStack(false);
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java
index 76c6691aa2bd8..85b4b9baae25b 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java
@@ -284,7 +284,7 @@ public class TaskViewHeader extends FrameLayout
}
/** Animates this task bar dismiss button when launching a task. */
- void startLaunchTaskDismissAnimation() {
+ void startLaunchTaskDismissAnimation(final Runnable postAnimationRunanble) {
if (mDismissButton.getVisibility() == View.VISIBLE) {
int taskViewExitToAppDuration = mContext.getResources().getInteger(
R.integer.recents_task_exit_to_app_duration);
@@ -294,6 +294,7 @@ public class TaskViewHeader extends FrameLayout
.setStartDelay(0)
.setInterpolator(mFastOutSlowInInterpolator)
.setDuration(taskViewExitToAppDuration)
+ .withEndAction(postAnimationRunanble)
.start();
}
}