Allow touches on launcher while animating to home

Previously we only proxied if the end target was recents (now we do it
for home as well) and only proxied to the controllers, not to all views.
We still only proxy to controllers for touches in the nav bar, but
otherwise we dispatch touches through normal view hierarchy.

Tests while animating home:
- Swipe down for notifications
- Swipe up for all apps
- Long press icon or wallpaper for shortcuts
- Tap a folder to open it
- Tap an icon to launch it (currently no animation plays, looking into
  it separately)

Bug: 131775822
Change-Id: I705b7a657b6d17bc0e24ed4fb44ecfb0f319e942
This commit is contained in:
Tony Wickham 2019-05-01 17:40:57 -07:00
parent a429fdbbe6
commit 1a468145ab
2 changed files with 16 additions and 5 deletions

View File

@ -22,13 +22,15 @@ import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SY
import android.view.KeyEvent;
import android.view.MotionEvent;
import androidx.annotation.Nullable;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.Utilities;
import com.android.launcher3.views.BaseDragLayer;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.InputMonitorCompat;
import androidx.annotation.Nullable;
import java.util.function.Predicate;
/**
* Input consumer for handling touch on the recents/Launcher activity.
@ -42,6 +44,7 @@ public class OverviewInputConsumer<T extends BaseDraggingActivity>
private final int[] mLocationOnScreen = new int[2];
private final boolean mProxyTouch;
private final Predicate<MotionEvent> mEventReceiver;
private final boolean mStartingInActivityBounds;
private boolean mTargetHandledTouch;
@ -53,10 +56,15 @@ public class OverviewInputConsumer<T extends BaseDraggingActivity>
mStartingInActivityBounds = startingInActivityBounds;
mTarget = activity.getDragLayer();
if (!startingInActivityBounds) {
if (startingInActivityBounds) {
mEventReceiver = mTarget::dispatchTouchEvent;
mProxyTouch = true;
} else {
// Only proxy touches to controllers if we are starting touch from nav bar.
mEventReceiver = mTarget::proxyTouchEvent;
mTarget.getLocationOnScreen(mLocationOnScreen);
mProxyTouch = mTarget.prepareProxyEventStarting();
}
mProxyTouch = mTarget.prepareProxyEventStarting();
}
@Override
@ -80,7 +88,7 @@ public class OverviewInputConsumer<T extends BaseDraggingActivity>
ev.setEdgeFlags(flags | Utilities.EDGE_NAV_BAR);
}
ev.offsetLocation(-mLocationOnScreen[0], -mLocationOnScreen[1]);
boolean handled = mTarget.proxyTouchEvent(ev);
boolean handled = mEventReceiver.test(ev);
ev.offsetLocation(mLocationOnScreen[0], mLocationOnScreen[1]);
ev.setEdgeFlags(flags);

View File

@ -906,12 +906,15 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
}
}
if (endTarget.isLauncher) {
mRecentsAnimationWrapper.enableInputProxy();
}
if (endTarget == HOME) {
setShelfState(ShelfAnimState.CANCEL, LINEAR, 0);
duration = Math.max(MIN_OVERSHOOT_DURATION, duration);
} else if (endTarget == RECENTS) {
mLiveTileOverlay.startIconAnimation();
mRecentsAnimationWrapper.enableInputProxy();
if (mRecentsView != null) {
duration = Math.max(duration, mRecentsView.getScroller().getDuration());
}