Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b73d129 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Removing translation of shade dependent on finger position" into sc-v2-dev

parents c87b5ceb d0da3845
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -163,7 +163,6 @@ public class HeadsUpAppearanceController implements OnHeadsUpChangedListener,
        mHeadsUpStatusBarView.setOnDrawingRectChangedListener(null);
        mHeadsUpStatusBarView.setOnDrawingRectChangedListener(null);
        mWakeUpCoordinator.removeListener(this);
        mWakeUpCoordinator.removeListener(this);
        mNotificationPanelViewController.removeTrackingHeadsUpListener(mSetTrackingHeadsUp);
        mNotificationPanelViewController.removeTrackingHeadsUpListener(mSetTrackingHeadsUp);
        mNotificationPanelViewController.setVerticalTranslationListener(null);
        mNotificationPanelViewController.setHeadsUpAppearanceController(null);
        mNotificationPanelViewController.setHeadsUpAppearanceController(null);
        mStackScrollerController.removeOnExpandedHeightChangedListener(mSetExpandedHeight);
        mStackScrollerController.removeOnExpandedHeightChangedListener(mSetExpandedHeight);
        mDarkIconDispatcher.removeDarkReceiver(this);
        mDarkIconDispatcher.removeDarkReceiver(this);
+0 −52
Original line number Original line Diff line number Diff line
@@ -443,7 +443,6 @@ public class NotificationPanelViewController extends PanelViewController {
    private ArrayList<Consumer<ExpandableNotificationRow>>
    private ArrayList<Consumer<ExpandableNotificationRow>>
            mTrackingHeadsUpListeners =
            mTrackingHeadsUpListeners =
            new ArrayList<>();
            new ArrayList<>();
    private Runnable mVerticalTranslationListener;
    private HeadsUpAppearanceController mHeadsUpAppearanceController;
    private HeadsUpAppearanceController mHeadsUpAppearanceController;


    private int mPanelAlpha;
    private int mPanelAlpha;
@@ -3241,7 +3240,6 @@ public class NotificationPanelViewController extends PanelViewController {
    @Override
    @Override
    protected void onClosingFinished() {
    protected void onClosingFinished() {
        super.onClosingFinished();
        super.onClosingFinished();
        resetHorizontalPanelPosition();
        setClosingWithAlphaFadeout(false);
        setClosingWithAlphaFadeout(false);
        mMediaHierarchyManager.closeGuts();
        mMediaHierarchyManager.closeGuts();
    }
    }
@@ -3251,47 +3249,6 @@ public class NotificationPanelViewController extends PanelViewController {
        mNotificationStackScrollLayoutController.forceNoOverlappingRendering(closing);
        mNotificationStackScrollLayoutController.forceNoOverlappingRendering(closing);
    }
    }


    /**
     * Updates the horizontal position of the panel so it is positioned closer to the touch
     * responsible for opening the panel.
     *
     * @param x the x-coordinate the touch event
     */
    protected void updateHorizontalPanelPosition(float x) {
        if (mNotificationStackScrollLayoutController.getWidth() * 1.75f > mView.getWidth()
                || mShouldUseSplitNotificationShade) {
            resetHorizontalPanelPosition();
            return;
        }
        float leftMost = mPositionMinSideMargin
                + mNotificationStackScrollLayoutController.getWidth() / 2;
        float
                rightMost =
                mView.getWidth() - mPositionMinSideMargin
                        - mNotificationStackScrollLayoutController.getWidth() / 2;
        if (Math.abs(x - mView.getWidth() / 2)
                < mNotificationStackScrollLayoutController.getWidth() / 4) {
            x = mView.getWidth() / 2;
        }
        x = Math.min(rightMost, Math.max(leftMost, x));
        float
                center = mNotificationStackScrollLayoutController.getLeft()
                + mNotificationStackScrollLayoutController.getWidth() / 2;
        setHorizontalPanelTranslation(x - center);
    }

    private void resetHorizontalPanelPosition() {
        setHorizontalPanelTranslation(0f);
    }

    protected void setHorizontalPanelTranslation(float translation) {
        mNotificationStackScrollLayoutController.setTranslationX(translation);
        mQsFrame.setTranslationX(translation);
        if (mVerticalTranslationListener != null) {
            mVerticalTranslationListener.run();
        }
    }

    protected void updateExpandedHeight(float expandedHeight) {
    protected void updateExpandedHeight(float expandedHeight) {
        if (mTracking) {
        if (mTracking) {
            mNotificationStackScrollLayoutController
            mNotificationStackScrollLayoutController
@@ -3604,10 +3561,6 @@ public class NotificationPanelViewController extends PanelViewController {
        mTrackingHeadsUpListeners.remove(listener);
        mTrackingHeadsUpListeners.remove(listener);
    }
    }


    public void setVerticalTranslationListener(Runnable verticalTranslationListener) {
        mVerticalTranslationListener = verticalTranslationListener;
    }

    public void setHeadsUpAppearanceController(
    public void setHeadsUpAppearanceController(
            HeadsUpAppearanceController headsUpAppearanceController) {
            HeadsUpAppearanceController headsUpAppearanceController) {
        mHeadsUpAppearanceController = headsUpAppearanceController;
        mHeadsUpAppearanceController = headsUpAppearanceController;
@@ -3875,7 +3828,6 @@ public class NotificationPanelViewController extends PanelViewController {
                }
                }
                if (event.getActionMasked() == MotionEvent.ACTION_DOWN && isFullyCollapsed()) {
                if (event.getActionMasked() == MotionEvent.ACTION_DOWN && isFullyCollapsed()) {
                    mMetricsLogger.count(COUNTER_PANEL_OPEN, 1);
                    mMetricsLogger.count(COUNTER_PANEL_OPEN, 1);
                    updateHorizontalPanelPosition(event.getX());
                    handled = true;
                    handled = true;
                }
                }


@@ -4371,7 +4323,6 @@ public class NotificationPanelViewController extends PanelViewController {
            // The update needs to happen after the headerSlide in above, otherwise the translation
            // The update needs to happen after the headerSlide in above, otherwise the translation
            // would reset
            // would reset
            maybeAnimateBottomAreaAlpha();
            maybeAnimateBottomAreaAlpha();
            resetHorizontalPanelPosition();
            updateQsState();
            updateQsState();
            mSplitShadeHeaderController.setShadeExpanded(
            mSplitShadeHeaderController.setShadeExpanded(
                    mBarState == SHADE || mBarState == SHADE_LOCKED);
                    mBarState == SHADE || mBarState == SHADE_LOCKED);
@@ -4597,9 +4548,6 @@ public class NotificationPanelViewController extends PanelViewController {
        public void onConfigurationChanged(Configuration newConfig) {
        public void onConfigurationChanged(Configuration newConfig) {
            super.onConfigurationChanged(newConfig);
            super.onConfigurationChanged(newConfig);
            mAffordanceHelper.onConfigurationChanged();
            mAffordanceHelper.onConfigurationChanged();
            if (newConfig.orientation != mLastOrientation) {
                resetHorizontalPanelPosition();
            }
            mLastOrientation = newConfig.orientation;
            mLastOrientation = newConfig.orientation;
        }
        }
    }
    }
+0 −1
Original line number Original line Diff line number Diff line
@@ -198,7 +198,6 @@ public class HeadsUpAppearanceControllerTest extends SysuiTestCase {
        mHeadsUpAppearanceController.destroy();
        mHeadsUpAppearanceController.destroy();
        verify(mHeadsUpManager).removeListener(any());
        verify(mHeadsUpManager).removeListener(any());
        verify(mDarkIconDispatcher).removeDarkReceiver((DarkIconDispatcher.DarkReceiver) any());
        verify(mDarkIconDispatcher).removeDarkReceiver((DarkIconDispatcher.DarkReceiver) any());
        verify(mPanelView).setVerticalTranslationListener(isNull());
        verify(mPanelView).removeTrackingHeadsUpListener(any());
        verify(mPanelView).removeTrackingHeadsUpListener(any());
        verify(mPanelView).setHeadsUpAppearanceController(isNull());
        verify(mPanelView).setHeadsUpAppearanceController(isNull());
        verify(mStackScrollerController).removeOnExpandedHeightChangedListener(any());
        verify(mStackScrollerController).removeOnExpandedHeightChangedListener(any());
+0 −12
Original line number Original line Diff line number Diff line
@@ -657,18 +657,6 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
        assertThat(getConstraintSetLayout(R.id.notification_stack_scroller).mWidth).isEqualTo(0);
        assertThat(getConstraintSetLayout(R.id.notification_stack_scroller).mWidth).isEqualTo(0);
    }
    }


    @Test
    public void testOnDragDownEvent_horizontalTranslationIsZeroForSplitShade() {
        when(mNotificationStackScrollLayoutController.getWidth()).thenReturn(350f);
        when(mView.getWidth()).thenReturn(800);
        enableSplitShade(/* enabled= */ true);

        onTouchEvent(MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN,
                200f /* x position */, 0f, 0));

        verify(mQsFrame).setTranslationX(0);
    }

    @Test
    @Test
    public void testCanCollapsePanelOnTouch_trueForKeyGuard() {
    public void testCanCollapsePanelOnTouch_trueForKeyGuard() {
        mStatusBarStateController.setState(KEYGUARD);
        mStatusBarStateController.setState(KEYGUARD);