Loading packages/SystemUI/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -671,4 +671,7 @@ 1 - Override the setting to always bypass keyguard 2 - Override the setting to never bypass keyguard --> <integer name="config_face_unlock_bypass_override">0</integer> <!-- Flag to activate notification to contents feature --> <bool name="config_notificationToContents">false</bool> </resources> packages/SystemUI/res/values/dimens.xml +2 −0 Original line number Diff line number Diff line Loading @@ -1594,4 +1594,6 @@ <!-- The padding between the icon and the text. --> <dimen name="ongoing_call_chip_icon_text_padding">4dp</dimen> <dimen name="ongoing_call_chip_corner_radius">28dp</dimen> <dimen name="drag_and_drop_icon_size">70dp</dimen> </resources> packages/SystemUI/src/com/android/systemui/SwipeHelper.java +76 −26 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ import android.animation.ValueAnimator; import android.animation.ValueAnimator.AnimatorUpdateListener; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.Notification; import android.app.PendingIntent; import android.content.res.Resources; import android.graphics.RectF; import android.os.Handler; Loading Loading @@ -73,6 +75,9 @@ public class SwipeHelper implements Gefingerpoken { private final FlingAnimationUtils mFlingAnimationUtils; private float mPagingTouchSlop; private final float mSlopMultiplier; private int mTouchSlop; private float mTouchSlopMultiplier; private final Callback mCallback; private final int mSwipeDirection; private final VelocityTracker mVelocityTracker; Loading Loading @@ -105,6 +110,10 @@ public class SwipeHelper implements Gefingerpoken { final int y = (int) mDownLocation[1] - mViewOffset[1]; mTouchedView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); ((ExpandableNotificationRow) mTouchedView).doLongClickCallback(x, y); if (isAvailableToDragAndDrop(mTouchedView)) { mCallback.onLongPressSent(mTouchedView); } } } } Loading @@ -126,6 +135,8 @@ public class SwipeHelper implements Gefingerpoken { mVelocityTracker = VelocityTracker.obtain(); mPagingTouchSlop = viewConfiguration.getScaledPagingTouchSlop(); mSlopMultiplier = viewConfiguration.getScaledAmbiguousGestureMultiplier(); mTouchSlop = viewConfiguration.getScaledTouchSlop(); mTouchSlopMultiplier = viewConfiguration.getAmbiguousGestureMultiplier(); // Extra long-press! mLongPressTimeout = (long) (ViewConfiguration.getLongPressTimeout() * 1.5f); Loading Loading @@ -297,7 +308,9 @@ public class SwipeHelper implements Gefingerpoken { mIsSwiping = false; mSnappingChild = false; mLongPressSent = false; mCallback.onLongPressSent(null); mVelocityTracker.clear(); cancelLongPress(); mTouchedView = mCallback.getChildAtPosition(ev); if (mTouchedView != null) { Loading Loading @@ -349,6 +362,7 @@ public class SwipeHelper implements Gefingerpoken { mIsSwiping = false; mTouchedView = null; mLongPressSent = false; mCallback.onLongPressSent(null); mMenuRowIntercepting = false; cancelLongPress(); if (captured) return true; Loading Loading @@ -593,11 +607,7 @@ public class SwipeHelper implements Gefingerpoken { @Override public boolean onTouchEvent(MotionEvent ev) { if (mLongPressSent && !mMenuRowIntercepting) { return true; } if (!mIsSwiping && !mMenuRowIntercepting) { if (!mIsSwiping && !mMenuRowIntercepting && !mLongPressSent) { if (mCallback.getChildAtPosition(ev) != null) { // We are dragging directly over a card, make sure that we also catch the gesture // even if nobody else wants the touch event. Loading @@ -623,6 +633,15 @@ public class SwipeHelper implements Gefingerpoken { if (absDelta >= getFalsingThreshold()) { mTouchAboveFalsingThreshold = true; } if (mLongPressSent) { if (absDelta >= getTouchSlop(ev)) { if (mTouchedView instanceof ExpandableNotificationRow) { ((ExpandableNotificationRow) mTouchedView) .doDragCallback(ev.getX(), ev.getY()); } } } else { // don't let items that can't be dismissed be dragged more than // maxScrollDistance if (CONSTRAIN_SWIPE && !mCallback.canChildBeDismissedInDirection( Loading @@ -648,6 +667,7 @@ public class SwipeHelper implements Gefingerpoken { updateSwipeProgressFromOffset(mTouchedView, mCanCurrViewBeDimissed); onMoveUpdate(mTouchedView, ev, mTranslation + delta, delta); } } break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: Loading Loading @@ -747,6 +767,29 @@ public class SwipeHelper implements Gefingerpoken { mIsSwiping = false; } private float getTouchSlop(MotionEvent event) { // Adjust the touch slop if another gesture may be being performed. return event.getClassification() == MotionEvent.CLASSIFICATION_AMBIGUOUS_GESTURE ? mTouchSlop * mTouchSlopMultiplier : mTouchSlop; } private boolean isAvailableToDragAndDrop(View v) { if (v.getResources().getBoolean(R.bool.config_notificationToContents)) { if (v instanceof ExpandableNotificationRow) { ExpandableNotificationRow enr = (ExpandableNotificationRow) v; boolean canBubble = enr.getEntry().canBubble(); Notification notif = enr.getEntry().getSbn().getNotification(); PendingIntent dragIntent = notif.contentIntent != null ? notif.contentIntent : notif.fullScreenIntent; if (dragIntent != null && dragIntent.isActivity() && !canBubble) { return true; } } } return false; } public interface Callback { View getChildAtPosition(MotionEvent ev); Loading @@ -770,6 +813,13 @@ public class SwipeHelper implements Gefingerpoken { void onDragCancelled(View v); /** * Called when the child is long pressed and available to start drag and drop. * * @param v the view that was long pressed. */ void onLongPressSent(View v); /** * Called when the child is snapped to a position. * Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationActivityStarter.java +4 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.content.Intent; import android.service.notification.StatusBarNotification; import android.view.View; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; /** Loading @@ -37,6 +38,9 @@ public interface NotificationActivityStarter { /** Called when the user clicks "Manage" or "History" in the Shade. */ void startHistoryIntent(View view, boolean showHistory); /** Called when the user succeed to drop notification to proper target view. */ void onDragSuccess(NotificationEntry entry); default boolean isCollapsingToShowActivityOverLockscreen() { return false; } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationClicker.java +10 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,14 @@ public final class NotificationClicker implements View.OnClickListener { private final Optional<Bubbles> mBubblesOptional; private final NotificationActivityStarter mNotificationActivityStarter; private ExpandableNotificationRow.OnDragSuccessListener mOnDragSuccessListener = new ExpandableNotificationRow.OnDragSuccessListener() { @Override public void onDragSuccess(NotificationEntry entry) { mNotificationActivityStarter.onDragSuccess(entry); } }; private NotificationClicker( NotificationClickerLogger logger, Optional<StatusBar> statusBarOptional, Loading Loading @@ -111,8 +119,10 @@ public final class NotificationClicker implements View.OnClickListener { if (notification.contentIntent != null || notification.fullScreenIntent != null || row.getEntry().isBubble()) { row.setOnClickListener(this); row.setOnDragSuccessListener(mOnDragSuccessListener); } else { row.setOnClickListener(null); row.setOnDragSuccessListener(null); } } Loading Loading
packages/SystemUI/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -671,4 +671,7 @@ 1 - Override the setting to always bypass keyguard 2 - Override the setting to never bypass keyguard --> <integer name="config_face_unlock_bypass_override">0</integer> <!-- Flag to activate notification to contents feature --> <bool name="config_notificationToContents">false</bool> </resources>
packages/SystemUI/res/values/dimens.xml +2 −0 Original line number Diff line number Diff line Loading @@ -1594,4 +1594,6 @@ <!-- The padding between the icon and the text. --> <dimen name="ongoing_call_chip_icon_text_padding">4dp</dimen> <dimen name="ongoing_call_chip_corner_radius">28dp</dimen> <dimen name="drag_and_drop_icon_size">70dp</dimen> </resources>
packages/SystemUI/src/com/android/systemui/SwipeHelper.java +76 −26 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ import android.animation.ValueAnimator; import android.animation.ValueAnimator.AnimatorUpdateListener; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.Notification; import android.app.PendingIntent; import android.content.res.Resources; import android.graphics.RectF; import android.os.Handler; Loading Loading @@ -73,6 +75,9 @@ public class SwipeHelper implements Gefingerpoken { private final FlingAnimationUtils mFlingAnimationUtils; private float mPagingTouchSlop; private final float mSlopMultiplier; private int mTouchSlop; private float mTouchSlopMultiplier; private final Callback mCallback; private final int mSwipeDirection; private final VelocityTracker mVelocityTracker; Loading Loading @@ -105,6 +110,10 @@ public class SwipeHelper implements Gefingerpoken { final int y = (int) mDownLocation[1] - mViewOffset[1]; mTouchedView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); ((ExpandableNotificationRow) mTouchedView).doLongClickCallback(x, y); if (isAvailableToDragAndDrop(mTouchedView)) { mCallback.onLongPressSent(mTouchedView); } } } } Loading @@ -126,6 +135,8 @@ public class SwipeHelper implements Gefingerpoken { mVelocityTracker = VelocityTracker.obtain(); mPagingTouchSlop = viewConfiguration.getScaledPagingTouchSlop(); mSlopMultiplier = viewConfiguration.getScaledAmbiguousGestureMultiplier(); mTouchSlop = viewConfiguration.getScaledTouchSlop(); mTouchSlopMultiplier = viewConfiguration.getAmbiguousGestureMultiplier(); // Extra long-press! mLongPressTimeout = (long) (ViewConfiguration.getLongPressTimeout() * 1.5f); Loading Loading @@ -297,7 +308,9 @@ public class SwipeHelper implements Gefingerpoken { mIsSwiping = false; mSnappingChild = false; mLongPressSent = false; mCallback.onLongPressSent(null); mVelocityTracker.clear(); cancelLongPress(); mTouchedView = mCallback.getChildAtPosition(ev); if (mTouchedView != null) { Loading Loading @@ -349,6 +362,7 @@ public class SwipeHelper implements Gefingerpoken { mIsSwiping = false; mTouchedView = null; mLongPressSent = false; mCallback.onLongPressSent(null); mMenuRowIntercepting = false; cancelLongPress(); if (captured) return true; Loading Loading @@ -593,11 +607,7 @@ public class SwipeHelper implements Gefingerpoken { @Override public boolean onTouchEvent(MotionEvent ev) { if (mLongPressSent && !mMenuRowIntercepting) { return true; } if (!mIsSwiping && !mMenuRowIntercepting) { if (!mIsSwiping && !mMenuRowIntercepting && !mLongPressSent) { if (mCallback.getChildAtPosition(ev) != null) { // We are dragging directly over a card, make sure that we also catch the gesture // even if nobody else wants the touch event. Loading @@ -623,6 +633,15 @@ public class SwipeHelper implements Gefingerpoken { if (absDelta >= getFalsingThreshold()) { mTouchAboveFalsingThreshold = true; } if (mLongPressSent) { if (absDelta >= getTouchSlop(ev)) { if (mTouchedView instanceof ExpandableNotificationRow) { ((ExpandableNotificationRow) mTouchedView) .doDragCallback(ev.getX(), ev.getY()); } } } else { // don't let items that can't be dismissed be dragged more than // maxScrollDistance if (CONSTRAIN_SWIPE && !mCallback.canChildBeDismissedInDirection( Loading @@ -648,6 +667,7 @@ public class SwipeHelper implements Gefingerpoken { updateSwipeProgressFromOffset(mTouchedView, mCanCurrViewBeDimissed); onMoveUpdate(mTouchedView, ev, mTranslation + delta, delta); } } break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: Loading Loading @@ -747,6 +767,29 @@ public class SwipeHelper implements Gefingerpoken { mIsSwiping = false; } private float getTouchSlop(MotionEvent event) { // Adjust the touch slop if another gesture may be being performed. return event.getClassification() == MotionEvent.CLASSIFICATION_AMBIGUOUS_GESTURE ? mTouchSlop * mTouchSlopMultiplier : mTouchSlop; } private boolean isAvailableToDragAndDrop(View v) { if (v.getResources().getBoolean(R.bool.config_notificationToContents)) { if (v instanceof ExpandableNotificationRow) { ExpandableNotificationRow enr = (ExpandableNotificationRow) v; boolean canBubble = enr.getEntry().canBubble(); Notification notif = enr.getEntry().getSbn().getNotification(); PendingIntent dragIntent = notif.contentIntent != null ? notif.contentIntent : notif.fullScreenIntent; if (dragIntent != null && dragIntent.isActivity() && !canBubble) { return true; } } } return false; } public interface Callback { View getChildAtPosition(MotionEvent ev); Loading @@ -770,6 +813,13 @@ public class SwipeHelper implements Gefingerpoken { void onDragCancelled(View v); /** * Called when the child is long pressed and available to start drag and drop. * * @param v the view that was long pressed. */ void onLongPressSent(View v); /** * Called when the child is snapped to a position. * Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationActivityStarter.java +4 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.content.Intent; import android.service.notification.StatusBarNotification; import android.view.View; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; /** Loading @@ -37,6 +38,9 @@ public interface NotificationActivityStarter { /** Called when the user clicks "Manage" or "History" in the Shade. */ void startHistoryIntent(View view, boolean showHistory); /** Called when the user succeed to drop notification to proper target view. */ void onDragSuccess(NotificationEntry entry); default boolean isCollapsingToShowActivityOverLockscreen() { return false; } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationClicker.java +10 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,14 @@ public final class NotificationClicker implements View.OnClickListener { private final Optional<Bubbles> mBubblesOptional; private final NotificationActivityStarter mNotificationActivityStarter; private ExpandableNotificationRow.OnDragSuccessListener mOnDragSuccessListener = new ExpandableNotificationRow.OnDragSuccessListener() { @Override public void onDragSuccess(NotificationEntry entry) { mNotificationActivityStarter.onDragSuccess(entry); } }; private NotificationClicker( NotificationClickerLogger logger, Optional<StatusBar> statusBarOptional, Loading Loading @@ -111,8 +119,10 @@ public final class NotificationClicker implements View.OnClickListener { if (notification.contentIntent != null || notification.fullScreenIntent != null || row.getEntry().isBubble()) { row.setOnClickListener(this); row.setOnDragSuccessListener(mOnDragSuccessListener); } else { row.setOnClickListener(null); row.setOnDragSuccessListener(null); } } Loading