Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +26 −29 Original line number Diff line number Diff line Loading @@ -1119,12 +1119,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi } private void sendScreenshotToBubble(Bubble bubble) { // delay allows the bubble menu to disappear before the screenshot // done here because we already have a Handler to delay with. // TODO: Hide bubble + menu UI from screenshots entirely instead of just delaying. mHandler.postDelayed(new Runnable() { @Override public void run() { mScreenshotHelper.takeScreenshot( android.view.WindowManager.TAKE_SCREENSHOT_FULLSCREEN, true /* hasStatus */, Loading @@ -1137,6 +1131,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi NotificationEntry entry = bubble.getEntry(); Pair<RemoteInput, Notification.Action> pair = entry.getSbn() .getNotification().findRemoteInputActionPair(false); if (pair != null) { RemoteInput remoteInput = pair.first; Notification.Action action = pair.second; Intent dataIntent = prepareRemoteInputFromData("image/png", uri, Loading @@ -1144,11 +1139,13 @@ public class BubbleController implements ConfigurationController.ConfigurationLi sendRemoteInput(dataIntent, entry, action.actionIntent); mBubbleData.setSelectedBubble(bubble); mBubbleData.setExpanded(true); } else { Log.w(TAG, "No RemoteInput found for notification: " + entry.getSbn().getKey()); } } }); } }, 200); }); } private final BubbleScreenshotListener mBubbleScreenshotListener = Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleMenuView.java +3 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,9 @@ public class BubbleMenuView extends FrameLayout { private FrameLayout mMenu; private boolean mShowing = false; /** Delay before taking a screenshot once the button is tapped to allow the menu time to hide.*/ public static final long SCREENSHOT_DELAY = 200; public BubbleMenuView(Context context, AttributeSet attrs) { super(context, attrs); } Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +18 −11 Original line number Diff line number Diff line Loading @@ -1731,17 +1731,18 @@ public class BubbleStackView extends FrameLayout { */ public void showBubbleMenu() { PointF currentPos = mStackAnimationController.getStackPosition(); mBubbleMenuView.setVisibility(View.INVISIBLE); post(() -> { float yPos = currentPos.y; float xPos = currentPos.x; if (mStackAnimationController.isStackOnLeftSide()) { xPos += mBubbleSize; } else { //TODO: Use the width of the menu instead of this fixed offset. Offset used for now // because menu width isn't correct the first time the menu is shown. xPos -= mBubbleMenuOffset; xPos -= mBubbleMenuView.getMenuView().getWidth(); } mBubbleMenuView.show(xPos, yPos); }); } /** Loading @@ -1762,6 +1763,12 @@ public class BubbleStackView extends FrameLayout { * Take a screenshot and send it to the specified bubble. */ public void sendScreenshotToBubble(Bubble bubble) { hideBubbleMenu(); // delay allows the bubble menu to disappear before the screenshot // done here because we already have a Handler to delay with. // TODO: Hide bubble + menu UI from screenshots entirely instead of just delaying. postDelayed(() -> { mBubbleScreenshotListener.onBubbleScreenshot(bubble); }, BubbleMenuView.SCREENSHOT_DELAY); } } packages/SystemUI/src/com/android/systemui/bubbles/BubbleTouchHandler.java +9 −7 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ class BubbleTouchHandler implements View.OnTouchListener { private boolean mMovedEnough; private int mTouchSlopSquared; private VelocityTracker mVelocityTracker; private Runnable mShowBubbleMenuRunnable; /** View that was initially touched, when we received the first ACTION_DOWN event. */ private View mTouchedView; Loading Loading @@ -133,6 +134,11 @@ class BubbleTouchHandler implements View.OnTouchListener { if (isStack) { mViewPositionOnTouchDown.set(mStack.getStackPosition()); mStack.onDragStart(); if (!mStack.isShowingBubbleMenu() && !mStack.isExpanded()) { mShowBubbleMenuRunnable = mStack::showBubbleMenu; mStack.postDelayed(mShowBubbleMenuRunnable, ViewConfiguration.getLongPressTimeout()); } } else if (isFlyout) { mStack.onFlyoutDragStart(); } else { Loading @@ -156,6 +162,7 @@ class BubbleTouchHandler implements View.OnTouchListener { } if (mMovedEnough) { mStack.removeCallbacks(mShowBubbleMenuRunnable); if (isStack) { mStack.onDragged(viewX, viewY); } else if (isFlyout) { Loading @@ -163,13 +170,6 @@ class BubbleTouchHandler implements View.OnTouchListener { } else { mStack.onBubbleDragged(mTouchedView, viewX, viewY); } } else { float touchTime = event.getEventTime() - event.getDownTime(); if (touchTime > ViewConfiguration.getLongPressTimeout() && !mStack.isExpanded() && BubbleExperimentConfig.allowBubbleScreenshotMenu(mContext)) { mStack.showBubbleMenu(); return true; } } final boolean currentlyInDismissTarget = mStack.isInDismissTarget(event); Loading @@ -196,6 +196,8 @@ class BubbleTouchHandler implements View.OnTouchListener { if (mStack.isShowingBubbleMenu()) { resetForNextGesture(); return true; } else { mStack.removeCallbacks(mShowBubbleMenuRunnable); } trackMovement(event); mVelocityTracker.computeCurrentVelocity(/* maxVelocity */ 1000); Loading Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +26 −29 Original line number Diff line number Diff line Loading @@ -1119,12 +1119,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi } private void sendScreenshotToBubble(Bubble bubble) { // delay allows the bubble menu to disappear before the screenshot // done here because we already have a Handler to delay with. // TODO: Hide bubble + menu UI from screenshots entirely instead of just delaying. mHandler.postDelayed(new Runnable() { @Override public void run() { mScreenshotHelper.takeScreenshot( android.view.WindowManager.TAKE_SCREENSHOT_FULLSCREEN, true /* hasStatus */, Loading @@ -1137,6 +1131,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi NotificationEntry entry = bubble.getEntry(); Pair<RemoteInput, Notification.Action> pair = entry.getSbn() .getNotification().findRemoteInputActionPair(false); if (pair != null) { RemoteInput remoteInput = pair.first; Notification.Action action = pair.second; Intent dataIntent = prepareRemoteInputFromData("image/png", uri, Loading @@ -1144,11 +1139,13 @@ public class BubbleController implements ConfigurationController.ConfigurationLi sendRemoteInput(dataIntent, entry, action.actionIntent); mBubbleData.setSelectedBubble(bubble); mBubbleData.setExpanded(true); } else { Log.w(TAG, "No RemoteInput found for notification: " + entry.getSbn().getKey()); } } }); } }, 200); }); } private final BubbleScreenshotListener mBubbleScreenshotListener = Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleMenuView.java +3 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,9 @@ public class BubbleMenuView extends FrameLayout { private FrameLayout mMenu; private boolean mShowing = false; /** Delay before taking a screenshot once the button is tapped to allow the menu time to hide.*/ public static final long SCREENSHOT_DELAY = 200; public BubbleMenuView(Context context, AttributeSet attrs) { super(context, attrs); } Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +18 −11 Original line number Diff line number Diff line Loading @@ -1731,17 +1731,18 @@ public class BubbleStackView extends FrameLayout { */ public void showBubbleMenu() { PointF currentPos = mStackAnimationController.getStackPosition(); mBubbleMenuView.setVisibility(View.INVISIBLE); post(() -> { float yPos = currentPos.y; float xPos = currentPos.x; if (mStackAnimationController.isStackOnLeftSide()) { xPos += mBubbleSize; } else { //TODO: Use the width of the menu instead of this fixed offset. Offset used for now // because menu width isn't correct the first time the menu is shown. xPos -= mBubbleMenuOffset; xPos -= mBubbleMenuView.getMenuView().getWidth(); } mBubbleMenuView.show(xPos, yPos); }); } /** Loading @@ -1762,6 +1763,12 @@ public class BubbleStackView extends FrameLayout { * Take a screenshot and send it to the specified bubble. */ public void sendScreenshotToBubble(Bubble bubble) { hideBubbleMenu(); // delay allows the bubble menu to disappear before the screenshot // done here because we already have a Handler to delay with. // TODO: Hide bubble + menu UI from screenshots entirely instead of just delaying. postDelayed(() -> { mBubbleScreenshotListener.onBubbleScreenshot(bubble); }, BubbleMenuView.SCREENSHOT_DELAY); } }
packages/SystemUI/src/com/android/systemui/bubbles/BubbleTouchHandler.java +9 −7 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ class BubbleTouchHandler implements View.OnTouchListener { private boolean mMovedEnough; private int mTouchSlopSquared; private VelocityTracker mVelocityTracker; private Runnable mShowBubbleMenuRunnable; /** View that was initially touched, when we received the first ACTION_DOWN event. */ private View mTouchedView; Loading Loading @@ -133,6 +134,11 @@ class BubbleTouchHandler implements View.OnTouchListener { if (isStack) { mViewPositionOnTouchDown.set(mStack.getStackPosition()); mStack.onDragStart(); if (!mStack.isShowingBubbleMenu() && !mStack.isExpanded()) { mShowBubbleMenuRunnable = mStack::showBubbleMenu; mStack.postDelayed(mShowBubbleMenuRunnable, ViewConfiguration.getLongPressTimeout()); } } else if (isFlyout) { mStack.onFlyoutDragStart(); } else { Loading @@ -156,6 +162,7 @@ class BubbleTouchHandler implements View.OnTouchListener { } if (mMovedEnough) { mStack.removeCallbacks(mShowBubbleMenuRunnable); if (isStack) { mStack.onDragged(viewX, viewY); } else if (isFlyout) { Loading @@ -163,13 +170,6 @@ class BubbleTouchHandler implements View.OnTouchListener { } else { mStack.onBubbleDragged(mTouchedView, viewX, viewY); } } else { float touchTime = event.getEventTime() - event.getDownTime(); if (touchTime > ViewConfiguration.getLongPressTimeout() && !mStack.isExpanded() && BubbleExperimentConfig.allowBubbleScreenshotMenu(mContext)) { mStack.showBubbleMenu(); return true; } } final boolean currentlyInDismissTarget = mStack.isInDismissTarget(event); Loading @@ -196,6 +196,8 @@ class BubbleTouchHandler implements View.OnTouchListener { if (mStack.isShowingBubbleMenu()) { resetForNextGesture(); return true; } else { mStack.removeCallbacks(mShowBubbleMenuRunnable); } trackMovement(event); mVelocityTracker.computeCurrentVelocity(/* maxVelocity */ 1000); Loading