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

Commit 0f1179c6 authored by Yining Liu's avatar Yining Liu Committed by Android (Google) Code Review
Browse files

Merge "Lazy async group notification views inflation" into main

parents 2947c318 550dabea
Loading
Loading
Loading
Loading
+0 −17
Original line number Original line Diff line number Diff line
@@ -174,23 +174,6 @@ public class StatusBarNotification implements Parcelable {
        return sbnKey;
        return sbnKey;
    }
    }


    /**
     * @return Whether the Entry is a group child by the app or system
     * @hide
     */
    public boolean isAppOrSystemGroupChild() {
        return isGroup() && !getNotification().isGroupSummary();
    }


    /**
     * @return Whether the Entry is a group summary by the app or system
     * @hide
     */
    public boolean isAppOrSystemGroupSummary() {
        return isGroup() && getNotification().isGroupSummary();
    }

    private String groupKey() {
    private String groupKey() {
        if (overrideGroupKey != null) {
        if (overrideGroupKey != null) {
            return user.getIdentifier() + "|" + pkg + "|" + "g:" + overrideGroupKey;
            return user.getIdentifier() + "|" + pkg + "|" + "g:" + overrideGroupKey;
+23 −0
Original line number Original line Diff line number Diff line
@@ -171,6 +171,9 @@ public final class NotificationEntry extends ListEntry {
    private boolean mIsMarkedForUserTriggeredMovement;
    private boolean mIsMarkedForUserTriggeredMovement;
    private boolean mIsHeadsUpEntry;
    private boolean mIsHeadsUpEntry;


    private boolean mHasEverBeenGroupSummary;
    private boolean mHasEverBeenGroupChild;

    public boolean mRemoteEditImeAnimatingAway;
    public boolean mRemoteEditImeAnimatingAway;
    public boolean mRemoteEditImeVisible;
    public boolean mRemoteEditImeVisible;
    private boolean mExpandAnimationRunning;
    private boolean mExpandAnimationRunning;
@@ -217,6 +220,26 @@ public final class NotificationEntry extends ListEntry {
        mIsDemoted = true;
        mIsDemoted = true;
    }
    }


    /** called when entry is currently a summary of a group */
    public void markAsGroupSummary() {
        mHasEverBeenGroupSummary = true;
    }

    /** whether this entry has ever been marked as a summary */
    public boolean hasEverBeenGroupSummary() {
        return mHasEverBeenGroupSummary;
    }

    /** called when entry is currently a child in a group */
    public void markAsGroupChild() {
        mHasEverBeenGroupChild = true;
    }

    /** whether this entry has ever been marked as a child */
    public boolean hasEverBeenGroupChild() {
        return mHasEverBeenGroupChild;
    }

    /**
    /**
     * @param sbn the StatusBarNotification from system server
     * @param sbn the StatusBarNotification from system server
     * @param ranking also from system server
     * @param ranking also from system server
+6 −0
Original line number Original line Diff line number Diff line
@@ -49,6 +49,8 @@ import com.android.systemui.statusbar.notification.collection.render.NotifViewBa
import com.android.systemui.statusbar.notification.collection.render.NotifViewController;
import com.android.systemui.statusbar.notification.collection.render.NotifViewController;
import com.android.systemui.statusbar.notification.row.NotifInflationErrorManager;
import com.android.systemui.statusbar.notification.row.NotifInflationErrorManager;
import com.android.systemui.statusbar.notification.row.NotifInflationErrorManager.NotifInflationErrorListener;
import com.android.systemui.statusbar.notification.row.NotifInflationErrorManager.NotifInflationErrorListener;
import com.android.systemui.statusbar.notification.row.shared.AsyncGroupHeaderViewInflation;
import com.android.systemui.statusbar.notification.row.shared.AsyncHybridViewInflation;


import java.lang.annotation.Retention;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.RetentionPolicy;
@@ -273,10 +275,14 @@ public class PreparationCoordinator implements Coordinator {


    private void inflateRequiredGroupViews(GroupEntry groupEntry) {
    private void inflateRequiredGroupViews(GroupEntry groupEntry) {
        NotificationEntry summary = groupEntry.getSummary();
        NotificationEntry summary = groupEntry.getSummary();
        if (summary != null && AsyncGroupHeaderViewInflation.isEnabled()) {
            summary.markAsGroupSummary();
        }
        List<NotificationEntry> children = groupEntry.getChildren();
        List<NotificationEntry> children = groupEntry.getChildren();
        inflateRequiredNotifViews(summary);
        inflateRequiredNotifViews(summary);
        for (int j = 0; j < children.size(); j++) {
        for (int j = 0; j < children.size(); j++) {
            NotificationEntry child = children.get(j);
            NotificationEntry child = children.get(j);
            if (AsyncHybridViewInflation.isEnabled()) child.markAsGroupChild();
            boolean childShouldBeBound = j < mChildBindCutoff;
            boolean childShouldBeBound = j < mChildBindCutoff;
            if (childShouldBeBound) {
            if (childShouldBeBound) {
                inflateRequiredNotifViews(child);
                inflateRequiredNotifViews(child);
+1 −4
Original line number Original line Diff line number Diff line
@@ -52,11 +52,8 @@ class NotifUiAdjustment internal constructor(
            oldAdjustment.needsRedaction != newAdjustment.needsRedaction -> true
            oldAdjustment.needsRedaction != newAdjustment.needsRedaction -> true
            areDifferent(oldAdjustment.smartActions, newAdjustment.smartActions) -> true
            areDifferent(oldAdjustment.smartActions, newAdjustment.smartActions) -> true
            newAdjustment.smartReplies != oldAdjustment.smartReplies -> true
            newAdjustment.smartReplies != oldAdjustment.smartReplies -> true
            // TODO(b/217799515): Here we decide whether to re-inflate the row on every group-status
            //  change if we want to keep the single-line view, the following line should be:
            //  !oldAdjustment.isChildInGroup && newAdjustment.isChildInGroup -> true
            AsyncHybridViewInflation.isEnabled &&
            AsyncHybridViewInflation.isEnabled &&
                    oldAdjustment.isChildInGroup != newAdjustment.isChildInGroup -> true
                    !oldAdjustment.isChildInGroup && newAdjustment.isChildInGroup -> true
            AsyncGroupHeaderViewInflation.isEnabled &&
            AsyncGroupHeaderViewInflation.isEnabled &&
                !oldAdjustment.isGroupSummary && newAdjustment.isGroupSummary -> true
                !oldAdjustment.isGroupSummary && newAdjustment.isGroupSummary -> true
            else -> false
            else -> false
+2 −2
Original line number Original line Diff line number Diff line
@@ -141,7 +141,7 @@ class NotifUiAdjustmentProvider @Inject constructor(
            lockscreenUserManager.needsRedaction(entry) ||
            lockscreenUserManager.needsRedaction(entry) ||
                (screenshareNotificationHiding() &&
                (screenshareNotificationHiding() &&
                    sensitiveNotifProtectionController.shouldProtectNotification(entry)),
                    sensitiveNotifProtectionController.shouldProtectNotification(entry)),
        isChildInGroup = entry.sbn.isAppOrSystemGroupChild,
        isChildInGroup = entry.hasEverBeenGroupChild(),
        isGroupSummary = entry.sbn.isAppOrSystemGroupSummary,
        isGroupSummary = entry.hasEverBeenGroupSummary(),
    )
    )
}
}
Loading