2018-01-12 14:17:30 -08:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2018 The Android Open Source Project
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
package com.android.launcher3.uioverrides;
|
|
|
|
|
|
2018-03-09 22:01:47 +00:00
|
|
|
import static com.android.launcher3.LauncherState.OVERVIEW;
|
|
|
|
|
import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity;
|
|
|
|
|
|
2018-01-12 14:17:30 -08:00
|
|
|
import android.animation.Animator;
|
|
|
|
|
import android.animation.AnimatorListenerAdapter;
|
|
|
|
|
import android.animation.AnimatorSet;
|
|
|
|
|
import android.animation.ValueAnimator;
|
|
|
|
|
import android.util.Log;
|
|
|
|
|
import android.view.MotionEvent;
|
|
|
|
|
import android.view.View;
|
|
|
|
|
|
|
|
|
|
import com.android.launcher3.AbstractFloatingView;
|
|
|
|
|
import com.android.launcher3.Launcher;
|
2018-03-29 09:39:56 -07:00
|
|
|
import com.android.launcher3.LauncherAppTransitionManagerImpl;
|
|
|
|
|
import com.android.launcher3.LauncherAppTransitionManagerImpl.AnimConfig;
|
2018-01-12 14:17:30 -08:00
|
|
|
import com.android.launcher3.Utilities;
|
|
|
|
|
import com.android.launcher3.anim.AnimatorPlaybackController;
|
2018-03-29 09:39:56 -07:00
|
|
|
import com.android.launcher3.anim.Interpolators;
|
2018-01-12 14:17:30 -08:00
|
|
|
import com.android.launcher3.dragndrop.DragLayer;
|
|
|
|
|
import com.android.launcher3.touch.SwipeDetector;
|
Quick step/scrub/switch logging
- state transition happening due to Home and back is handled by
specifying src target as 'from' container and dst target as the 'to'
container
- Source and Destination container shows FROM and TO state for SWIPE/FLING
- event.isStateChange = true indicates that an action resulted in
state transition
- Elapsed container millis is the screen time on the source container
Bug: 70181187
- logcat printout with setprop log.tag.UserEvent VERBOSE
1) State: WORKSPACE -> ALLAPPS
action:FLING direction=UP
Source child:HOTSEAT id=0 parent:WORKSPACE id=0
Destination child:ALLAPPS
Elapsed container 1225 ms, session 1225 ms, action 0 ms
2) ALLAPPS -> HOMESCREEN
action:FLING direction=DOWN
Source child:ALLAPPS parent:ALLAPPS
Destination child:WORKSPACE id=0
Elapsed container 971 ms, session 2197 ms, action 0 ms
3) HOMESCREEN -> OVERVIEW
action:FLING direction=UP
Source child:NAVBAR parent:WORKSPACE id=0
Destination child:TASKSWITCHER
Elapsed container 4834 ms, session 4834 ms, action 0 ms
4) OVERVIEW-> ALLAPPS
action:FLING direction=UP
Source child:TASK parent:TASKSWITCHER
Destination child:ALLAPPS
Elapsed container 2176 ms, session 7010 ms, action 0 ms
5) ALLAPPS->OVERVIEW
action:FLING direction=DOWN
Source child:ALLAPPS parent:ALLAPPS
Destination child:TASKSWITCHER
Elapsed container 3683 ms, session 10693 ms, action 0 ms
6) OVERVIEW-> HOMESCREEN
action:FLING direction=DOWN
Source child:TASK parent:TASKSWITCHER
Destination child:WORKSPACE id=0
Elapsed container 2108 ms, session 12801 ms, action 0 ms
7) APPS-> OVERVIEW
action:FLING direction=UP
Source child:NAVBAR parent:APP
Destination child:TASKSWITCHER
Elapsed container 104 ms, session 104 ms, action 0 ms
8) Quickscrub: action:DRAGANDDROP Source child: QUICK
9) Quickswitch: action:FLING Source child: QUICK
Change-Id: I5898230859ff600f48a2a873a40b670fe4d39a0d
2018-02-14 13:40:25 -08:00
|
|
|
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
|
|
|
|
|
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
|
2018-01-12 14:17:30 -08:00
|
|
|
import com.android.launcher3.util.TouchController;
|
2018-03-13 16:44:00 -07:00
|
|
|
import com.android.quickstep.PendingAnimation;
|
2018-03-13 09:57:05 -07:00
|
|
|
import com.android.quickstep.views.RecentsView;
|
|
|
|
|
import com.android.quickstep.views.TaskView;
|
2018-01-12 14:17:30 -08:00
|
|
|
|
|
|
|
|
/**
|
2018-03-14 17:51:49 -07:00
|
|
|
* Touch controller for handling task view card swipes
|
2018-01-12 14:17:30 -08:00
|
|
|
*/
|
2018-03-14 17:51:49 -07:00
|
|
|
public class TaskViewTouchController extends AnimatorListenerAdapter
|
2018-01-12 14:17:30 -08:00
|
|
|
implements TouchController, SwipeDetector.Listener {
|
|
|
|
|
|
|
|
|
|
private static final String TAG = "OverviewSwipeController";
|
|
|
|
|
|
|
|
|
|
private static final float ALLOWED_FLING_DIRECTION_CHANGE_PROGRESS = 0.1f;
|
|
|
|
|
private static final int SINGLE_FRAME_MS = 16;
|
|
|
|
|
|
|
|
|
|
// Progress after which the transition is assumed to be a success in case user does not fling
|
|
|
|
|
private static final float SUCCESS_TRANSITION_PROGRESS = 0.5f;
|
|
|
|
|
|
|
|
|
|
private final Launcher mLauncher;
|
|
|
|
|
private final SwipeDetector mDetector;
|
|
|
|
|
private final RecentsView mRecentsView;
|
|
|
|
|
private final int[] mTempCords = new int[2];
|
|
|
|
|
|
2018-03-13 16:44:00 -07:00
|
|
|
private PendingAnimation mPendingAnimation;
|
2018-01-12 14:17:30 -08:00
|
|
|
private AnimatorPlaybackController mCurrentAnimation;
|
|
|
|
|
private boolean mCurrentAnimationIsGoingUp;
|
|
|
|
|
|
|
|
|
|
private boolean mNoIntercept;
|
|
|
|
|
|
|
|
|
|
private float mDisplacementShift;
|
|
|
|
|
private float mProgressMultiplier;
|
|
|
|
|
private float mEndDisplacement;
|
|
|
|
|
|
|
|
|
|
private TaskView mTaskBeingDragged;
|
|
|
|
|
|
2018-03-14 17:51:49 -07:00
|
|
|
public TaskViewTouchController(Launcher launcher) {
|
2018-01-12 14:17:30 -08:00
|
|
|
mLauncher = launcher;
|
|
|
|
|
mRecentsView = launcher.getOverviewPanel();
|
|
|
|
|
mDetector = new SwipeDetector(launcher, this, SwipeDetector.VERTICAL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean canInterceptTouch() {
|
|
|
|
|
if (mCurrentAnimation != null) {
|
|
|
|
|
// If we are already animating from a previous state, we can intercept.
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if (AbstractFloatingView.getTopOpenView(mLauncher) != null) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return mLauncher.isInState(OVERVIEW);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onAnimationCancel(Animator animation) {
|
|
|
|
|
if (mCurrentAnimation != null && animation == mCurrentAnimation.getTarget()) {
|
|
|
|
|
Log.e(TAG, "Who dare cancel the animation when I am in control", new Exception());
|
|
|
|
|
mDetector.finishedScrolling();
|
|
|
|
|
mCurrentAnimation = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
|
|
|
|
|
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
|
|
|
|
|
mNoIntercept = !canInterceptTouch();
|
|
|
|
|
if (mNoIntercept) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Now figure out which direction scroll events the controller will start
|
|
|
|
|
// calling the callbacks.
|
|
|
|
|
final int directionsToDetectScroll;
|
|
|
|
|
boolean ignoreSlopWhenSettling = false;
|
|
|
|
|
if (mCurrentAnimation != null) {
|
|
|
|
|
directionsToDetectScroll = SwipeDetector.DIRECTION_BOTH;
|
|
|
|
|
ignoreSlopWhenSettling = true;
|
|
|
|
|
} else {
|
|
|
|
|
mTaskBeingDragged = null;
|
|
|
|
|
|
2018-03-09 22:01:47 +00:00
|
|
|
View view = mRecentsView.getChildAt(mRecentsView.getCurrentPage());
|
2018-03-13 14:09:46 +00:00
|
|
|
if (view instanceof TaskView && mLauncher.getDragLayer().isEventOverView(view, ev)) {
|
2018-03-09 22:01:47 +00:00
|
|
|
// The tile can be dragged down to open the task.
|
|
|
|
|
mTaskBeingDragged = (TaskView) view;
|
2018-01-12 14:17:30 -08:00
|
|
|
directionsToDetectScroll = SwipeDetector.DIRECTION_BOTH;
|
|
|
|
|
} else {
|
2018-03-09 22:01:47 +00:00
|
|
|
mNoIntercept = true;
|
|
|
|
|
return false;
|
2018-01-12 14:17:30 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mDetector.setDetectableScrollConditions(
|
|
|
|
|
directionsToDetectScroll, ignoreSlopWhenSettling);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mNoIntercept) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onControllerTouchEvent(ev);
|
|
|
|
|
return mDetector.isDraggingOrSettling();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onControllerTouchEvent(MotionEvent ev) {
|
|
|
|
|
return mDetector.onTouchEvent(ev);
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-17 11:03:38 -08:00
|
|
|
private void reInitAnimationController(boolean goingUp) {
|
2018-01-12 14:17:30 -08:00
|
|
|
if (mCurrentAnimation != null && mCurrentAnimationIsGoingUp == goingUp) {
|
|
|
|
|
// No need to init
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (mCurrentAnimation != null) {
|
|
|
|
|
mCurrentAnimation.setPlayFraction(0);
|
|
|
|
|
}
|
2018-03-13 16:44:00 -07:00
|
|
|
if (mPendingAnimation != null) {
|
|
|
|
|
mPendingAnimation.finish(false);
|
|
|
|
|
mPendingAnimation = null;
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-12 14:17:30 -08:00
|
|
|
mCurrentAnimationIsGoingUp = goingUp;
|
|
|
|
|
float range = mLauncher.getAllAppsController().getShiftRange();
|
|
|
|
|
long maxDuration = (long) (2 * range);
|
|
|
|
|
DragLayer dl = mLauncher.getDragLayer();
|
|
|
|
|
|
2018-03-14 17:51:49 -07:00
|
|
|
if (goingUp) {
|
|
|
|
|
mPendingAnimation = mRecentsView.createTaskDismissAnimation(mTaskBeingDragged,
|
|
|
|
|
true /* animateTaskView */, true /* removeTask */, maxDuration);
|
|
|
|
|
mCurrentAnimation = AnimatorPlaybackController
|
|
|
|
|
.wrap(mPendingAnimation.anim, maxDuration);
|
|
|
|
|
mEndDisplacement = -mTaskBeingDragged.getHeight();
|
2018-01-12 14:17:30 -08:00
|
|
|
} else {
|
2018-03-29 09:39:56 -07:00
|
|
|
LauncherAppTransitionManagerImpl appTransitionManager =
|
|
|
|
|
(LauncherAppTransitionManagerImpl) mLauncher.getAppTransitionManager();
|
|
|
|
|
AnimatorSet anim = appTransitionManager.composeUserControlledRecentsLaunchAnimator(
|
|
|
|
|
mTaskBeingDragged, new AnimConfig(maxDuration, Interpolators.ZOOM_IN));
|
2018-03-14 17:51:49 -07:00
|
|
|
mCurrentAnimation = AnimatorPlaybackController.wrap(anim, maxDuration);
|
2018-01-12 14:17:30 -08:00
|
|
|
|
2018-03-14 17:51:49 -07:00
|
|
|
mTempCords[1] = mTaskBeingDragged.getHeight();
|
|
|
|
|
dl.getDescendantCoordRelativeToSelf(mTaskBeingDragged, mTempCords);
|
|
|
|
|
mEndDisplacement = dl.getHeight() - mTempCords[1];
|
2018-01-12 14:17:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mCurrentAnimation.getTarget().addListener(this);
|
|
|
|
|
mCurrentAnimation.dispatchOnStart();
|
|
|
|
|
mProgressMultiplier = 1 / mEndDisplacement;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onDragStart(boolean start) {
|
|
|
|
|
if (mCurrentAnimation == null) {
|
2018-01-17 11:03:38 -08:00
|
|
|
reInitAnimationController(mDetector.wasInitialTouchPositive());
|
2018-01-12 14:17:30 -08:00
|
|
|
mDisplacementShift = 0;
|
|
|
|
|
} else {
|
|
|
|
|
mDisplacementShift = mCurrentAnimation.getProgressFraction() / mProgressMultiplier;
|
|
|
|
|
mCurrentAnimation.pause();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onDrag(float displacement, float velocity) {
|
|
|
|
|
float totalDisplacement = displacement + mDisplacementShift;
|
|
|
|
|
boolean isGoingUp =
|
|
|
|
|
totalDisplacement == 0 ? mCurrentAnimationIsGoingUp : totalDisplacement < 0;
|
|
|
|
|
if (isGoingUp != mCurrentAnimationIsGoingUp) {
|
2018-01-17 11:03:38 -08:00
|
|
|
reInitAnimationController(isGoingUp);
|
2018-01-12 14:17:30 -08:00
|
|
|
}
|
|
|
|
|
mCurrentAnimation.setPlayFraction(totalDisplacement * mProgressMultiplier);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onDragEnd(float velocity, boolean fling) {
|
|
|
|
|
final boolean goingToEnd;
|
Quick step/scrub/switch logging
- state transition happening due to Home and back is handled by
specifying src target as 'from' container and dst target as the 'to'
container
- Source and Destination container shows FROM and TO state for SWIPE/FLING
- event.isStateChange = true indicates that an action resulted in
state transition
- Elapsed container millis is the screen time on the source container
Bug: 70181187
- logcat printout with setprop log.tag.UserEvent VERBOSE
1) State: WORKSPACE -> ALLAPPS
action:FLING direction=UP
Source child:HOTSEAT id=0 parent:WORKSPACE id=0
Destination child:ALLAPPS
Elapsed container 1225 ms, session 1225 ms, action 0 ms
2) ALLAPPS -> HOMESCREEN
action:FLING direction=DOWN
Source child:ALLAPPS parent:ALLAPPS
Destination child:WORKSPACE id=0
Elapsed container 971 ms, session 2197 ms, action 0 ms
3) HOMESCREEN -> OVERVIEW
action:FLING direction=UP
Source child:NAVBAR parent:WORKSPACE id=0
Destination child:TASKSWITCHER
Elapsed container 4834 ms, session 4834 ms, action 0 ms
4) OVERVIEW-> ALLAPPS
action:FLING direction=UP
Source child:TASK parent:TASKSWITCHER
Destination child:ALLAPPS
Elapsed container 2176 ms, session 7010 ms, action 0 ms
5) ALLAPPS->OVERVIEW
action:FLING direction=DOWN
Source child:ALLAPPS parent:ALLAPPS
Destination child:TASKSWITCHER
Elapsed container 3683 ms, session 10693 ms, action 0 ms
6) OVERVIEW-> HOMESCREEN
action:FLING direction=DOWN
Source child:TASK parent:TASKSWITCHER
Destination child:WORKSPACE id=0
Elapsed container 2108 ms, session 12801 ms, action 0 ms
7) APPS-> OVERVIEW
action:FLING direction=UP
Source child:NAVBAR parent:APP
Destination child:TASKSWITCHER
Elapsed container 104 ms, session 104 ms, action 0 ms
8) Quickscrub: action:DRAGANDDROP Source child: QUICK
9) Quickswitch: action:FLING Source child: QUICK
Change-Id: I5898230859ff600f48a2a873a40b670fe4d39a0d
2018-02-14 13:40:25 -08:00
|
|
|
final int logAction;
|
2018-01-12 14:17:30 -08:00
|
|
|
if (fling) {
|
Quick step/scrub/switch logging
- state transition happening due to Home and back is handled by
specifying src target as 'from' container and dst target as the 'to'
container
- Source and Destination container shows FROM and TO state for SWIPE/FLING
- event.isStateChange = true indicates that an action resulted in
state transition
- Elapsed container millis is the screen time on the source container
Bug: 70181187
- logcat printout with setprop log.tag.UserEvent VERBOSE
1) State: WORKSPACE -> ALLAPPS
action:FLING direction=UP
Source child:HOTSEAT id=0 parent:WORKSPACE id=0
Destination child:ALLAPPS
Elapsed container 1225 ms, session 1225 ms, action 0 ms
2) ALLAPPS -> HOMESCREEN
action:FLING direction=DOWN
Source child:ALLAPPS parent:ALLAPPS
Destination child:WORKSPACE id=0
Elapsed container 971 ms, session 2197 ms, action 0 ms
3) HOMESCREEN -> OVERVIEW
action:FLING direction=UP
Source child:NAVBAR parent:WORKSPACE id=0
Destination child:TASKSWITCHER
Elapsed container 4834 ms, session 4834 ms, action 0 ms
4) OVERVIEW-> ALLAPPS
action:FLING direction=UP
Source child:TASK parent:TASKSWITCHER
Destination child:ALLAPPS
Elapsed container 2176 ms, session 7010 ms, action 0 ms
5) ALLAPPS->OVERVIEW
action:FLING direction=DOWN
Source child:ALLAPPS parent:ALLAPPS
Destination child:TASKSWITCHER
Elapsed container 3683 ms, session 10693 ms, action 0 ms
6) OVERVIEW-> HOMESCREEN
action:FLING direction=DOWN
Source child:TASK parent:TASKSWITCHER
Destination child:WORKSPACE id=0
Elapsed container 2108 ms, session 12801 ms, action 0 ms
7) APPS-> OVERVIEW
action:FLING direction=UP
Source child:NAVBAR parent:APP
Destination child:TASKSWITCHER
Elapsed container 104 ms, session 104 ms, action 0 ms
8) Quickscrub: action:DRAGANDDROP Source child: QUICK
9) Quickswitch: action:FLING Source child: QUICK
Change-Id: I5898230859ff600f48a2a873a40b670fe4d39a0d
2018-02-14 13:40:25 -08:00
|
|
|
logAction = Touch.FLING;
|
2018-01-12 14:17:30 -08:00
|
|
|
boolean goingUp = velocity < 0;
|
2018-03-14 17:51:49 -07:00
|
|
|
if (goingUp != mCurrentAnimationIsGoingUp) {
|
2018-01-12 14:17:30 -08:00
|
|
|
// In case the fling is in opposite direction, make sure if is close enough
|
|
|
|
|
// from the start position
|
|
|
|
|
if (mCurrentAnimation.getProgressFraction()
|
|
|
|
|
>= ALLOWED_FLING_DIRECTION_CHANGE_PROGRESS) {
|
|
|
|
|
// Not allowed
|
|
|
|
|
goingToEnd = false;
|
|
|
|
|
} else {
|
2018-01-17 11:03:38 -08:00
|
|
|
reInitAnimationController(goingUp);
|
2018-01-12 14:17:30 -08:00
|
|
|
goingToEnd = true;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
goingToEnd = true;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
Quick step/scrub/switch logging
- state transition happening due to Home and back is handled by
specifying src target as 'from' container and dst target as the 'to'
container
- Source and Destination container shows FROM and TO state for SWIPE/FLING
- event.isStateChange = true indicates that an action resulted in
state transition
- Elapsed container millis is the screen time on the source container
Bug: 70181187
- logcat printout with setprop log.tag.UserEvent VERBOSE
1) State: WORKSPACE -> ALLAPPS
action:FLING direction=UP
Source child:HOTSEAT id=0 parent:WORKSPACE id=0
Destination child:ALLAPPS
Elapsed container 1225 ms, session 1225 ms, action 0 ms
2) ALLAPPS -> HOMESCREEN
action:FLING direction=DOWN
Source child:ALLAPPS parent:ALLAPPS
Destination child:WORKSPACE id=0
Elapsed container 971 ms, session 2197 ms, action 0 ms
3) HOMESCREEN -> OVERVIEW
action:FLING direction=UP
Source child:NAVBAR parent:WORKSPACE id=0
Destination child:TASKSWITCHER
Elapsed container 4834 ms, session 4834 ms, action 0 ms
4) OVERVIEW-> ALLAPPS
action:FLING direction=UP
Source child:TASK parent:TASKSWITCHER
Destination child:ALLAPPS
Elapsed container 2176 ms, session 7010 ms, action 0 ms
5) ALLAPPS->OVERVIEW
action:FLING direction=DOWN
Source child:ALLAPPS parent:ALLAPPS
Destination child:TASKSWITCHER
Elapsed container 3683 ms, session 10693 ms, action 0 ms
6) OVERVIEW-> HOMESCREEN
action:FLING direction=DOWN
Source child:TASK parent:TASKSWITCHER
Destination child:WORKSPACE id=0
Elapsed container 2108 ms, session 12801 ms, action 0 ms
7) APPS-> OVERVIEW
action:FLING direction=UP
Source child:NAVBAR parent:APP
Destination child:TASKSWITCHER
Elapsed container 104 ms, session 104 ms, action 0 ms
8) Quickscrub: action:DRAGANDDROP Source child: QUICK
9) Quickswitch: action:FLING Source child: QUICK
Change-Id: I5898230859ff600f48a2a873a40b670fe4d39a0d
2018-02-14 13:40:25 -08:00
|
|
|
logAction = Touch.SWIPE;
|
2018-01-12 14:17:30 -08:00
|
|
|
goingToEnd = mCurrentAnimation.getProgressFraction() > SUCCESS_TRANSITION_PROGRESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float progress = mCurrentAnimation.getProgressFraction();
|
|
|
|
|
long animationDuration = SwipeDetector.calculateDuration(
|
|
|
|
|
velocity, goingToEnd ? (1 - progress) : progress);
|
|
|
|
|
|
|
|
|
|
float nextFrameProgress = Utilities.boundToRange(
|
|
|
|
|
progress + velocity * SINGLE_FRAME_MS / Math.abs(mEndDisplacement), 0f, 1f);
|
|
|
|
|
|
Quick step/scrub/switch logging
- state transition happening due to Home and back is handled by
specifying src target as 'from' container and dst target as the 'to'
container
- Source and Destination container shows FROM and TO state for SWIPE/FLING
- event.isStateChange = true indicates that an action resulted in
state transition
- Elapsed container millis is the screen time on the source container
Bug: 70181187
- logcat printout with setprop log.tag.UserEvent VERBOSE
1) State: WORKSPACE -> ALLAPPS
action:FLING direction=UP
Source child:HOTSEAT id=0 parent:WORKSPACE id=0
Destination child:ALLAPPS
Elapsed container 1225 ms, session 1225 ms, action 0 ms
2) ALLAPPS -> HOMESCREEN
action:FLING direction=DOWN
Source child:ALLAPPS parent:ALLAPPS
Destination child:WORKSPACE id=0
Elapsed container 971 ms, session 2197 ms, action 0 ms
3) HOMESCREEN -> OVERVIEW
action:FLING direction=UP
Source child:NAVBAR parent:WORKSPACE id=0
Destination child:TASKSWITCHER
Elapsed container 4834 ms, session 4834 ms, action 0 ms
4) OVERVIEW-> ALLAPPS
action:FLING direction=UP
Source child:TASK parent:TASKSWITCHER
Destination child:ALLAPPS
Elapsed container 2176 ms, session 7010 ms, action 0 ms
5) ALLAPPS->OVERVIEW
action:FLING direction=DOWN
Source child:ALLAPPS parent:ALLAPPS
Destination child:TASKSWITCHER
Elapsed container 3683 ms, session 10693 ms, action 0 ms
6) OVERVIEW-> HOMESCREEN
action:FLING direction=DOWN
Source child:TASK parent:TASKSWITCHER
Destination child:WORKSPACE id=0
Elapsed container 2108 ms, session 12801 ms, action 0 ms
7) APPS-> OVERVIEW
action:FLING direction=UP
Source child:NAVBAR parent:APP
Destination child:TASKSWITCHER
Elapsed container 104 ms, session 104 ms, action 0 ms
8) Quickscrub: action:DRAGANDDROP Source child: QUICK
9) Quickswitch: action:FLING Source child: QUICK
Change-Id: I5898230859ff600f48a2a873a40b670fe4d39a0d
2018-02-14 13:40:25 -08:00
|
|
|
mCurrentAnimation.setEndAction(() -> onCurrentAnimationEnd(goingToEnd, logAction));
|
2018-01-12 14:17:30 -08:00
|
|
|
|
|
|
|
|
ValueAnimator anim = mCurrentAnimation.getAnimationPlayer();
|
|
|
|
|
anim.setFloatValues(nextFrameProgress, goingToEnd ? 1f : 0f);
|
|
|
|
|
anim.setDuration(animationDuration);
|
|
|
|
|
anim.setInterpolator(scrollInterpolatorForVelocity(velocity));
|
|
|
|
|
anim.start();
|
|
|
|
|
}
|
|
|
|
|
|
Quick step/scrub/switch logging
- state transition happening due to Home and back is handled by
specifying src target as 'from' container and dst target as the 'to'
container
- Source and Destination container shows FROM and TO state for SWIPE/FLING
- event.isStateChange = true indicates that an action resulted in
state transition
- Elapsed container millis is the screen time on the source container
Bug: 70181187
- logcat printout with setprop log.tag.UserEvent VERBOSE
1) State: WORKSPACE -> ALLAPPS
action:FLING direction=UP
Source child:HOTSEAT id=0 parent:WORKSPACE id=0
Destination child:ALLAPPS
Elapsed container 1225 ms, session 1225 ms, action 0 ms
2) ALLAPPS -> HOMESCREEN
action:FLING direction=DOWN
Source child:ALLAPPS parent:ALLAPPS
Destination child:WORKSPACE id=0
Elapsed container 971 ms, session 2197 ms, action 0 ms
3) HOMESCREEN -> OVERVIEW
action:FLING direction=UP
Source child:NAVBAR parent:WORKSPACE id=0
Destination child:TASKSWITCHER
Elapsed container 4834 ms, session 4834 ms, action 0 ms
4) OVERVIEW-> ALLAPPS
action:FLING direction=UP
Source child:TASK parent:TASKSWITCHER
Destination child:ALLAPPS
Elapsed container 2176 ms, session 7010 ms, action 0 ms
5) ALLAPPS->OVERVIEW
action:FLING direction=DOWN
Source child:ALLAPPS parent:ALLAPPS
Destination child:TASKSWITCHER
Elapsed container 3683 ms, session 10693 ms, action 0 ms
6) OVERVIEW-> HOMESCREEN
action:FLING direction=DOWN
Source child:TASK parent:TASKSWITCHER
Destination child:WORKSPACE id=0
Elapsed container 2108 ms, session 12801 ms, action 0 ms
7) APPS-> OVERVIEW
action:FLING direction=UP
Source child:NAVBAR parent:APP
Destination child:TASKSWITCHER
Elapsed container 104 ms, session 104 ms, action 0 ms
8) Quickscrub: action:DRAGANDDROP Source child: QUICK
9) Quickswitch: action:FLING Source child: QUICK
Change-Id: I5898230859ff600f48a2a873a40b670fe4d39a0d
2018-02-14 13:40:25 -08:00
|
|
|
private void onCurrentAnimationEnd(boolean wasSuccess, int logAction) {
|
2018-03-13 16:44:00 -07:00
|
|
|
if (mPendingAnimation != null) {
|
|
|
|
|
mPendingAnimation.finish(wasSuccess);
|
|
|
|
|
mPendingAnimation = null;
|
|
|
|
|
}
|
2018-03-14 17:51:49 -07:00
|
|
|
if (wasSuccess) {
|
2018-03-13 16:44:00 -07:00
|
|
|
if (!mCurrentAnimationIsGoingUp) {
|
2018-01-12 14:17:30 -08:00
|
|
|
mTaskBeingDragged.launchTask(false);
|
Quick step/scrub/switch logging
- state transition happening due to Home and back is handled by
specifying src target as 'from' container and dst target as the 'to'
container
- Source and Destination container shows FROM and TO state for SWIPE/FLING
- event.isStateChange = true indicates that an action resulted in
state transition
- Elapsed container millis is the screen time on the source container
Bug: 70181187
- logcat printout with setprop log.tag.UserEvent VERBOSE
1) State: WORKSPACE -> ALLAPPS
action:FLING direction=UP
Source child:HOTSEAT id=0 parent:WORKSPACE id=0
Destination child:ALLAPPS
Elapsed container 1225 ms, session 1225 ms, action 0 ms
2) ALLAPPS -> HOMESCREEN
action:FLING direction=DOWN
Source child:ALLAPPS parent:ALLAPPS
Destination child:WORKSPACE id=0
Elapsed container 971 ms, session 2197 ms, action 0 ms
3) HOMESCREEN -> OVERVIEW
action:FLING direction=UP
Source child:NAVBAR parent:WORKSPACE id=0
Destination child:TASKSWITCHER
Elapsed container 4834 ms, session 4834 ms, action 0 ms
4) OVERVIEW-> ALLAPPS
action:FLING direction=UP
Source child:TASK parent:TASKSWITCHER
Destination child:ALLAPPS
Elapsed container 2176 ms, session 7010 ms, action 0 ms
5) ALLAPPS->OVERVIEW
action:FLING direction=DOWN
Source child:ALLAPPS parent:ALLAPPS
Destination child:TASKSWITCHER
Elapsed container 3683 ms, session 10693 ms, action 0 ms
6) OVERVIEW-> HOMESCREEN
action:FLING direction=DOWN
Source child:TASK parent:TASKSWITCHER
Destination child:WORKSPACE id=0
Elapsed container 2108 ms, session 12801 ms, action 0 ms
7) APPS-> OVERVIEW
action:FLING direction=UP
Source child:NAVBAR parent:APP
Destination child:TASKSWITCHER
Elapsed container 104 ms, session 104 ms, action 0 ms
8) Quickscrub: action:DRAGANDDROP Source child: QUICK
9) Quickswitch: action:FLING Source child: QUICK
Change-Id: I5898230859ff600f48a2a873a40b670fe4d39a0d
2018-02-14 13:40:25 -08:00
|
|
|
mLauncher.getUserEventDispatcher().logTaskLaunch(logAction,
|
|
|
|
|
Direction.DOWN, mTaskBeingDragged.getTask().getTopComponent());
|
2018-01-12 14:17:30 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
mDetector.finishedScrolling();
|
|
|
|
|
mTaskBeingDragged = null;
|
|
|
|
|
mCurrentAnimation = null;
|
|
|
|
|
}
|
|
|
|
|
}
|