Don't allow scrolling RecentsView outside navbar during quickswitch
am: 80090d579f
Change-Id: Ib26bde87b9070a1a07e5bc12c11896e9d1bf4337
This commit is contained in:
@@ -19,6 +19,8 @@ import static android.view.MotionEvent.ACTION_CANCEL;
|
|||||||
import static android.view.MotionEvent.ACTION_DOWN;
|
import static android.view.MotionEvent.ACTION_DOWN;
|
||||||
import static android.view.MotionEvent.ACTION_UP;
|
import static android.view.MotionEvent.ACTION_UP;
|
||||||
|
|
||||||
|
import android.os.SystemClock;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.InputEvent;
|
import android.view.InputEvent;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
@@ -38,6 +40,8 @@ import java.util.function.Supplier;
|
|||||||
*/
|
*/
|
||||||
public class RecentsAnimationWrapper {
|
public class RecentsAnimationWrapper {
|
||||||
|
|
||||||
|
private static final String TAG = "RecentsAnimationWrapper";
|
||||||
|
|
||||||
// A list of callbacks to run when we receive the recents animation target. There are different
|
// A list of callbacks to run when we receive the recents animation target. There are different
|
||||||
// than the state callbacks as these run on the current worker thread.
|
// than the state callbacks as these run on the current worker thread.
|
||||||
private final ArrayList<Runnable> mCallbacks = new ArrayList<>();
|
private final ArrayList<Runnable> mCallbacks = new ArrayList<>();
|
||||||
@@ -125,6 +129,7 @@ public class RecentsAnimationWrapper {
|
|||||||
boolean sendUserLeaveHint) {
|
boolean sendUserLeaveHint) {
|
||||||
SwipeAnimationTargetSet controller = targetSet;
|
SwipeAnimationTargetSet controller = targetSet;
|
||||||
targetSet = null;
|
targetSet = null;
|
||||||
|
disableInputProxy();
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
controller.finishController(toRecents, onFinishComplete, sendUserLeaveHint);
|
controller.finishController(toRecents, onFinishComplete, sendUserLeaveHint);
|
||||||
}
|
}
|
||||||
@@ -153,6 +158,16 @@ public class RecentsAnimationWrapper {
|
|||||||
mInputConsumerController.setInputListener(this::onInputConsumerEvent);
|
mInputConsumerController.setInputListener(this::onInputConsumerEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void disableInputProxy() {
|
||||||
|
if (mInputConsumer != null && mTouchInProgress) {
|
||||||
|
long now = SystemClock.uptimeMillis();
|
||||||
|
MotionEvent dummyCancel = MotionEvent.obtain(now, now, ACTION_CANCEL, 0, 0, 0);
|
||||||
|
mInputConsumer.onMotionEvent(dummyCancel);
|
||||||
|
dummyCancel.recycle();
|
||||||
|
}
|
||||||
|
mInputConsumerController.setInputListener(null);
|
||||||
|
}
|
||||||
|
|
||||||
private boolean onInputConsumerEvent(InputEvent ev) {
|
private boolean onInputConsumerEvent(InputEvent ev) {
|
||||||
if (ev instanceof MotionEvent) {
|
if (ev instanceof MotionEvent) {
|
||||||
onInputConsumerMotionEvent((MotionEvent) ev);
|
onInputConsumerMotionEvent((MotionEvent) ev);
|
||||||
@@ -168,6 +183,18 @@ public class RecentsAnimationWrapper {
|
|||||||
|
|
||||||
private boolean onInputConsumerMotionEvent(MotionEvent ev) {
|
private boolean onInputConsumerMotionEvent(MotionEvent ev) {
|
||||||
int action = ev.getAction();
|
int action = ev.getAction();
|
||||||
|
|
||||||
|
// Just to be safe, verify that ACTION_DOWN comes before any other action,
|
||||||
|
// and ignore any ACTION_DOWN after the first one (though that should not happen).
|
||||||
|
if (!mTouchInProgress && action != ACTION_DOWN) {
|
||||||
|
Log.w(TAG, "Received non-down motion before down motion: " + action);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (mTouchInProgress && action == ACTION_DOWN) {
|
||||||
|
Log.w(TAG, "Received down motion while touch was already in progress");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (action == ACTION_DOWN) {
|
if (action == ACTION_DOWN) {
|
||||||
mTouchInProgress = true;
|
mTouchInProgress = true;
|
||||||
if (mInputConsumer == null) {
|
if (mInputConsumer == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user