Merge "PIP: Add mouse hover/exit menu show support." into rvc-dev am: 2dfaaebfe9 am: b56ab53798

Change-Id: Id55d7b6d2c160f18a97ede0c6a128ccf9479675d
This commit is contained in:
Ben Lin
2020-03-19 18:49:25 +00:00
committed by Automerger Merge Worker
3 changed files with 15 additions and 10 deletions

View File

@@ -413,6 +413,8 @@ public class PipTouchHandler {
break; break;
} }
case MotionEvent.ACTION_HOVER_ENTER: case MotionEvent.ACTION_HOVER_ENTER:
mMenuController.showMenu(MENU_STATE_FULL, mMotionHelper.getBounds(),
mMovementBounds, false /* allowMenuTimeout */, false /* willResizeMenu */);
case MotionEvent.ACTION_HOVER_MOVE: { case MotionEvent.ACTION_HOVER_MOVE: {
if (!shouldDeliverToMenu && !mSendingHoverAccessibilityEvents) { if (!shouldDeliverToMenu && !mSendingHoverAccessibilityEvents) {
sendAccessibilityHoverEvent(AccessibilityEvent.TYPE_VIEW_HOVER_ENTER); sendAccessibilityHoverEvent(AccessibilityEvent.TYPE_VIEW_HOVER_ENTER);
@@ -421,6 +423,7 @@ public class PipTouchHandler {
break; break;
} }
case MotionEvent.ACTION_HOVER_EXIT: { case MotionEvent.ACTION_HOVER_EXIT: {
mMenuController.hideMenu();
if (!shouldDeliverToMenu && mSendingHoverAccessibilityEvents) { if (!shouldDeliverToMenu && mSendingHoverAccessibilityEvents) {
sendAccessibilityHoverEvent(AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); sendAccessibilityHoverEvent(AccessibilityEvent.TYPE_VIEW_HOVER_EXIT);
mSendingHoverAccessibilityEvents = false; mSendingHoverAccessibilityEvents = false;
@@ -538,9 +541,6 @@ public class PipTouchHandler {
mSavedSnapFraction = -1f; mSavedSnapFraction = -1f;
} }
} else { } else {
// If resizing is not allowed, then the PiP should be frozen until the transition
// ends as well
setTouchEnabled(false);
mSavedSnapFraction = -1f; mSavedSnapFraction = -1f;
} }
} }
@@ -714,6 +714,8 @@ public class PipTouchHandler {
} }
} else if (mTouchState.isDoubleTap()) { } else if (mTouchState.isDoubleTap()) {
// Expand to fullscreen if this is a double tap // Expand to fullscreen if this is a double tap
// the PiP should be frozen until the transition ends
setTouchEnabled(false);
mMotionHelper.expandPip(); mMotionHelper.expandPip();
} else if (mMenuState != MENU_STATE_FULL) { } else if (mMenuState != MENU_STATE_FULL) {
if (!mTouchState.isWaitingForDoubleTap()) { if (!mTouchState.isWaitingForDoubleTap()) {

View File

@@ -149,6 +149,10 @@ class InputConsumerImpl implements IBinder.DeathRecipient {
t.setLayer(mInputSurface, layer); t.setLayer(mInputSurface, layer);
} }
void reparent(SurfaceControl.Transaction t, WindowContainer wc) {
t.reparent(mInputSurface, wc.getSurfaceControl());
}
void disposeChannelsLw() { void disposeChannelsLw() {
mService.mInputManager.unregisterInputChannel(mServerChannel); mService.mInputManager.unregisterInputChannel(mServerChannel);
mClientChannel.dispose(); mClientChannel.dispose();

View File

@@ -511,14 +511,13 @@ final class InputMonitor {
if (w.inPinnedWindowingMode()) { if (w.inPinnedWindowingMode()) {
if (mAddPipInputConsumerHandle) { if (mAddPipInputConsumerHandle) {
// Update the bounds of the Pip input consumer to match the window bounds.
w.getBounds(mTmpRect);
mPipInputConsumer.layout(mInputTransaction, mTmpRect);
// The touchable region is relative to the surface top-left final Task rootTask = w.getTask().getRootTask();
mTmpRect.offsetTo(0, 0); mPipInputConsumer.mWindowHandle.replaceTouchableRegionWithCrop(
mPipInputConsumer.mWindowHandle.touchableRegion.set(mTmpRect); rootTask.getSurfaceControl());
mPipInputConsumer.show(mInputTransaction, w); // We set the layer to z=MAX-1 so that it's always on top.
mPipInputConsumer.reparent(mInputTransaction, rootTask);
mPipInputConsumer.show(mInputTransaction, Integer.MAX_VALUE - 1);
mAddPipInputConsumerHandle = false; mAddPipInputConsumerHandle = false;
} }
} }