Merge "Fixing issue with animations not being cancelled." into nyc-dev

This commit is contained in:
Winson Chung
2016-03-10 02:21:05 +00:00
committed by Android (Google) Code Review
6 changed files with 40 additions and 19 deletions

View File

@@ -22,6 +22,9 @@
<!-- Standard notification gravity --> <!-- Standard notification gravity -->
<integer name="notification_panel_layout_gravity">@integer/standard_notification_panel_layout_gravity</integer> <integer name="notification_panel_layout_gravity">@integer/standard_notification_panel_layout_gravity</integer>
<!-- The size of the initial peek area at the bottom of the stack (above the nav bar). -->
<dimen name="recents_initial_bottom_peek_size">@dimen/recents_task_bar_height</dimen>
<dimen name="docked_divider_handle_width">2dp</dimen> <dimen name="docked_divider_handle_width">2dp</dimen>
<dimen name="docked_divider_handle_height">16dp</dimen> <dimen name="docked_divider_handle_height">16dp</dimen>
</resources> </resources>

View File

@@ -99,6 +99,9 @@
<!-- The top padding for the task stack. --> <!-- The top padding for the task stack. -->
<dimen name="recents_stack_top_padding">40dp</dimen> <dimen name="recents_stack_top_padding">40dp</dimen>
<!-- The size of the initial peek area at the bottom of the stack (above the nav bar). -->
<dimen name="recents_initial_bottom_peek_size">100dp</dimen>
<!-- The side padding for the task stack. --> <!-- The side padding for the task stack. -->
<dimen name="recents_stack_left_right_padding">64dp</dimen> <dimen name="recents_stack_left_right_padding">64dp</dimen>
</resources> </resources>

View File

@@ -295,6 +295,9 @@
<!-- The size of the initial peek area at the top of the stack (below the status bar). --> <!-- The size of the initial peek area at the top of the stack (below the status bar). -->
<dimen name="recents_initial_top_peek_size">8dp</dimen> <dimen name="recents_initial_top_peek_size">8dp</dimen>
<!-- The size of the initial peek area at the bottom of the stack (above the nav bar). -->
<dimen name="recents_initial_bottom_peek_size">100dp</dimen>
<!-- The size of the peek area at the top of the stack (below the status bar). --> <!-- The size of the peek area at the top of the stack (below the status bar). -->
<dimen name="recents_layout_focused_top_peek_size">@dimen/recents_history_button_height</dimen> <dimen name="recents_layout_focused_top_peek_size">@dimen/recents_history_button_height</dimen>

View File

@@ -431,13 +431,6 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
mIgnoreAltTabRelease = false; mIgnoreAltTabRelease = false;
mIterateTrigger.stopDozing(); mIterateTrigger.stopDozing();
// Workaround for b/22542869, if the RecentsActivity is started again, but without going
// through SystemUI, we need to reset the config launch flags to ensure that we do not
// wait on the system to send a signal that was never queued.
RecentsConfiguration config = Recents.getConfiguration();
RecentsActivityLaunchState launchState = config.getLaunchState();
launchState.reset();
} }
@Override @Override
@@ -453,6 +446,13 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
mIsVisible = false; mIsVisible = false;
EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, false)); EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, false));
MetricsLogger.hidden(this, MetricsEvent.OVERVIEW_ACTIVITY); MetricsLogger.hidden(this, MetricsEvent.OVERVIEW_ACTIVITY);
// Workaround for b/22542869, if the RecentsActivity is started again, but without going
// through SystemUI, we need to reset the config launch flags to ensure that we do not
// wait on the system to send a signal that was never queued.
RecentsConfiguration config = Recents.getConfiguration();
RecentsActivityLaunchState launchState = config.getLaunchState();
launchState.reset();
} }
@Override @Override

View File

