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

Commit ca8d00d5 authored by Ibrahim Yilmaz's avatar Ibrahim Yilmaz Committed by Android (Google) Code Review
Browse files

Merge "[RONs] clean ENR#setPromotedOngoing" into main

parents 0d1e5461 9bf0e40f
Loading
Loading
Loading
Loading
+17 −22
Original line number Diff line number Diff line
@@ -114,7 +114,6 @@ import com.android.systemui.statusbar.notification.NotificationUtils;
import com.android.systemui.statusbar.notification.SourceType;
import com.android.systemui.statusbar.notification.collection.EntryAdapter;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.NotificationEntryAdapter;
import com.android.systemui.statusbar.notification.collection.PipelineEntry;
import com.android.systemui.statusbar.notification.collection.provider.NotificationDismissibilityProvider;
import com.android.systemui.statusbar.notification.collection.render.GroupExpansionManager;
@@ -123,6 +122,7 @@ import com.android.systemui.statusbar.notification.headsup.HeadsUpManager;
import com.android.systemui.statusbar.notification.headsup.PinnedStatus;
import com.android.systemui.statusbar.notification.logging.NotificationCounters;
import com.android.systemui.statusbar.notification.people.PeopleNotificationIdentifier;
import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUi;
import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUiForceExpanded;
import com.android.systemui.statusbar.notification.row.shared.AsyncGroupHeaderViewInflation;
import com.android.systemui.statusbar.notification.row.shared.LockscreenOtpRedaction;
@@ -185,7 +185,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    private boolean mShowSnooze = false;
    private boolean mIsFaded;

    private boolean mIsPromotedOngoing = false;
    private boolean mHasStatusBarChipDuringHeadsUpAnimation = false;

    @Nullable
