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

Commit d6de64d7 authored by Lyn Han's avatar Lyn Han Committed by Automerger Merge Worker
Browse files

Merge "Allow overlap between notifications and lock icon" into tm-dev am:...

Merge "Allow overlap between notifications and lock icon" into tm-dev am: 44286954 am: 49e1be67 am: cc03fe48

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17843770



Change-Id: Ie2f3a34bcc0e251ea3d63c2f786a3006fc99aec0
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 43dcaa91 cc03fe48
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -388,6 +388,8 @@

    <dimen name="split_shade_notifications_scrim_margin_bottom">0dp</dimen>

    <dimen name="shelf_and_lock_icon_overlap">5dp</dimen>

    <dimen name="notification_panel_margin_horizontal">0dp</dimen>

    <dimen name="brightness_mirror_height">48dp</dimen>
+33 −16
Original line number Diff line number Diff line
@@ -391,6 +391,12 @@ public class NotificationPanelViewController extends PanelViewController {
    private int mLargeScreenShadeHeaderHeight;
    private int mSplitShadeNotificationsScrimMarginBottom;

    /**
     * Vertical overlap allowed between the bottom of the notification shelf and
     * the top of the lock icon or the under-display fingerprint sensor background.
     */
    private int mShelfAndLockIconOverlap;

    private final KeyguardClockPositionAlgorithm
            mClockPositionAlgorithm =
            new KeyguardClockPositionAlgorithm();
@@ -1104,6 +1110,9 @@ public class NotificationPanelViewController extends PanelViewController {
                mResources.getDimensionPixelSize(
                        R.dimen.split_shade_notifications_scrim_margin_bottom);

        mShelfAndLockIconOverlap =
                mResources.getDimensionPixelSize(R.dimen.shelf_and_lock_icon_overlap);

        final boolean newShouldUseSplitNotificationShade =
                LargeScreenUtils.shouldUseSplitNotificationShade(mResources);
        final boolean splitNotificationShadeChanged =
@@ -1489,27 +1498,18 @@ public class NotificationPanelViewController extends PanelViewController {
    }

    /**
     * @return the maximum keyguard notifications that can fit on the screen
     * @return Space available to show notifications on lockscreen.
     */
    @VisibleForTesting
    int computeMaxKeyguardNotifications() {
        if (mAmbientState.getFractionToShade() > 0 || mAmbientState.getDozeAmount() > 0) {
            return mMaxAllowedKeyguardNotifications;
        }
    float getSpaceForLockscreenNotifications() {
        float topPadding = mNotificationStackScrollLayoutController.getTopPadding();
        float shelfIntrinsicHeight =
                mNotificationShelfController.getVisibility() == View.GONE
                        ? 0
                        : mNotificationShelfController.getIntrinsicHeight();

        // Padding to add to the bottom of the stack to keep a minimum distance from the top of
        // the lock icon.
        float lockIconPadding = 0;
        // Space between bottom of notifications and top of lock icon or udfps background.
        float lockIconPadding = mLockIconViewController.getTop();
        if (mLockIconViewController.getTop() != 0) {
            final float lockIconTopWithPadding = mLockIconViewController.getTop()
                    - mResources.getDimensionPixelSize(R.dimen.min_lock_icon_padding);
            lockIconPadding = mNotificationStackScrollLayoutController.getBottom()
                    - lockIconTopWithPadding;
                    - mLockIconViewController.getTop()
                    - mShelfAndLockIconOverlap;
        }

        float bottomPadding = Math.max(lockIconPadding,
@@ -1520,9 +1520,26 @@ public class NotificationPanelViewController extends PanelViewController {
                mNotificationStackScrollLayoutController.getHeight()
                        - topPadding
                        - bottomPadding;
        return availableSpace;
    }

    /**
     * @return Maximum number of notifications that can fit on keyguard.
     */
    @VisibleForTesting
    int computeMaxKeyguardNotifications() {
        if (mAmbientState.getFractionToShade() > 0 || mAmbientState.getDozeAmount() > 0) {
            return mMaxAllowedKeyguardNotifications;
        }

        final float shelfIntrinsicHeight =
                mNotificationShelfController.getVisibility() == View.GONE
                        ? 0
                        : mNotificationShelfController.getIntrinsicHeight();

        return mNotificationStackSizeCalculator.computeMaxKeyguardNotifications(
                mNotificationStackScrollLayoutController.getView(), availableSpace,
                mNotificationStackScrollLayoutController.getView(),
                getSpaceForLockscreenNotifications(),
                shelfIntrinsicHeight);
    }

+21 −0
Original line number Diff line number Diff line
@@ -594,6 +594,27 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
                .isNotEqualTo(-1);
    }

    @Test
    public void getLockscreenSpaceForNotifications_includesOverlapWithLockIcon() {
        when(mResources.getDimensionPixelSize(R.dimen.keyguard_indication_bottom_padding))
                .thenReturn(0);
        mNotificationPanelViewController.setAmbientIndicationTop(
                /* ambientIndicationTop= */ 0, /* ambientTextVisible */ false);

        // Use lock icon padding (100 - 80 - 5 = 15) as bottom padding
        when(mNotificationStackScrollLayoutController.getBottom()).thenReturn(100);
        when(mLockIconViewController.getTop()).thenReturn(80f);
        when(mResources.getDimensionPixelSize(R.dimen.shelf_and_lock_icon_overlap)).thenReturn(5);

        // Available space (100 - 10 - 15 = 75)
        when(mNotificationStackScrollLayoutController.getHeight()).thenReturn(100);
        when(mNotificationStackScrollLayoutController.getTopPadding()).thenReturn(10);
        mNotificationPanelViewController.updateResources();

        assertThat(mNotificationPanelViewController.getSpaceForLockscreenNotifications())
                .isEqualTo(75);
    }

    @Test
    public void testSetPanelScrimMinFraction() {
        mNotificationPanelViewController.setPanelScrimMinFraction(0.5f);