diff options
| author | 2021-02-22 12:37:53 +0000 | |
|---|---|---|
| committer | 2021-02-22 12:37:53 +0000 | |
| commit | 7a16dc902980bc70ec0405b43df72e75d61486e8 (patch) | |
| tree | e4dcf64cf2b8784021c715490d12aa42238c1b6b | |
| parent | 700621b5090b3b83e9f982a2ba0080b83252ef69 (diff) | |
| parent | ecb2d83dd187e22a13acf7735db49ed9e344c2cc (diff) | |
Merge "Removing horizontal translation of shade for dual pane" into sc-dev
2 files changed, 21 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java index cfef8bf3f6fd..f4ffb207e665 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -2926,7 +2926,8 @@ public class NotificationPanelViewController extends PanelViewController { * @param x the x-coordinate the touch event */ protected void updateHorizontalPanelPosition(float x) { - if (mNotificationStackScrollLayoutController.getWidth() * 1.75f > mView.getWidth()) { + if (mNotificationStackScrollLayoutController.getWidth() * 1.75f > mView.getWidth() + || Utils.shouldUseSplitNotificationShade(mFeatureFlags, mResources)) { resetHorizontalPanelPosition(); return; } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java index b7d338c0e977..8cb898443fd2 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java @@ -451,9 +451,7 @@ public class NotificationPanelViewTest extends SysuiTestCase { @Test public void testAllChildrenOfNotificationContainer_haveIds() { - when(mResources.getBoolean(R.bool.config_use_split_notification_shade)).thenReturn(true); - when(mFeatureFlags.isTwoColumnNotificationShadeEnabled()).thenReturn(true); - + enableDualPaneShade(); mNotificationContainerParent.addView(newViewWithId(1)); mNotificationContainerParent.addView(newViewWithId(View.NO_ID)); @@ -482,8 +480,7 @@ public class NotificationPanelViewTest extends SysuiTestCase { @Test public void testSplitShadeLayout_isAlignedToGuideline() { - when(mResources.getBoolean(R.bool.config_use_split_notification_shade)).thenReturn(true); - when(mFeatureFlags.isTwoColumnNotificationShadeEnabled()).thenReturn(true); + enableDualPaneShade(); mNotificationContainerParent.addView(newViewWithId(R.id.qs_frame)); mNotificationContainerParent.addView(newViewWithId(R.id.notification_stack_scroller)); @@ -541,6 +538,23 @@ public class NotificationPanelViewTest extends SysuiTestCase { return view; } + @Test + public void testOnDragDownEvent_horizontalTranslationIsZeroForDualPaneShade() { + when(mNotificationStackScrollLayoutController.getWidth()).thenReturn(350f); + when(mView.getWidth()).thenReturn(800); + enableDualPaneShade(); + + onTouchEvent(MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, + 200f /* x position */, 0f, 0)); + + verify(mQsFrame).setTranslationX(0); + } + + private void enableDualPaneShade() { + when(mResources.getBoolean(R.bool.config_use_split_notification_shade)).thenReturn(true); + when(mFeatureFlags.isTwoColumnNotificationShadeEnabled()).thenReturn(true); + } + private void onTouchEvent(MotionEvent ev) { mTouchHandler.onTouch(mView, ev); } |