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

Commit 8b837c78 authored by Jeff DeCew's avatar Jeff DeCew Committed by Automerger Merge Worker
Browse files

Revert suppression of recalculation to fix jump after aod->ls animation am:...

Revert suppression of recalculation to fix jump after aod->ls animation am: c003cb87 am: 9add045b am: b3078bdb am: 2b38ff76

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



Change-Id: If30b7b9e8eceadd4661da9422376b6c5b140d2d4
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents c0e1258a 2b38ff76
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import kotlin.properties.Delegates.notNull

private const val TAG = "NotifStackSizeCalc"
private val DEBUG = Compile.IS_DEBUG && Log.isLoggable(TAG, Log.DEBUG)
private val SPEW = Compile.IS_DEBUG && Log.isLoggable(TAG, Log.VERBOSE)

/** Calculates number of notifications to display and the height of the notification stack. */
@SysUISingleton
@@ -87,9 +88,10 @@ constructor(
        // Could be < 0 if the space available is less than the shelf size. Returns 0 in this case.
        maxNotifications = max(0, maxNotifications)
        log {
            val sequence = if (SPEW) " stackHeightSequence=${stackHeightSequence.toList()}" else ""
            "computeMaxKeyguardNotifications(" +
                "availableSpace=$totalAvailableSpace" +
                " shelfHeight=$shelfIntrinsicHeight) -> $maxNotifications"
                " shelfHeight=$shelfIntrinsicHeight) -> $maxNotifications$sequence"
        }
        return maxNotifications
    }
+24 −2
Original line number Diff line number Diff line
@@ -192,6 +192,7 @@ import com.android.systemui.statusbar.policy.KeyguardUserSwitcherView;
import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener;
import com.android.systemui.statusbar.window.StatusBarWindowStateController;
import com.android.systemui.unfold.SysUIUnfoldComponent;
import com.android.systemui.util.Compile;
import com.android.systemui.util.LargeScreenUtils;
import com.android.systemui.util.ListenerSet;
import com.android.systemui.util.Utils;
@@ -216,7 +217,8 @@ import javax.inject.Provider;
@CentralSurfacesComponent.CentralSurfacesScope
public class NotificationPanelViewController extends PanelViewController {

    private static final boolean DEBUG_LOGCAT = Log.isLoggable(TAG, Log.DEBUG);
    private static final boolean DEBUG_LOGCAT = Compile.IS_DEBUG && Log.isLoggable(TAG, Log.DEBUG);
    private static final boolean SPEW_LOGCAT = Compile.IS_DEBUG && Log.isLoggable(TAG, Log.VERBOSE);
    private static final boolean DEBUG_DRAWABLE = false;

    /**
@@ -1294,6 +1296,8 @@ public class NotificationPanelViewController extends PanelViewController {
    private void updateMaxDisplayedNotifications(boolean recompute) {
        if (recompute) {
            mMaxAllowedKeyguardNotifications = Math.max(computeMaxKeyguardNotifications(), 1);
        } else {
            if (SPEW_LOGCAT) Log.d(TAG, "Skipping computeMaxKeyguardNotifications() by request");
        }

        if (mKeyguardShowing && !mKeyguardBypassController.getBypassEnabled()) {
@@ -1546,6 +1550,19 @@ public class NotificationPanelViewController extends PanelViewController {
                mNotificationStackScrollLayoutController.getHeight()
                        - staticTopPadding
                        - bottomPadding;

        if (SPEW_LOGCAT) {
            Log.d(TAG, "getSpaceForLockscreenNotifications()"
                    + " availableSpace=" + availableSpace
                    + " NSSL.height=" + mNotificationStackScrollLayoutController.getHeight()
                    + " NSSL.top=" + mNotificationStackScrollLayoutController.getTop()
                    + " staticTopPadding=" + staticTopPadding
                    + " bottomPadding=" + bottomPadding
                    + " lockIconPadding=" + lockIconPadding
                    + " mIndicationBottomPadding=" + mIndicationBottomPadding
                    + " mAmbientIndicationBottomPadding=" + mAmbientIndicationBottomPadding
            );
        }
        return availableSpace;
    }

@@ -1554,7 +1571,12 @@ public class NotificationPanelViewController extends PanelViewController {
     */
    @VisibleForTesting
    int computeMaxKeyguardNotifications() {
        if (mAmbientState.getFractionToShade() > 0 || mAmbientState.getDozeAmount() > 0) {
        if (mAmbientState.getFractionToShade() > 0) {
            if (SPEW_LOGCAT) {
                Log.v(TAG, "Internally skipping computeMaxKeyguardNotifications()"
                        + " fractionToShade=" + mAmbientState.getFractionToShade()
                );
            }
            return mMaxAllowedKeyguardNotifications;
        }

+0 −11
Original line number Diff line number Diff line
@@ -577,20 +577,9 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
                .isEqualTo(-1);
    }

    @Test
    public void computeMaxKeyguardNotifications_dozeAmountNotZero_returnsExistingMax() {
        when(mAmbientState.getDozeAmount()).thenReturn(0.5f);
        mNotificationPanelViewController.setMaxDisplayedNotifications(-1);

        // computeMaxKeyguardNotifications sets maxAllowed to 0 at minimum if it updates the value
        assertThat(mNotificationPanelViewController.computeMaxKeyguardNotifications())
                .isEqualTo(-1);
    }

    @Test
    public void computeMaxKeyguardNotifications_noTransition_updatesMax() {
        when(mAmbientState.getFractionToShade()).thenReturn(0f);
        when(mAmbientState.getDozeAmount()).thenReturn(0f);
        mNotificationPanelViewController.setMaxDisplayedNotifications(-1);

        // computeMaxKeyguardNotifications sets maxAllowed to 0 at minimum if it updates the value