Merge "Fixing Robolectic tests" into ub-launcher3-master
diff --git a/go/quickstep/src/com/android/launcher3/uioverrides/LandscapeStatesTouchController.java b/go/quickstep/src/com/android/launcher3/uioverrides/LandscapeStatesTouchController.java
new file mode 100644
index 0000000..2c91bc3
--- /dev/null
+++ b/go/quickstep/src/com/android/launcher3/uioverrides/LandscapeStatesTouchController.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2019 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;
+
+import static com.android.launcher3.LauncherState.ALL_APPS;
+import static com.android.launcher3.LauncherState.NORMAL;
+
+import android.view.MotionEvent;
+
+import com.android.launcher3.AbstractFloatingView;
+import com.android.launcher3.Launcher;
+import com.android.launcher3.LauncherState;
+import com.android.launcher3.userevent.nano.LauncherLogProto;
+
+/**
+ * Touch controller for landscape mode.
+ */
+public final class LandscapeStatesTouchController extends PortraitStatesTouchController {
+
+ public LandscapeStatesTouchController(Launcher l) {
+ super(l, true /* allowDragToOverview */);
+ }
+
+ @Override
+ protected boolean canInterceptTouch(MotionEvent ev) {
+ if (mCurrentAnimation != null) {
+ // If we are already animating from a previous state, we can intercept.
+ return true;
+ }
+ if (AbstractFloatingView.getTopOpenView(mLauncher) != null) {
+ return false;
+ }
+ if (mLauncher.isInState(ALL_APPS)) {
+ // In all-apps only listen if the container cannot scroll itself
+ return mLauncher.getAppsView().shouldContainerScroll(ev);
+ } else if (mLauncher.isInState(NORMAL)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ protected LauncherState getTargetState(LauncherState fromState, boolean isDragTowardPositive) {
+ if (fromState == ALL_APPS && !isDragTowardPositive) {
+ return NORMAL;
+ } else if (isDragTowardPositive) {
+ return ALL_APPS;
+ }
+ return fromState;
+ }
+
+ @Override
+ protected int getLogContainerTypeForNormalState() {
+ return LauncherLogProto.ContainerType.WORKSPACE;
+ }
+}
diff --git a/go/quickstep/src/com/android/launcher3/uioverrides/RecentsUiFactory.java b/go/quickstep/src/com/android/launcher3/uioverrides/RecentsUiFactory.java
index 7381574..12f5360 100644
--- a/go/quickstep/src/com/android/launcher3/uioverrides/RecentsUiFactory.java
+++ b/go/quickstep/src/com/android/launcher3/uioverrides/RecentsUiFactory.java
@@ -44,7 +44,7 @@
list.add(launcher.getDragController());
if (launcher.getDeviceProfile().isVerticalBarLayout()) {
- list.add(new OverviewToAllAppsTouchController(launcher));
+ list.add(new LandscapeStatesTouchController(launcher));
list.add(new LandscapeEdgeSwipeController(launcher));
} else {
boolean allowDragToOverview = OverviewInteractionState.INSTANCE.get(launcher)
diff --git a/quickstep/src/com/android/launcher3/uioverrides/OverviewToAllAppsTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/OverviewToAllAppsTouchController.java
similarity index 100%
rename from quickstep/src/com/android/launcher3/uioverrides/OverviewToAllAppsTouchController.java
rename to quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/OverviewToAllAppsTouchController.java
diff --git a/quickstep/res/values/strings.xml b/quickstep/res/values/strings.xml
index 0c741a1..f5e8fa8 100644
--- a/quickstep/res/values/strings.xml
+++ b/quickstep/res/values/strings.xml
@@ -52,7 +52,7 @@
<string name="task_contents_description_with_remaining_time"><xliff:g id="task_description" example="GMail">%1$s</xliff:g>, <xliff:g id="remaining_time" example="7 minutes left today">%2$s</xliff:g></string>
<!-- Text to show total app usage per day if it is less than 1 minute ("<" is the
- escaped form of '<'). [CHAR LIMIT=10] -->
+ escaped form of '<'). [CHAR LIMIT=15] -->
<string name="shorter_duration_less_than_one_minute">< 1 minute</string>
<!-- Annotation shown on an app card in Recents, telling that the app was switched to a
@@ -60,6 +60,6 @@
<string name="app_in_grayscale">App in grayscale</string>
<!-- Annotation shown on an app card in Recents, telling that the app has a usage limit set by
- the user, and a given time is left for it today [CHAR LIMIT=20] -->
+ the user, and a given time is left for it today [CHAR LIMIT=22] -->
<string name="time_left_for_app"><xliff:g id="time" example="7 minutes">%1$s</xliff:g> left today</string>
</resources>
\ No newline at end of file
diff --git a/quickstep/src/com/android/quickstep/LongSwipeHelper.java b/quickstep/src/com/android/quickstep/LongSwipeHelper.java
index 80d37ae..88dc520 100644
--- a/quickstep/src/com/android/quickstep/LongSwipeHelper.java
+++ b/quickstep/src/com/android/quickstep/LongSwipeHelper.java
@@ -19,6 +19,7 @@
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.anim.Interpolators.DEACCEL;
+import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.launcher3.config.FeatureFlags.QUICKSTEP_SPRINGS;
import static com.android.quickstep.WindowTransformSwipeHandler.MAX_SWIPE_DURATION;
import static com.android.quickstep.WindowTransformSwipeHandler.MIN_OVERSHOOT_DURATION;
@@ -173,5 +174,9 @@
0);
callback.run();
+
+ if (ENABLE_QUICKSTEP_LIVE_TILE.get() && toAllApps) {
+ rv.finishRecentsAnimation(true, null);
+ }
}
}
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 5b84d23..20280c1 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -1585,7 +1585,7 @@
mClipAnimationHelper = clipAnimationHelper;
}
- public void finishRecentsAnimation(boolean toHome, Runnable onFinishComplete) {
+ public void finishRecentsAnimation(boolean toRecents, Runnable onFinishComplete) {
if (mRecentsAnimationWrapper == null) {
if (onFinishComplete != null) {
onFinishComplete.run();
@@ -1593,10 +1593,11 @@
return;
}
- mRecentsAnimationWrapper.finish(toHome, onFinishComplete);
+ mRecentsAnimationWrapper.finish(toRecents, onFinishComplete);
}
- public void takeScreenshotAndFinishRecentsAnimation(boolean toHome, Runnable onFinishComplete) {
+ public void takeScreenshotAndFinishRecentsAnimation(boolean toRecents,
+ Runnable onFinishComplete) {
if (mRecentsAnimationWrapper == null || getRunningTaskView() == null) {
if (onFinishComplete != null) {
onFinishComplete.run();
@@ -1631,7 +1632,7 @@
}
detach();
- mRecentsAnimationWrapper.finish(toHome, () -> {
+ mRecentsAnimationWrapper.finish(toRecents, () -> {
onFinishComplete.run();
mRunningTaskId = -1;
});
diff --git a/src/com/android/launcher3/anim/AnimatorPlaybackController.java b/src/com/android/launcher3/anim/AnimatorPlaybackController.java
index cf070c5..2c440bb 100644
--- a/src/com/android/launcher3/anim/AnimatorPlaybackController.java
+++ b/src/com/android/launcher3/anim/AnimatorPlaybackController.java
@@ -236,7 +236,7 @@
private void dispatchOnStartRecursively(Animator animator) {
List<AnimatorListener> listeners = animator instanceof SpringObjectAnimator
- ? nonNullList(((SpringObjectAnimator) animator).getSuperListeners())
+ ? nonNullList(((SpringObjectAnimator) animator).getObjectAnimatorListeners())
: nonNullList(animator.getListeners());
for (AnimatorListener l : listeners) {
diff --git a/src/com/android/launcher3/anim/SpringObjectAnimator.java b/src/com/android/launcher3/anim/SpringObjectAnimator.java
index 4f45c05..cc70e32 100644
--- a/src/com/android/launcher3/anim/SpringObjectAnimator.java
+++ b/src/com/android/launcher3/anim/SpringObjectAnimator.java
@@ -85,7 +85,7 @@
// We use this listener and track mListeners so that we can sync the animator and spring
// listeners.
- super.addListener(new AnimatorListenerAdapter() {
+ mObjectAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
mAnimatorEnded = false;
@@ -157,8 +157,8 @@
mListeners.add(listener);
}
- public ArrayList<AnimatorListener> getSuperListeners() {
- return super.getListeners();
+ public ArrayList<AnimatorListener> getObjectAnimatorListeners() {
+ return mObjectAnimator.getListeners();
}
@Override