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

Commit 1a9eb5d8 authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

Only check if SLOW_MEASURE flag is enabled when needed.

Fix: 319659059
Test: NotificationStackScrollLayoutTest GroupExpansionManagerTest
(running locally on a debug build)
Flag: NONE

Change-Id: I3ef507d886d92540df875abafd5b6a8276f802db
parent 047b2390
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -273,12 +273,15 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    private final RefactorFlag mInlineReplyAnimation =
            RefactorFlag.forView(Flags.NOTIFICATION_INLINE_REPLY_ANIMATION);

    private static final boolean mSimulateSlowMeasure = Compile.IS_DEBUG && RefactorFlag.forView(
    private static boolean shouldSimulateSlowMeasure() {
        return Compile.IS_DEBUG && RefactorFlag.forView(
                Flags.ENABLE_NOTIFICATIONS_SIMULATE_SLOW_MEASURE).isEnabled();
    }

    private static final String SLOW_MEASURE_SIMULATE_DELAY_PROPERTY =
            "persist.notifications.extra_measure_delay_ms";
    private static final int SLOW_MEASURE_SIMULATE_DELAY_MS = mSimulateSlowMeasure ?
            SystemProperties.getInt(SLOW_MEASURE_SIMULATE_DELAY_PROPERTY, 150) : 0;
    private static final int SLOW_MEASURE_SIMULATE_DELAY_MS =
            SystemProperties.getInt(SLOW_MEASURE_SIMULATE_DELAY_PROPERTY, 150);

    // Listener will be called when receiving a long click event.
    // Use #setLongPressPosition to optionally assign positional data with the long press.
@@ -1886,7 +1889,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        }
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);

        if (Compile.IS_DEBUG && mSimulateSlowMeasure) {
        if (shouldSimulateSlowMeasure()) {
            simulateExtraMeasureDelay();
        }
        Trace.endSection();
+0 −8
Original line number Diff line number Diff line
@@ -626,8 +626,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {

    @Test
    public void testClearNotifications_clearAllInProgress() {
        mFeatureFlags.set(Flags.ENABLE_NOTIFICATIONS_SIMULATE_SLOW_MEASURE, false);

        ExpandableNotificationRow row = createClearableRow();
        when(row.getEntry().hasFinishedInitialization()).thenReturn(true);
        doReturn(true).when(mStackScroller).isVisible(row);
@@ -672,8 +670,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {

    @Test
    public void testAddNotificationUpdatesSpeedBumpIndex() {
        mFeatureFlags.set(Flags.ENABLE_NOTIFICATIONS_SIMULATE_SLOW_MEASURE, false);

        // initial state calculated == 0
        assertEquals(0, mStackScroller.getSpeedBumpIndex());

@@ -690,8 +686,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {

    @Test
    public void testAddAmbientNotificationNoSpeedBumpUpdate() {
        mFeatureFlags.set(Flags.ENABLE_NOTIFICATIONS_SIMULATE_SLOW_MEASURE, false);

        // initial state calculated  == 0
        assertEquals(0, mStackScroller.getSpeedBumpIndex());

@@ -708,8 +702,6 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {

    @Test
    public void testRemoveNotificationUpdatesSpeedBump() {
        mFeatureFlags.set(Flags.ENABLE_NOTIFICATIONS_SIMULATE_SLOW_MEASURE, false);

        // initial state calculated == 0
        assertEquals(0, mStackScroller.getSpeedBumpIndex());