summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-01-12 02:26:12 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-01-12 02:26:12 +0000
commitc0929b1252d8b0faa2cdaaa4d015e1d575d1d632 (patch)
treefbb5c6be7affbddb9d2a99d5a2da06beae1b4574
parentc1a25289719fefb9211156636a076b2017882ba2 (diff)
parent41f333df84aca311566e8b5b190cfdce955fd2b6 (diff)
downloadLauncher3-android12-mainline-extservices-release.tar.gz
Snap for 8069721 from 41f333df84aca311566e8b5b190cfdce955fd2b6 to mainline-extservices-releaseandroid-mainline-12.0.0_r87android-mainline-12.0.0_r72android12-mainline-extservices-release
Change-Id: I7d433e3258df1acea006779f8dd0aeefa188d47f
-rw-r--r--quickstep/AndroidManifest.xml1
-rw-r--r--quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java21
-rw-r--r--quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java9
-rw-r--r--quickstep/src/com/android/quickstep/BaseActivityInterface.java16
-rw-r--r--quickstep/src/com/android/quickstep/GestureState.java4
-rw-r--r--quickstep/src/com/android/quickstep/TaskAnimationManager.java7
-rw-r--r--quickstep/tests/src/com/android/quickstep/AbstractQuickStepTest.java2
7 files changed, 42 insertions, 18 deletions
diff --git a/quickstep/AndroidManifest.xml b/quickstep/AndroidManifest.xml
index b43d8d1a4b..f82080feea 100644
--- a/quickstep/AndroidManifest.xml
+++ b/quickstep/AndroidManifest.xml
@@ -40,6 +40,7 @@
<uses-permission android:name="android.permission.READ_FRAME_BUFFER"/>
<uses-permission android:name="android.permission.MANAGE_ACCESSIBILITY"/>
<uses-permission android:name="android.permission.MONITOR_INPUT"/>
+ <uses-permission android:name="android.permission.ALLOW_SLIPPERY_TOUCHES"/>
<uses-permission android:name="${packageName}.permission.HOTSEAT_EDU" />
<uses-permission android:name="android.permission.SYSTEM_APPLICATION_OVERLAY" />
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java
index fe69c9b87d..1bc789bd6e 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java
@@ -19,6 +19,7 @@ import static android.view.MotionEvent.ACTION_CANCEL;
import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_MOVE;
import static android.view.MotionEvent.ACTION_UP;
+import static android.view.WindowManager.LayoutParams.FLAG_SLIPPERY;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPE_DOWN_WORKSPACE_NOTISHADE_OPEN;
@@ -47,17 +48,6 @@ public class StatusBarTouchController implements TouchController {
private static final String TAG = "StatusBarController";
- /**
- * Window flag: Enable touches to slide out of a window into neighboring
- * windows in mid-gesture instead of being captured for the duration of
- * the gesture.
- *
- * This flag changes the behavior of touch focus for this window only.
- * Touches can slide out of the window but they cannot necessarily slide
- * back in (unless the other window with touch focus permits it).
- */
- private static final int FLAG_SLIPPERY = 0x20000000;
-
private final Launcher mLauncher;
private final SystemUiProxy mSystemUiProxy;
private final float mTouchSlop;
@@ -140,6 +130,15 @@ public class StatusBarTouchController implements TouchController {
return true;
}
+ /**
+ * FLAG_SLIPPERY enables touches to slide out of a window into neighboring
+ * windows in mid-gesture instead of being captured for the duration of
+ * the gesture.
+ *
+ * This flag changes the behavior of touch focus for this window only.
+ * Touches can slide out of the window but they cannot necessarily slide
+ * back in (unless the other window with touch focus permits it).
+ */
private void setWindowSlippery(boolean enable) {
Window w = mLauncher.getWindow();
WindowManager.LayoutParams wlp = w.getAttributes();
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index ac1772c300..97481233be 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -428,6 +428,10 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
mAnimationFactory = mActivityInterface.prepareRecentsUI(mDeviceState,
mWasLauncherAlreadyVisible, this::onAnimatorPlaybackControllerCreated);
maybeUpdateRecentsAttachedState(false /* animate */);
+ if (mGestureState.getEndTarget() != null) {
+ // Update the end target in case the gesture ended before we init.
+ mAnimationFactory.setEndTarget(mGestureState.getEndTarget());
+ }
};
if (mWasLauncherAlreadyVisible) {
// Launcher is visible, but might be about to stop. Thus, if we prepare recents
@@ -976,6 +980,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
isFling, isCancel);
// Set the state, but don't notify until the animation completes
mGestureState.setEndTarget(endTarget, false /* isAtomic */);
+ mAnimationFactory.setEndTarget(endTarget);
float endShift = endTarget.isLauncher ? 1 : 0;
final float startShift;
@@ -1360,7 +1365,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
mActivity.clearRunOnceOnStartCallback();
resetLauncherListeners();
}
- if (mGestureState.getEndTarget() != null && !mGestureState.isRunningAnimationToLauncher()) {
+ if (mGestureState.isRecentsAnimationRunning() && mGestureState.getEndTarget() != null
+ && !mGestureState.getEndTarget().isLauncher) {
+ // Continued quick switch.
cancelCurrentAnimation();
} else {
mStateCallback.setStateOnUiThread(STATE_FINISH_WITH_NO_END);
diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
index fac4d52826..923a959986 100644
--- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
@@ -77,12 +77,14 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
public final boolean rotationSupportedByActivity;
- private final STATE_TYPE mOverviewState, mBackgroundState;
+ private final STATE_TYPE mBackgroundState;
+
+ private STATE_TYPE mTargetState;
protected BaseActivityInterface(boolean rotationSupportedByActivity,
STATE_TYPE overviewState, STATE_TYPE backgroundState) {
this.rotationSupportedByActivity = rotationSupportedByActivity;
- mOverviewState = overviewState;
+ mTargetState = overviewState;
mBackgroundState = backgroundState;
}
@@ -399,6 +401,9 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
default boolean isRecentsAttachedToAppWindow() {
return false;
}
+
+ /** Called when the gesture ends and we know what state it is going towards */
+ default void setEndTarget(GestureState.GestureEndTarget endTarget) { }
}
class DefaultAnimationFactory implements AnimationFactory {
@@ -435,7 +440,7 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
// Since we are changing the start position of the UI, reapply the state, at the end
controller.setEndAction(() -> mActivity.getStateManager().goToState(
- controller.getInterpolatedProgress() > 0.5 ? mOverviewState : mBackgroundState,
+ controller.getInterpolatedProgress() > 0.5 ? mTargetState : mBackgroundState,
false));
RecentsView recentsView = mActivity.getOverviewPanel();
@@ -490,6 +495,11 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
return mIsAttachedToWindow;
}
+ @Override
+ public void setEndTarget(GestureState.GestureEndTarget endTarget) {
+ mTargetState = stateFromGestureEndTarget(endTarget);
+ }
+
protected void createBackgroundToOverviewAnim(ACTIVITY_TYPE activity, PendingAnimation pa) {
// Scale down recents from being full screen to being in overview.
RecentsView recentsView = activity.getOverviewPanel();
diff --git a/quickstep/src/com/android/quickstep/GestureState.java b/quickstep/src/com/android/quickstep/GestureState.java
index e3ae36182e..aabba66386 100644
--- a/quickstep/src/com/android/quickstep/GestureState.java
+++ b/quickstep/src/com/android/quickstep/GestureState.java
@@ -346,8 +346,8 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
* @return whether the recents animation is started but not yet ended
*/
public boolean isRecentsAnimationRunning() {
- return mStateCallback.hasStates(STATE_RECENTS_ANIMATION_INITIALIZED) &&
- !mStateCallback.hasStates(STATE_RECENTS_ANIMATION_ENDED);
+ return mStateCallback.hasStates(STATE_RECENTS_ANIMATION_STARTED)
+ && !mStateCallback.hasStates(STATE_RECENTS_ANIMATION_ENDED);
}
@Override
diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
index 67bd85fffe..d7af074954 100644
--- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java
+++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
@@ -106,6 +106,13 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
// But force-finish it anyways
finishRunningRecentsAnimation(false /* toHome */);
+ if (mCallbacks != null) {
+ // If mCallbacks still != null, that means we are getting this startRecentsAnimation()
+ // before the previous one got onRecentsAnimationStart(). In that case, cleanup the
+ // previous animation so it doesn't mess up/listen to state changes in this animation.
+ cleanUpRecentsAnimation();
+ }
+
final BaseActivityInterface activityInterface = gestureState.getActivityInterface();
mLastGestureState = gestureState;
mCallbacks = new RecentsAnimationCallbacks(activityInterface.allowMinimizeSplitScreen());
diff --git a/quickstep/tests/src/com/android/quickstep/AbstractQuickStepTest.java b/quickstep/tests/src/com/android/quickstep/AbstractQuickStepTest.java
index dc73a9a51c..7c463a7b46 100644
--- a/quickstep/tests/src/com/android/quickstep/AbstractQuickStepTest.java
+++ b/quickstep/tests/src/com/android/quickstep/AbstractQuickStepTest.java
@@ -44,7 +44,7 @@ public abstract class AbstractQuickStepTest extends AbstractLauncherUiTest {
protected void onLauncherActivityClose(Launcher launcher) {
RecentsView recentsView = launcher.getOverviewPanel();
if (recentsView != null) {
- recentsView.finishRecentsAnimation(true, null);
+ recentsView.finishRecentsAnimation(false /* toRecents */, null);
}
}