Fix a few weird state issues from race-conditions
- When starting another transition while the dock transition is already set, always override that because that transition starts prolonged animations which will never be ended. - Only dock if we get a good UP event. Bug: 28257206 Change-Id: Icabfcf475f419696d2bcff8fbb53cf3b29dedd69
This commit is contained in:
@@ -202,8 +202,8 @@ public class RecentsViewTouchHandler {
|
||||
* Handles dragging touch events
|
||||
*/
|
||||
private void handleTouchEvent(MotionEvent ev) {
|
||||
int action = ev.getAction();
|
||||
switch (action & MotionEvent.ACTION_MASK) {
|
||||
int action = ev.getActionMasked();
|
||||
switch (action) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
mDownPos.set((int) ev.getX(), (int) ev.getY());
|
||||
break;
|
||||
@@ -258,7 +258,7 @@ public class RecentsViewTouchHandler {
|
||||
case MotionEvent.ACTION_CANCEL: {
|
||||
if (mDragRequested) {
|
||||
EventBus.getDefault().send(new DragEndEvent(mDragTask, mTaskView,
|
||||
mLastDropTarget));
|
||||
action == MotionEvent.ACTION_UP ? mLastDropTarget : null));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1914,6 +1914,14 @@ public class AppTransition implements Dump {
|
||||
setAppTransition(transit);
|
||||
}
|
||||
}
|
||||
if (transit != TRANSIT_DOCK_TASK_FROM_RECENTS
|
||||
&& mNextAppTransition == TRANSIT_DOCK_TASK_FROM_RECENTS) {
|
||||
|
||||
// Somebody is trying to start another transition while we are waiting for the docking
|
||||
// window to be drawn. Because TRANSIT_DOCK_TASK_FROM_RECENTS starts prolonged
|
||||
// animations, we need to override it or our prolonged animations will never be ended.
|
||||
setAppTransition(transit);
|
||||
}
|
||||
boolean prepared = prepare();
|
||||
if (isTransitionSet()) {
|
||||
mService.mH.removeMessages(H.APP_TRANSITION_TIMEOUT);
|
||||
|
||||
Reference in New Issue
Block a user