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

Commit cc08829a authored by Yining Liu's avatar Yining Liu
Browse files

Rename low-priority named parameters with notification view inflation

Previously, we use the term: low priority to refer to the minimized notifications because of some history reason. Now the definitions of low priority notifications and minimized notifications are different, so we rename the parameter names that have lowPriority with minimized to reduce the confusion and improve code quality.

Bug: 217799515
Flag: NONE
Test: presubmit
Change-Id: I770bf2f4c82ce57c17a42a983c99d852c45e2721
parent c61f5288
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -363,7 +363,7 @@ public class PreparationCoordinator implements Coordinator {

    NotifInflater.Params getInflaterParams(NotifUiAdjustment adjustment, String reason) {
        return new NotifInflater.Params(
                /* isLowPriority = */ adjustment.isMinimized(),
                /* isMinimized = */ adjustment.isMinimized(),
                /* reason = */ reason,
                /* showSnooze = */ adjustment.isSnoozeEnabled(),
                /* isChildInGroup = */ adjustment.isChildInGroup(),
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ interface NotifInflater {

    /** A class holding parameters used when inflating the notification row */
    class Params(
        val isLowPriority: Boolean,
        val isMinimized: Boolean,
        val reason: String,
        val showSnooze: Boolean,
        val isChildInGroup: Boolean = false,
+4 −4
Original line number Diff line number Diff line
@@ -243,7 +243,7 @@ public class NotificationRowBinderImpl implements NotificationRowBinder {
            @Nullable NotificationRowContentBinder.InflationCallback inflationCallback) {
        final boolean useIncreasedCollapsedHeight =
                mMessagingUtil.isImportantMessaging(entry.getSbn(), entry.getImportance());
        final boolean isLowPriority = inflaterParams.isLowPriority();
        final boolean isMinimized = inflaterParams.isMinimized();

        // Set show snooze action
        row.setShowSnooze(inflaterParams.getShowSnooze());
@@ -252,7 +252,7 @@ public class NotificationRowBinderImpl implements NotificationRowBinder {
        params.requireContentViews(FLAG_CONTENT_VIEW_CONTRACTED);
        params.requireContentViews(FLAG_CONTENT_VIEW_EXPANDED);
        params.setUseIncreasedCollapsedHeight(useIncreasedCollapsedHeight);
        params.setUseLowPriority(isLowPriority);
        params.setUseMinimized(isMinimized);

        // If screenshareNotificationHiding is enabled, both public and private views should be
        // inflated to avoid any latency associated with reinflating all notification views when
@@ -277,7 +277,7 @@ public class NotificationRowBinderImpl implements NotificationRowBinder {
        if (AsyncGroupHeaderViewInflation.isEnabled()) {
            if (inflaterParams.isGroupSummary()) {
                params.requireContentViews(FLAG_GROUP_SUMMARY_HEADER);
                if (isLowPriority) {
                if (isMinimized) {
                    params.requireContentViews(FLAG_LOW_PRIORITY_GROUP_SUMMARY_HEADER);
                }
            } else {
@@ -290,7 +290,7 @@ public class NotificationRowBinderImpl implements NotificationRowBinder {
        mRowContentBindStage.requestRebind(entry, en -> {
            mLogger.logRebindComplete(entry);
            row.setUsesIncreasedCollapsedHeight(useIncreasedCollapsedHeight);
            row.setIsMinimized(isLowPriority);
            row.setIsMinimized(isMinimized);
            if (inflationCallback != null) {
                inflationCallback.onAsyncInflationFinished(en);
            }
+12 −11
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ import com.android.systemui.statusbar.notification.row.NotificationRowContentBin
 * Parameters for {@link RowContentBindStage}.
 */
public final class RowContentBindParams {
    private boolean mUseLowPriority;
    private boolean mUseMinimized;
    private boolean mUseIncreasedHeight;
    private boolean mUseIncreasedHeadsUpHeight;
    private boolean mViewsNeedReinflation;
@@ -41,19 +41,20 @@ public final class RowContentBindParams {
    private @InflationFlag int mDirtyContentViews = mContentViews;

    /**
     * Set whether content should use a low priority version of its content views.
     * The low priority here does not equal to the NotificationManager.IMPORTANCE_LOW, but
     * represents that the notification is minimized (with the priority: IMPORTANCE_MIN).
     * Set whether content should use a minimized version of its content views.
     */
    public void setUseLowPriority(boolean useLowPriority) {
        if (mUseLowPriority != useLowPriority) {
    public void setUseMinimized(boolean useMinimized) {
        if (mUseMinimized != useMinimized) {
            mDirtyContentViews |= (FLAG_CONTENT_VIEW_CONTRACTED | FLAG_CONTENT_VIEW_EXPANDED);
        }
        mUseLowPriority = useLowPriority;
        mUseMinimized = useMinimized;
    }

    public boolean useLowPriority() {
        return mUseLowPriority;
    /**
     * @return Whether the row uses the minimized style.
     */
    public boolean useMinimized() {
        return mUseMinimized;
    }

    /**
@@ -151,9 +152,9 @@ public final class RowContentBindParams {
    @Override
    public String toString() {
        return String.format("RowContentBindParams[mContentViews=%x mDirtyContentViews=%x "
                + "mUseLowPriority=%b mUseIncreasedHeight=%b "
                + "mUseMinimized=%b mUseIncreasedHeight=%b "
                + "mUseIncreasedHeadsUpHeight=%b mViewsNeedReinflation=%b]",
                mContentViews, mDirtyContentViews, mUseLowPriority, mUseIncreasedHeight,
                mContentViews, mDirtyContentViews, mUseMinimized, mUseIncreasedHeight,
                mUseIncreasedHeadsUpHeight, mViewsNeedReinflation);
    }

+1 −1
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ public class RowContentBindStage extends BindStage<RowContentBindParams> {
        mBinder.unbindContent(entry, row, contentToUnbind);

        BindParams bindParams = new BindParams();
        bindParams.isMinimized = params.useLowPriority();
        bindParams.isMinimized = params.useMinimized();
        bindParams.usesIncreasedHeight = params.useIncreasedHeight();
        bindParams.usesIncreasedHeadsUpHeight = params.useIncreasedHeadsUpHeight();
        boolean forceInflate = params.needsReinflation();
Loading