Merge "Don't defer finish, only defer disableInputProxy" into ub-launcher3-rvc-dev

This commit is contained in:
TreeHugger Robot authored and Android (Google) Code Review committed 2020-05-30 00:41:06 +00:00
commit 8a3be8cb53
1 file changed
+12 -19
@@ -29,7 +29,6 @@ import android.view.KeyEvent;
import android.view.MotionEvent; import android.view.MotionEvent;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread; import androidx.annotation.UiThread;
import com.android.launcher3.util.Preconditions; import com.android.launcher3.util.Preconditions;
@@ -58,8 +57,7 @@ public class RecentsAnimationController {
private boolean mUseLauncherSysBarFlags = false; private boolean mUseLauncherSysBarFlags = false;
private boolean mSplitScreenMinimized = false; private boolean mSplitScreenMinimized = false;
private boolean mTouchInProgress; private boolean mTouchInProgress;
private boolean mFinishPending; private boolean mDisableInputProxyPending;
private @Nullable Runnable mFinishPendingCallback;
public RecentsAnimationController(RecentsAnimationControllerCompat controller, public RecentsAnimationController(RecentsAnimationControllerCompat controller,
boolean allowMinimizeSplitScreen, boolean allowMinimizeSplitScreen,
@@ -138,12 +136,12 @@ public class RecentsAnimationController {
@UiThread @UiThread
public void finishAnimationToHome() { public void finishAnimationToHome() {
finishAndClear(true /* toRecents */, null, false /* sendUserLeaveHint */); finishAndDisableInputProxy(true /* toRecents */, null, false /* sendUserLeaveHint */);
} }
@UiThread @UiThread
public void finishAnimationToApp() { public void finishAnimationToApp() {
finishAndClear(false /* toRecents */, null, false /* sendUserLeaveHint */); finishAndDisableInputProxy(false /* toRecents */, null, false /* sendUserLeaveHint */);
} }
/** See {@link #finish(boolean, Runnable, boolean)} */ /** See {@link #finish(boolean, Runnable, boolean)} */
@@ -162,19 +160,16 @@ public class RecentsAnimationController {
@UiThread @UiThread
public void finish(boolean toRecents, Runnable onFinishComplete, boolean sendUserLeaveHint) { public void finish(boolean toRecents, Runnable onFinishComplete, boolean sendUserLeaveHint) {
Preconditions.assertUIThread(); Preconditions.assertUIThread();
if (!toRecents) { if (toRecents && mTouchInProgress) {
finishAndClear(false, onFinishComplete, sendUserLeaveHint); // Finish the controller as requested, but don't disable input proxy yet.
mDisableInputProxyPending = true;
finishController(toRecents, onFinishComplete, sendUserLeaveHint);
} else { } else {
if (mTouchInProgress) { finishAndDisableInputProxy(toRecents, onFinishComplete, sendUserLeaveHint);
mFinishPending = true;
mFinishPendingCallback = onFinishComplete;
} else {
finishAndClear(true, onFinishComplete, sendUserLeaveHint);
}
} }
} }
private void finishAndClear(boolean toRecents, Runnable onFinishComplete, private void finishAndDisableInputProxy(boolean toRecents, Runnable onFinishComplete,
boolean sendUserLeaveHint) { boolean sendUserLeaveHint) {
disableInputProxy(); disableInputProxy();
finishController(toRecents, onFinishComplete, sendUserLeaveHint); finishController(toRecents, onFinishComplete, sendUserLeaveHint);
@@ -262,11 +257,9 @@ public class RecentsAnimationController {
} else if (action == ACTION_CANCEL || action == ACTION_UP) { } else if (action == ACTION_CANCEL || action == ACTION_UP) {
// Finish any pending actions // Finish any pending actions
mTouchInProgress = false; mTouchInProgress = false;
if (mFinishPending) { if (mDisableInputProxyPending) {
mFinishPending = false; mDisableInputProxyPending = false;
finishAndClear(true /* toRecents */, mFinishPendingCallback, disableInputProxy();
false /* sendUserLeaveHint */);
mFinishPendingCallback = null;
} }
} }
if (mInputConsumer != null) { if (mInputConsumer != null) {