Loading packages/SystemUI/src/com/android/systemui/pip/phone/PipResizeGestureHandler.java +19 −14 Original line number Diff line number Diff line Loading @@ -260,12 +260,14 @@ public class PipResizeGestureHandler { private void onMotionEvent(MotionEvent ev) { int action = ev.getActionMasked(); float x = ev.getX(); float y = ev.getY(); if (action == MotionEvent.ACTION_DOWN) { mLastResizeBounds.setEmpty(); mAllowGesture = isWithinTouchRegion((int) ev.getX(), (int) ev.getY()); mAllowGesture = isWithinTouchRegion((int) x, (int) y); if (mAllowGesture) { setCtrlType((int) ev.getX(), (int) ev.getY()); mDownPoint.set(ev.getX(), ev.getY()); setCtrlType((int) x, (int) y); mDownPoint.set(x, y); mLastDownBounds.set(mMotionHelper.getBounds()); } Loading @@ -277,20 +279,23 @@ public class PipResizeGestureHandler { break; case MotionEvent.ACTION_MOVE: // Capture inputs float dx = Math.abs(ev.getX() - mDownPoint.x); float dy = Math.abs(ev.getY() - mDownPoint.y); if (!mThresholdCrossed && dx > mTouchSlop && dy > mTouchSlop) { if (!mThresholdCrossed && Math.hypot(x - mDownPoint.x, y - mDownPoint.y) > mTouchSlop) { mThresholdCrossed = true; // Reset the down to begin resizing from this point mDownPoint.set(x, y); mInputMonitor.pilferPointers(); } if (mThresholdCrossed) { final Rect currentPipBounds = mMotionHelper.getBounds(); mLastResizeBounds.set(TaskResizingAlgorithm.resizeDrag(ev.getX(), ev.getY(), mLastResizeBounds.set(TaskResizingAlgorithm.resizeDrag(x, y, mDownPoint.x, mDownPoint.y, currentPipBounds, mCtrlType, mMinSize.x, mMinSize.y, mMaxSize, true, mLastDownBounds.width() > mLastDownBounds.height())); mPipBoundsHandler.transformBoundsToAspectRatio(mLastResizeBounds); mPipTaskOrganizer.scheduleUserResizePip(mLastDownBounds, mLastResizeBounds, null); } break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: Loading packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +5 −2 Original line number Diff line number Diff line Loading @@ -200,11 +200,13 @@ public class OverviewProxyService extends CurrentUserTracker implements mInputFocusTransferStartY = event.getY(); mInputFocusTransferStartMillis = event.getEventTime(); statusBar.onInputFocusTransfer( mInputFocusTransferStarted, 0 /* velocity */); mInputFocusTransferStarted, false /* cancel */, 0 /* velocity */); } if (action == ACTION_UP || action == ACTION_CANCEL) { mInputFocusTransferStarted = false; statusBar.onInputFocusTransfer(mInputFocusTransferStarted, action == ACTION_CANCEL, (event.getY() - mInputFocusTransferStartY) / (event.getEventTime() - mInputFocusTransferStartMillis)); } Loading Loading @@ -692,7 +694,8 @@ public class OverviewProxyService extends CurrentUserTracker implements mHandler.post(()-> { mStatusBarOptionalLazy.ifPresent(statusBarLazy -> { mInputFocusTransferStarted = false; statusBarLazy.get().onInputFocusTransfer(false, 0 /* velocity */); statusBarLazy.get().onInputFocusTransfer(false, true /* cancel */, 0 /* velocity */); }); }); } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +7 −3 Original line number Diff line number Diff line Loading @@ -1328,11 +1328,15 @@ public class NotificationPanelViewController extends PanelViewController { * * @param velocity unit is in px / millis */ public void stopWaitingForOpenPanelGesture(final float velocity) { public void stopWaitingForOpenPanelGesture(boolean cancel, final float velocity) { if (mExpectingSynthesizedDown) { mExpectingSynthesizedDown = false; if (cancel) { collapse(false /* delayed */, 1.0f /* speedUpFactor */); } else { maybeVibrateOnOpening(); fling(velocity > 1f ? 1000f * velocity : 0, true /* expand */); } onTrackingStopped(false); } } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +2 −2 Original line number Diff line number Diff line Loading @@ -2093,7 +2093,7 @@ public class StatusBar extends SystemUI implements DemoMode, /** * Called when another window is about to transfer it's input focus. */ public void onInputFocusTransfer(boolean start, float velocity) { public void onInputFocusTransfer(boolean start, boolean cancel, float velocity) { if (!mCommandQueue.panelsEnabled()) { return; } Loading @@ -2101,7 +2101,7 @@ public class StatusBar extends SystemUI implements DemoMode, if (start) { mNotificationPanelViewController.startWaitingForOpenPanelGesture(); } else { mNotificationPanelViewController.stopWaitingForOpenPanelGesture(velocity); mNotificationPanelViewController.stopWaitingForOpenPanelGesture(cancel, velocity); } } Loading Loading
packages/SystemUI/src/com/android/systemui/pip/phone/PipResizeGestureHandler.java +19 −14 Original line number Diff line number Diff line Loading @@ -260,12 +260,14 @@ public class PipResizeGestureHandler { private void onMotionEvent(MotionEvent ev) { int action = ev.getActionMasked(); float x = ev.getX(); float y = ev.getY(); if (action == MotionEvent.ACTION_DOWN) { mLastResizeBounds.setEmpty(); mAllowGesture = isWithinTouchRegion((int) ev.getX(), (int) ev.getY()); mAllowGesture = isWithinTouchRegion((int) x, (int) y); if (mAllowGesture) { setCtrlType((int) ev.getX(), (int) ev.getY()); mDownPoint.set(ev.getX(), ev.getY()); setCtrlType((int) x, (int) y); mDownPoint.set(x, y); mLastDownBounds.set(mMotionHelper.getBounds()); } Loading @@ -277,20 +279,23 @@ public class PipResizeGestureHandler { break; case MotionEvent.ACTION_MOVE: // Capture inputs float dx = Math.abs(ev.getX() - mDownPoint.x); float dy = Math.abs(ev.getY() - mDownPoint.y); if (!mThresholdCrossed && dx > mTouchSlop && dy > mTouchSlop) { if (!mThresholdCrossed && Math.hypot(x - mDownPoint.x, y - mDownPoint.y) > mTouchSlop) { mThresholdCrossed = true; // Reset the down to begin resizing from this point mDownPoint.set(x, y); mInputMonitor.pilferPointers(); } if (mThresholdCrossed) { final Rect currentPipBounds = mMotionHelper.getBounds(); mLastResizeBounds.set(TaskResizingAlgorithm.resizeDrag(ev.getX(), ev.getY(), mLastResizeBounds.set(TaskResizingAlgorithm.resizeDrag(x, y, mDownPoint.x, mDownPoint.y, currentPipBounds, mCtrlType, mMinSize.x, mMinSize.y, mMaxSize, true, mLastDownBounds.width() > mLastDownBounds.height())); mPipBoundsHandler.transformBoundsToAspectRatio(mLastResizeBounds); mPipTaskOrganizer.scheduleUserResizePip(mLastDownBounds, mLastResizeBounds, null); } break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: Loading
packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +5 −2 Original line number Diff line number Diff line Loading @@ -200,11 +200,13 @@ public class OverviewProxyService extends CurrentUserTracker implements mInputFocusTransferStartY = event.getY(); mInputFocusTransferStartMillis = event.getEventTime(); statusBar.onInputFocusTransfer( mInputFocusTransferStarted, 0 /* velocity */); mInputFocusTransferStarted, false /* cancel */, 0 /* velocity */); } if (action == ACTION_UP || action == ACTION_CANCEL) { mInputFocusTransferStarted = false; statusBar.onInputFocusTransfer(mInputFocusTransferStarted, action == ACTION_CANCEL, (event.getY() - mInputFocusTransferStartY) / (event.getEventTime() - mInputFocusTransferStartMillis)); } Loading Loading @@ -692,7 +694,8 @@ public class OverviewProxyService extends CurrentUserTracker implements mHandler.post(()-> { mStatusBarOptionalLazy.ifPresent(statusBarLazy -> { mInputFocusTransferStarted = false; statusBarLazy.get().onInputFocusTransfer(false, 0 /* velocity */); statusBarLazy.get().onInputFocusTransfer(false, true /* cancel */, 0 /* velocity */); }); }); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +7 −3 Original line number Diff line number Diff line Loading @@ -1328,11 +1328,15 @@ public class NotificationPanelViewController extends PanelViewController { * * @param velocity unit is in px / millis */ public void stopWaitingForOpenPanelGesture(final float velocity) { public void stopWaitingForOpenPanelGesture(boolean cancel, final float velocity) { if (mExpectingSynthesizedDown) { mExpectingSynthesizedDown = false; if (cancel) { collapse(false /* delayed */, 1.0f /* speedUpFactor */); } else { maybeVibrateOnOpening(); fling(velocity > 1f ? 1000f * velocity : 0, true /* expand */); } onTrackingStopped(false); } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +2 −2 Original line number Diff line number Diff line Loading @@ -2093,7 +2093,7 @@ public class StatusBar extends SystemUI implements DemoMode, /** * Called when another window is about to transfer it's input focus. */ public void onInputFocusTransfer(boolean start, float velocity) { public void onInputFocusTransfer(boolean start, boolean cancel, float velocity) { if (!mCommandQueue.panelsEnabled()) { return; } Loading @@ -2101,7 +2101,7 @@ public class StatusBar extends SystemUI implements DemoMode, if (start) { mNotificationPanelViewController.startWaitingForOpenPanelGesture(); } else { mNotificationPanelViewController.stopWaitingForOpenPanelGesture(velocity); mNotificationPanelViewController.stopWaitingForOpenPanelGesture(cancel, velocity); } } Loading