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 Diff line number Diff line
@@ -174,23 +174,6 @@ public class StatusBarNotification implements Parcelable {
        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() {
        if (overrideGroupKey != null) {
            return user.getIdentifier() + "|" + pkg + "|" + "g:" + overrideGroupKey;
+23 −0
Original line number Diff line number Diff line
@@ -171,6 +171,9 @@ public final class NotificationEntry extends ListEntry {
    private boolean mIsMarkedForUserTriggeredMovement;
    private boolean mIsHeadsUpEntry;

    private boolean mHasEverBeenGroupSummary;
    private boolean mHasEverBeenGroupChild;

    public boolean mRemoteEditImeAnimatingAway;
    public boolean mRemoteEditImeVisible;
    private boolean mExpandAnimationRunning;
@@ -217,6 +220,26 @@ public final class NotificationEntry extends ListEntry {
        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 ranking also from system server
+6 −0
Original line number 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.row.NotifInflationErrorManager;
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.RetentionPolicy;
@@ -273,10 +275,14 @@ public class PreparationCoordinator implements Coordinator {

    private void inflateRequiredGroupViews(GroupEntry groupEntry) {
        NotificationEntry summary = groupEntry.getSummary();
        if (summary != null && AsyncGroupHeaderViewInflation.isEnabled()) {
            summary.markAsGroupSummary();
        }
        List<NotificationEntry> children = groupEntry.getChildren();
        inflateRequiredNotifViews(summary);
        for (int j = 0; j < children.size(); j++) {
            NotificationEntry child = children.get(j);
            if (AsyncHybridViewInflation.isEnabled()) child.markAsGroupChild();
            boolean childShouldBeBound = j < mChildBindCutoff;
            if (childShouldBeBound) {
                inflateRequiredNotifViews(child);
+1 −4
Original line number Diff line number Diff line
@@ -52,11 +52,8 @@ class NotifUiAdjustment internal constructor(
            oldAdjustment.needsRedaction != newAdjustment.needsRedaction -> true
            areDifferent(oldAdjustment.smartActions, newAdjustment.smartActions) -> 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 &&
                    oldAdjustment.isChildInGroup != newAdjustment.isChildInGroup -> true
                    !oldAdjustment.isChildInGroup && newAdjustment.isChildInGroup -> true
            AsyncGroupHeaderViewInflation.isEnabled &&
                !oldAdjustment.isGroupSummary && newAdjustment.isGroupSummary -> true
            else -> false
+2 −2
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ class NotifUiAdjustmentProvider @Inject constructor(
            lockscreenUserManager.needsRedaction(entry) ||
                (screenshareNotificationHiding() &&
                    sensitiveNotifProtectionController.shouldProtectNotification(entry)),
        isChildInGroup = entry.sbn.isAppOrSystemGroupChild,
        isGroupSummary = entry.sbn.isAppOrSystemGroupSummary,
        isChildInGroup = entry.hasEverBeenGroupChild(),
        isGroupSummary = entry.hasEverBeenGroupSummary(),
    )
}
Loading