Merge "Caching widget labels in icon cache to avoid lookup at startup" into ub-launcher3-master
diff --git a/quickstep/libs/sysui_shared.jar b/quickstep/libs/sysui_shared.jar
index 17ff858..7ff664d 100644
--- a/quickstep/libs/sysui_shared.jar
+++ b/quickstep/libs/sysui_shared.jar
Binary files differ
diff --git a/quickstep/src/com/android/launcher3/uioverrides/StatusBarTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/StatusBarTouchController.java
index 4d56786..35f46cf 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/StatusBarTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/StatusBarTouchController.java
@@ -84,7 +84,8 @@
}
if (action == ACTION_MOVE) {
float dy = ev.getY() - mTranslator.getDownY();
- if (dy > mTouchSlop) {
+ float dx = ev.getX() - mTranslator.getDownX();
+ if (dy > mTouchSlop && dy > Math.abs(dx)) {
mTranslator.dispatchDownEvents(ev);
mTranslator.processMotionEvent(ev);
return true;
diff --git a/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java b/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java
index 8aaa40c..711ef58 100644
--- a/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java
+++ b/quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java
@@ -181,6 +181,8 @@
}
alpha = mTaskAlphaCallback.apply(app, alpha);
+ } else {
+ crop = null;
}
params[i] = new SurfaceParams(app.leash, alpha, mTmpMatrix, crop,
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index ee542d5..a0615f5 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -57,6 +57,7 @@
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.ActivityManagerWrapper;
+import com.android.systemui.shared.system.ActivityOptionsCompat;
import java.util.function.Consumer;
/**
@@ -204,11 +205,26 @@
if (animate) {
opts = ((BaseDraggingActivity) fromContext(getContext()))
.getActivityLaunchOptions(this);
+ ActivityManagerWrapper.getInstance().startActivityFromRecentsAsync(mTask.key,
+ opts, resultCallback, resultCallbackHandler);
} else {
- opts = ActivityOptions.makeCustomAnimation(getContext(), 0, 0);
+ opts = ActivityOptionsCompat.makeCustomAnimation(getContext(), 0, 0, () -> {
+ if (resultCallback != null) {
+ // Only post the animation start after the system has indicated that the
+ // transition has started
+ resultCallbackHandler.post(() -> resultCallback.accept(true));
+ }
+ }, resultCallbackHandler);
+ ActivityManagerWrapper.getInstance().startActivityFromRecentsAsync(mTask.key,
+ opts, (success) -> {
+ if (resultCallback != null && !success) {
+ // If the call to start activity failed, then post the result
+ // immediately, otherwise, wait for the animation start callback
+ // from the activity options above
+ resultCallbackHandler.post(() -> resultCallback.accept(false));
+ }
+ }, resultCallbackHandler);
}
- ActivityManagerWrapper.getInstance().startActivityFromRecentsAsync(mTask.key,
- opts, resultCallback, resultCallbackHandler);
}
}
diff --git a/src/com/android/launcher3/touch/TouchEventTranslator.java b/src/com/android/launcher3/touch/TouchEventTranslator.java
index 8a5c932..8333d32 100644
--- a/src/com/android/launcher3/touch/TouchEventTranslator.java
+++ b/src/com/android/launcher3/touch/TouchEventTranslator.java
@@ -19,7 +19,6 @@
import android.util.Log;
import android.util.Pair;
import android.util.SparseArray;
-import android.util.SparseLongArray;
import android.view.MotionEvent;
import android.view.MotionEvent.PointerCoords;
import android.view.MotionEvent.PointerProperties;
@@ -37,13 +36,15 @@
private class DownState {
long timeStamp;
+ float downX;
float downY;
- public DownState(long timeStamp, float downY) {
+ public DownState(long timeStamp, float downX, float downY) {
this.timeStamp = timeStamp;
+ this.downX = downX;
this.downY = downY;
}
};
- private final DownState ZERO = new DownState(0, 0f);
+ private final DownState ZERO = new DownState(0, 0f, 0f);
private final Consumer<MotionEvent> mListener;
@@ -65,12 +66,16 @@
mFingers.clear();
}
+ public float getDownX() {
+ return mDownEvents.get(0).downX;
+ }
+
public float getDownY() {
return mDownEvents.get(0).downY;
}
public void setDownParameters(int idx, MotionEvent e) {
- DownState ev = new DownState(e.getEventTime(), e.getY(idx));
+ DownState ev = new DownState(e.getEventTime(), e.getX(idx), e.getY(idx));
mDownEvents.append(idx, ev);
}
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index 75efea4..9cbab5e 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -17,6 +17,7 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
import android.app.Instrumentation;
import android.content.BroadcastReceiver;
@@ -74,7 +75,7 @@
public static final long DEFAULT_BROADCAST_TIMEOUT_SECS = 5;
public static final long SHORT_UI_TIMEOUT= 300;
- public static final long DEFAULT_UI_TIMEOUT = 3000;
+ public static final long DEFAULT_UI_TIMEOUT = 10000;
public static final long DEFAULT_WORKER_TIMEOUT_SECS = 5;
protected MainThreadExecutor mMainThreadExecutor = new MainThreadExecutor();
@@ -151,16 +152,20 @@
* @return the matching object.
*/
protected UiObject2 scrollAndFind(UiObject2 container, BySelector condition) {
- do {
+ container.setGestureMargins(0, 0, 0, 200);
+
+ int i = 0;
+ for (; ; ) {
// findObject can only execute after spring settles.
mDevice.wait(Until.findObject(condition), SHORT_UI_TIMEOUT);
UiObject2 widget = container.findObject(condition);
if (widget != null && widget.getVisibleBounds().intersects(
- 0, 0, mDevice.getDisplayWidth(), mDevice.getDisplayHeight())) {
+ 0, 0, mDevice.getDisplayWidth(), mDevice.getDisplayHeight() - 200)) {
return widget;
}
- } while (container.scroll(Direction.DOWN, 1f));
- return container.findObject(condition);
+ if (++i > 40) fail("Too many attempts");
+ container.scroll(Direction.DOWN, 1f);
+ }
}
/**