@@ -871,7 +870,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView

    private void updateLimitsForView(NotificationContentView layout) {
        final int maxExpandedHeight;
        if (isPromotedOngoing()) {
        if (PromotedNotificationUiForceExpanded.isEnabled() && isPromotedOngoing()) {
            maxExpandedHeight = mMaxExpandedHeightForPromotedOngoing;
        } else {
            maxExpandedHeight = mMaxExpandedHeight;
@@ -1350,7 +1349,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        if (mIsSummaryWithChildren) {
            return mChildrenContainer.getIntrinsicHeight();
        }
        if (isPromotedOngoing()) {
        if (PromotedNotificationUiForceExpanded.isEnabled() && isPromotedOngoing()) {
            return getMaxExpandHeight();
        }
        if (mExpandedWhenPinned) {
@@ -2939,7 +2938,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        if (mIsSummaryWithChildren && !shouldShowPublic()) {
            return !mChildrenExpanded;
        }
        if (isPromotedOngoing()) {
        if (PromotedNotificationUiForceExpanded.isEnabled() && isPromotedOngoing()) {
            return false;
        }
        return mEnableNonGroupedNotificationExpand && mExpandable;
@@ -2950,17 +2949,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        mPrivateLayout.updateExpandButtons(isExpandable());
    }

    /**
     * Set this notification to be promoted ongoing
     */
    public void setPromotedOngoing(boolean promotedOngoing) {
        if (PromotedNotificationUiForceExpanded.isUnexpectedlyInLegacyMode()) {
            return;
        }

        mIsPromotedOngoing = promotedOngoing;
        setExpandable(!mIsPromotedOngoing);
    }

    /**
     * Sets whether the status bar is showing a chip corresponding to this notification.
@@ -3061,7 +3049,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    }

    public void setUserLocked(boolean userLocked) {
        if (isPromotedOngoing()) return;
        if (PromotedNotificationUiForceExpanded.isEnabled() && isPromotedOngoing()) return;

        mUserLocked = userLocked;
        mPrivateLayout.setUserExpanding(userLocked);
@@ -3247,7 +3235,16 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    }

    public boolean isPromotedOngoing() {
        return PromotedNotificationUiForceExpanded.isEnabled() && mIsPromotedOngoing;
        if (!PromotedNotificationUi.isEnabled()) {
            return false;
        }

        final NotificationEntry entry = mEntry;
        if (entry == null) {
            return false;
        }

        return entry.isPromotedOngoing();
    }

    private boolean isPromotedNotificationExpanded(boolean allowOnKeyguard) {
@@ -3309,7 +3306,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    }

    public boolean isExpanded(boolean allowOnKeyguard) {
        if (isPromotedOngoing()) {
        if (PromotedNotificationUiForceExpanded.isEnabled() && isPromotedOngoing()) {
            return isPromotedNotificationExpanded(allowOnKeyguard);
        }

@@ -4396,9 +4393,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
                    + (!shouldShowPublic() && mIsSummaryWithChildren));
            pw.print(", mShowNoBackground: " + mShowNoBackground);
            pw.print(", clipBounds: " + getClipBounds());
            if (PromotedNotificationUiForceExpanded.isEnabled()) {
            pw.print(", isPromotedOngoing: " + isPromotedOngoing());
            }
            if (notificationRowAccessibilityExpanded()) {
                pw.print(", isShowingExpanded: " + isShowingExpanded());
                pw.print(", isAccessibilityExpandable: " + isAccessibilityExpandable());
+0 −5
Original line number Diff line number Diff line
@@ -59,7 +59,6 @@ import com.android.systemui.statusbar.notification.NmSummarizationUiFlag;
import com.android.systemui.statusbar.notification.NotificationUtils;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.promoted.PromotedNotificationContentExtractor;
import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUiForceExpanded;
import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel;
import com.android.systemui.statusbar.notification.row.shared.AsyncGroupHeaderViewInflation;
import com.android.systemui.statusbar.notification.row.shared.AsyncHybridViewInflation;
@@ -1006,10 +1005,6 @@ public class NotificationContentInflater implements NotificationRowContentBinder
            entry.setPromotedNotificationContentModel(result.mPromotedContent);
        }

        if (PromotedNotificationUiForceExpanded.isEnabled()) {
            row.setPromotedOngoing(entry.isOngoingPromoted());
        }

        boolean setRepliesAndActions = true;
        if ((reInflateFlags & FLAG_CONTENT_VIEW_CONTRACTED) != 0) {
            if (result.inflatedContentView != null) {
+0 −5
Original line number Diff line number Diff line
@@ -53,7 +53,6 @@ import com.android.systemui.statusbar.notification.NmSummarizationUiFlag
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.logKey
import com.android.systemui.statusbar.notification.promoted.PromotedNotificationContentExtractor
import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUiForceExpanded
import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel
import com.android.systemui.statusbar.notification.row.NotificationContentView.VISIBLE_TYPE_CONTRACTED
import com.android.systemui.statusbar.notification.row.NotificationContentView.VISIBLE_TYPE_EXPANDED
@@ -1520,10 +1519,6 @@ constructor(
                entry.promotedNotificationContentModel = result.promotedContent
            }

            if (PromotedNotificationUiForceExpanded.isEnabled) {
                row.setPromotedOngoing(entry.isOngoingPromoted())
            }

            result.inflatedSmartReplyState?.let { row.privateLayout.setInflatedSmartReplyState(it) }

            setContentViewsFromRemoteViews(
+25 −12
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ import com.android.systemui.statusbar.notification.FeedbackIcon;
import com.android.systemui.statusbar.notification.SourceType;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.headsup.PinnedStatus;
import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUi;
import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUiForceExpanded;
import com.android.systemui.statusbar.notification.row.ExpandableView.OnHeightChangedListener;
import com.android.systemui.statusbar.notification.row.wrapper.NotificationViewWrapper;
@@ -936,11 +937,13 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {
    }

    @Test
    @EnableFlags(PromotedNotificationUiForceExpanded.FLAG_NAME)
    @EnableFlags({PromotedNotificationUi.FLAG_NAME, PromotedNotificationUiForceExpanded.FLAG_NAME})
    public void isExpanded_sensitivePromotedNotification_notExpanded() throws Exception {
        // GIVEN
        final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
        row.setPromotedOngoing(true);
        NotificationEntry entry = mock(NotificationEntry.class);
        when(entry.isPromotedOngoing()).thenReturn(true);
        row.setEntry(entry);
        row.setSensitive(/* sensitive= */true, /* hideSensitive= */false);
        row.setHideSensitiveForIntrinsicHeight(/* hideSensitive= */true);

@@ -949,11 +952,13 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {
    }

    @Test
    @EnableFlags(PromotedNotificationUiForceExpanded.FLAG_NAME)
    @EnableFlags({PromotedNotificationUi.FLAG_NAME, PromotedNotificationUiForceExpanded.FLAG_NAME})
    public void isExpanded_promotedNotificationNotOnKeyguard_expanded() throws Exception {
        // GIVEN
        final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
        row.setPromotedOngoing(true);
        NotificationEntry entry = mock(NotificationEntry.class);
        when(entry.isPromotedOngoing()).thenReturn(true);
        row.setEntry(entry);
        row.setOnKeyguard(false);

        // THEN
@@ -961,11 +966,13 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {
    }

    @Test
    @EnableFlags(PromotedNotificationUiForceExpanded.FLAG_NAME)
    @EnableFlags({PromotedNotificationUi.FLAG_NAME, PromotedNotificationUiForceExpanded.FLAG_NAME})
    public void isExpanded_promotedNotificationAllowOnKeyguard_expanded() throws Exception {
        // GIVEN
        final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
        row.setPromotedOngoing(true);
        NotificationEntry entry = mock(NotificationEntry.class);
        when(entry.isPromotedOngoing()).thenReturn(true);
        row.setEntry(entry);
        row.setOnKeyguard(true);

        // THEN
@@ -973,12 +980,14 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {
    }

    @Test
    @EnableFlags(PromotedNotificationUiForceExpanded.FLAG_NAME)
    @EnableFlags({PromotedNotificationUi.FLAG_NAME, PromotedNotificationUiForceExpanded.FLAG_NAME})
    public void isExpanded_promotedNotificationIgnoreLockscreenConstraints_expanded()
            throws Exception {
        // GIVEN
        final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
        row.setPromotedOngoing(true);
        NotificationEntry entry = mock(NotificationEntry.class);
        when(entry.isPromotedOngoing()).thenReturn(true);
        row.setEntry(entry);
        row.setOnKeyguard(true);
        row.setIgnoreLockscreenConstraints(true);

@@ -987,12 +996,14 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {
    }

    @Test
    @EnableFlags(PromotedNotificationUiForceExpanded.FLAG_NAME)
    @EnableFlags({PromotedNotificationUi.FLAG_NAME, PromotedNotificationUiForceExpanded.FLAG_NAME})
    public void isExpanded_promotedNotificationSaveSpaceOnLockScreen_notExpanded()
            throws Exception {
        // GIVEN
        final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
        row.setPromotedOngoing(true);
        NotificationEntry entry = mock(NotificationEntry.class);
        when(entry.isPromotedOngoing()).thenReturn(true);
        row.setEntry(entry);
        row.setOnKeyguard(true);
        row.setSaveSpaceOnLockscreen(true);

@@ -1001,12 +1012,14 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {
    }

    @Test
    @EnableFlags(PromotedNotificationUiForceExpanded.FLAG_NAME)
    @EnableFlags({PromotedNotificationUi.FLAG_NAME, PromotedNotificationUiForceExpanded.FLAG_NAME})
    public void isExpanded_promotedNotificationNotSaveSpaceOnLockScreen_expanded()
            throws Exception {
        // GIVEN
        final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
        row.setPromotedOngoing(true);
        NotificationEntry entry = mock(NotificationEntry.class);
        when(entry.isPromotedOngoing()).thenReturn(true);
        row.setEntry(entry);
        row.setOnKeyguard(true);
        row.setSaveSpaceOnLockscreen(false);