@@ -105,6 +105,9 @@ public class RecentsTransitionHelper {
animStartedListener = new ActivityOptions.OnAnimationStartedListener() { animStartedListener = new ActivityOptions.OnAnimationStartedListener() {
@Override @Override
public void onAnimationStarted() { public void onAnimationStarted() {
// If we are launching into another task, cancel the previous task's
// window transition
EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(task));
EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent()); EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
if (screenPinningRequested) { if (screenPinningRequested) {
@@ -119,6 +122,9 @@ public class RecentsTransitionHelper {
animStartedListener = new ActivityOptions.OnAnimationStartedListener() { animStartedListener = new ActivityOptions.OnAnimationStartedListener() {
@Override @Override
public void onAnimationStarted() { public void onAnimationStarted() {
// If we are launching into another task, cancel the previous task's
// window transition
EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(task));
EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent()); EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
} }
}; };
@@ -146,10 +152,6 @@ public class RecentsTransitionHelper {
animStartedListener); animStartedListener);
} }
} }
// If we are launching into another task, cancel the previous task's
// window transition
EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(task));
} }
/** /**
@@ -278,7 +280,8 @@ public class RecentsTransitionHelper {
} else { } else {
layoutAlgorithm.getStackTransformScreenCoordinates(task, stackScroll, mTmpTransform, layoutAlgorithm.getStackTransformScreenCoordinates(task, stackScroll, mTmpTransform,
null); null);
specs.add(composeAnimationSpec(taskView, mTmpTransform, true /* addHeaderBitmap */)); specs.add(composeAnimationSpec(stackView, taskView, mTmpTransform,
true /* addHeaderBitmap */));
} }
return specs; return specs;
} }
@@ -299,7 +302,8 @@ public class RecentsTransitionHelper {
} else { } else {
layoutAlgorithm.getStackTransformScreenCoordinates(t, stackScroll, layoutAlgorithm.getStackTransformScreenCoordinates(t, stackScroll,
mTmpTransform, null); mTmpTransform, null);
specs.add(composeAnimationSpec(tv, mTmpTransform, true /* addHeaderBitmap */)); specs.add(composeAnimationSpec(stackView, tv, mTmpTransform,
true /* addHeaderBitmap */));
} }
} }
} }
@@ -318,8 +322,8 @@ public class RecentsTransitionHelper {
/** /**
* Composes a single animation spec for the given {@link TaskView} * Composes a single animation spec for the given {@link TaskView}
*/ */
private static AppTransitionAnimationSpec composeAnimationSpec(TaskView taskView, private static AppTransitionAnimationSpec composeAnimationSpec(TaskStackView stackView,
TaskViewTransform transform, boolean addHeaderBitmap) { TaskView taskView, TaskViewTransform transform, boolean addHeaderBitmap) {
Bitmap b = null; Bitmap b = null;
if (addHeaderBitmap) { if (addHeaderBitmap) {
float scale = transform.scale; float scale = transform.scale;
@@ -341,6 +345,10 @@ public class RecentsTransitionHelper {
Rect taskRect = new Rect(); Rect taskRect = new Rect();
transform.rect.round(taskRect); transform.rect.round(taskRect);
if (stackView.getStack().getStackFrontMostTask(false /* includeFreeformTasks */) !=
taskView.getTask()) {
taskRect.bottom = 2 * Recents.getSystemServices().getDisplayRect().height();
}
return new AppTransitionAnimationSpec(taskView.getTask().key.id, b, taskRect); return new AppTransitionAnimationSpec(taskView.getTask().key.id, b, taskRect);
} }
} }

View File

@@ -222,9 +222,11 @@ public class TaskStackLayoutAlgorithm {
private Range mUnfocusedRange; private Range mUnfocusedRange;
private Range mFocusedRange; private Range mFocusedRange;
// The initial offset from the top of the stack // The initial offset from the top and bottom of the stack
@ViewDebug.ExportedProperty(category="recents") @ViewDebug.ExportedProperty(category="recents")
private int mInitialTopPeekHeight; private int mInitialTopPeekHeight;
@ViewDebug.ExportedProperty(category="recents")
private int mInitialBottomPeekHeight;
// The offset from the top when scrolled to the top of the stack // The offset from the top when scrolled to the top of the stack
@ViewDebug.ExportedProperty(category="recents") @ViewDebug.ExportedProperty(category="recents")
@@ -322,6 +324,8 @@ public class TaskStackLayoutAlgorithm {
res.getFloat(R.integer.recents_layout_unfocused_range_max)); res.getFloat(R.integer.recents_layout_unfocused_range_max));
mFocusState = getInitialFocusState(); mFocusState = getInitialFocusState();
mInitialTopPeekHeight = res.getDimensionPixelSize(R.dimen.recents_initial_top_peek_size); mInitialTopPeekHeight = res.getDimensionPixelSize(R.dimen.recents_initial_top_peek_size);
mInitialBottomPeekHeight =
res.getDimensionPixelSize(R.dimen.recents_initial_bottom_peek_size);
mFocusedTopPeekHeight = mFocusedTopPeekHeight =
res.getDimensionPixelSize(R.dimen.recents_layout_focused_top_peek_size); res.getDimensionPixelSize(R.dimen.recents_layout_focused_top_peek_size);
mFocusedBottomTaskPeekHeight = mFocusedBottomTaskPeekHeight =
@@ -508,10 +512,10 @@ public class TaskStackLayoutAlgorithm {
float initialPeekOffsetNormX = mUnfocusedCurveInterpolator.getX(initialPeekOffsetPct); float initialPeekOffsetNormX = mUnfocusedCurveInterpolator.getX(initialPeekOffsetPct);
float initialFocusedOffset = mStackRect.height() - mInitialTopPeekHeight - float initialFocusedOffset = mStackRect.height() - mInitialTopPeekHeight -
(mHeaderBarHeight * 1f) + 1; (mHeaderBarHeight * 1f) + 1;
float initialFocusedOffsetPct = (float) initialFocusedOffset / mStackRect.height(); float initialFocusedOffsetPct = initialFocusedOffset / mStackRect.height();
float initialFocusedNormX = mUnfocusedCurveInterpolator.getX(initialFocusedOffsetPct); float initialFocusedNormX = mUnfocusedCurveInterpolator.getX(initialFocusedOffsetPct);
int initialBottomOffset = mStackBottomOffset + mHeaderBarHeight; float initialBottomOffset = mStackBottomOffset + mInitialBottomPeekHeight;
float initialBottomOffsetPct = (float) initialBottomOffset / mStackRect.height(); float initialBottomOffsetPct = initialBottomOffset / mStackRect.height();
float initialBottomNormX = mUnfocusedCurveInterpolator.getX(initialBottomOffsetPct); float initialBottomNormX = mUnfocusedCurveInterpolator.getX(initialBottomOffsetPct);
/* /*
// If we want to offset the top card slightly // If we want to offset the top card slightly