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

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

Merge "[Memory Improvement] Drop non existing items in mAdded lists" into main

parents 17e25d0b b0176c22
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -67,3 +67,13 @@ flag {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
  name: "drop_non_existing_messages"
  namespace: "systemui"
  description: "Drops all group and message entries that no longer exist."
  bug: "378101061"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}
 No newline at end of file
+6 −0
Original line number Diff line number Diff line
@@ -1188,6 +1188,12 @@ public class ConversationLayout extends FrameLayout
            }
            newGroup.setMessages(group);
        }

        if (Flags.dropNonExistingMessages()) {
            // remove groups from mAddedGroups when they are no longer in mGroups.
            mAddedGroups.removeIf(
                    messagingGroup -> !mGroups.contains(messagingGroup));
        }
    }

    /**
+4 −0
Original line number Diff line number Diff line
@@ -569,6 +569,10 @@ public class MessagingGroup extends NotificationOptimizedLinearLayout implements
        mIsolatedMessage = isolatedMessage;
        updateImageContainerVisibility();
        mMessages = group;
        if (android.widget.flags.Flags.dropNonExistingMessages()) {
            // remove messages from mAddedMessages when they are no longer in mMessages.
            mAddedMessages.removeIf(message -> !mMessages.contains(message));
        }
        updateMessageColor();
    }

+7 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import android.view.animation.PathInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RemoteViews;
import android.widget.flags.Flags;

import com.android.internal.R;

@@ -559,6 +560,12 @@ public class MessagingLayout extends FrameLayout
            }
            newGroup.setMessages(group);
        }

        if (Flags.dropNonExistingMessages()) {
            // remove groups from mAddedGroups when they are no longer in mGroups.
            mAddedGroups.removeIf(
                    messagingGroup -> !mGroups.contains(messagingGroup));
        }
    }

    private void findGroups(List<MessagingMessage> historicMessages,