Fixing issue with animations not being cancelled.

Bug: 27533931
Change-Id: I724643ec8a2c6cdaa3cade72ae40abcf9d28bae5
This commit is contained in:
Winson
2016-03-09 17:44:54 -08:00
parent 4cfea69511
commit 73492c5d7a
6 changed files with 40 additions and 19 deletions

View File

@@ -22,6 +22,9 @@
<!-- Standard notification gravity -->
<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_height">16dp</dimen>
</resources>

View File

@@ -99,6 +99,9 @@
<!-- The top padding for the task stack. -->
<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. -->
<dimen name="recents_stack_left_right_padding">64dp</dimen>
</resources>

View File

@@ -295,6 +295,9 @@
<!-- 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>
<!-- 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). -->
<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;
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
@@ -453,6 +446,13 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
mIsVisible = false;
EventBus.getDefault().send(new RecentsVisibilityChangedEvent(this, false));
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

View File

@@ -105,6 +105,9 @@ public class RecentsTransitionHelper {
animStartedListener = new ActivityOptions.OnAnimationStartedListener() {
@Override
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());
if (screenPinningRequested) {
@@ -119,6 +122,9 @@ public class RecentsTransitionHelper {
animStartedListener = new ActivityOptions.OnAnimationStartedListener() {
@Override
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());
}
};
@@ -146,10 +152,6 @@ public class RecentsTransitionHelper {
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 {
layoutAlgorithm.getStackTransformScreenCoordinates(task, stackScroll, mTmpTransform,
null);
specs.add(composeAnimationSpec(taskView, mTmpTransform, true /* addHeaderBitmap */));
specs.add(composeAnimationSpec(stackView, taskView, mTmpTransform,
true /* addHeaderBitmap */));
}
return specs;
}
@@ -299,7 +302,8 @@ public class RecentsTransitionHelper {
} else {
layoutAlgorithm.getStackTransformScreenCoordinates(t, stackScroll,
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}
*/
private static AppTransitionAnimationSpec composeAnimationSpec(TaskView taskView,
TaskViewTransform transform, boolean addHeaderBitmap) {
private static AppTransitionAnimationSpec composeAnimationSpec(TaskStackView stackView,
TaskView taskView, TaskViewTransform transform, boolean addHeaderBitmap) {
Bitmap b = null;
if (addHeaderBitmap) {
float scale = transform.scale;
@@ -341,6 +345,10 @@ public class RecentsTransitionHelper {
Rect taskRect = new Rect();
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);
}
}

View File

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