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

Commit 04855269 authored by Jeff DeCew's avatar Jeff DeCew Committed by Android (Google) Code Review
Browse files

Merge "Do not recycle HeadsUpManagerPhone objects" into main

parents fd70e030 d0b54515
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -40,6 +40,7 @@ import com.android.systemui.statusbar.notification.shared.NotificationIconContai
import com.android.systemui.statusbar.notification.shared.NotificationMinimalismPrototype
import com.android.systemui.statusbar.notification.shared.NotificationMinimalismPrototype
import com.android.systemui.statusbar.notification.shared.NotificationsHeadsUpRefactor
import com.android.systemui.statusbar.notification.shared.NotificationsHeadsUpRefactor
import com.android.systemui.statusbar.notification.shared.NotificationsLiveDataStoreRefactor
import com.android.systemui.statusbar.notification.shared.NotificationsLiveDataStoreRefactor
import com.android.systemui.statusbar.notification.shared.NotificationThrottleHun
import com.android.systemui.statusbar.notification.shared.PriorityPeopleSection
import com.android.systemui.statusbar.notification.shared.PriorityPeopleSection
import javax.inject.Inject
import javax.inject.Inject


@@ -59,6 +60,7 @@ class FlagDependencies @Inject constructor(featureFlags: FeatureFlagsClassic, ha
        NotificationAvalancheSuppression.token dependsOn VisualInterruptionRefactor.token
        NotificationAvalancheSuppression.token dependsOn VisualInterruptionRefactor.token
        PriorityPeopleSection.token dependsOn SortBySectionTimeFlag.token
        PriorityPeopleSection.token dependsOn SortBySectionTimeFlag.token
        NotificationMinimalismPrototype.token dependsOn NotificationsHeadsUpRefactor.token
        NotificationMinimalismPrototype.token dependsOn NotificationsHeadsUpRefactor.token
        NotificationsHeadsUpRefactor.token dependsOn NotificationThrottleHun.token


        // SceneContainer dependencies
        // SceneContainer dependencies
        SceneContainerFlag.getFlagDependencies().forEach { (alpha, beta) -> alpha dependsOn beta }
        SceneContainerFlag.getFlagDependencies().forEach { (alpha, beta) -> alpha dependsOn beta }
+4 −4
Original line number Original line Diff line number Diff line
@@ -117,7 +117,7 @@ public class HeadsUpManagerPhone extends BaseHeadsUpManager implements


        @Override
        @Override
        public HeadsUpEntryPhone acquire() {
        public HeadsUpEntryPhone acquire() {
            NotificationsHeadsUpRefactor.assertInLegacyMode();
            NotificationThrottleHun.assertInLegacyMode();
            if (!mPoolObjects.isEmpty()) {
            if (!mPoolObjects.isEmpty()) {
                return mPoolObjects.pop();
                return mPoolObjects.pop();
            }
            }
@@ -126,7 +126,7 @@ public class HeadsUpManagerPhone extends BaseHeadsUpManager implements


        @Override
        @Override
        public boolean release(@NonNull HeadsUpEntryPhone instance) {
        public boolean release(@NonNull HeadsUpEntryPhone instance) {
            NotificationsHeadsUpRefactor.assertInLegacyMode();
            NotificationThrottleHun.assertInLegacyMode();
            mPoolObjects.push(instance);
            mPoolObjects.push(instance);
            return true;
            return true;
        }
        }
@@ -428,7 +428,7 @@ public class HeadsUpManagerPhone extends BaseHeadsUpManager implements
    @NonNull
    @NonNull
    @Override
    @Override
    protected HeadsUpEntry createHeadsUpEntry(NotificationEntry entry) {
    protected HeadsUpEntry createHeadsUpEntry(NotificationEntry entry) {
        if (NotificationsHeadsUpRefactor.isEnabled()) {
        if (NotificationThrottleHun.isEnabled()) {
            return new HeadsUpEntryPhone(entry);
            return new HeadsUpEntryPhone(entry);
        } else {
        } else {
            HeadsUpEntryPhone headsUpEntry = mEntryPool.acquire();
            HeadsUpEntryPhone headsUpEntry = mEntryPool.acquire();
@@ -454,7 +454,7 @@ public class HeadsUpManagerPhone extends BaseHeadsUpManager implements
    @Override
    @Override
    protected void onEntryRemoved(HeadsUpEntry headsUpEntry) {
    protected void onEntryRemoved(HeadsUpEntry headsUpEntry) {
        super.onEntryRemoved(headsUpEntry);
        super.onEntryRemoved(headsUpEntry);
        if (!NotificationsHeadsUpRefactor.isEnabled()) {
        if (!NotificationThrottleHun.isEnabled()) {
            mEntryPool.release((HeadsUpEntryPhone) headsUpEntry);
            mEntryPool.release((HeadsUpEntryPhone) headsUpEntry);
        }
        }
        updateTopHeadsUpFlow();
        updateTopHeadsUpFlow();
+4 −4
Original line number Original line Diff line number Diff line
@@ -439,7 +439,7 @@ public abstract class BaseHeadsUpManager implements HeadsUpManager {
            onEntryRemoved(finalHeadsUpEntry);
            onEntryRemoved(finalHeadsUpEntry);
            // TODO(b/328390331) move accessibility events to the view layer
            // TODO(b/328390331) move accessibility events to the view layer
            entry.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
            entry.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
            if (NotificationsHeadsUpRefactor.isEnabled()) {
            if (NotificationThrottleHun.isEnabled()) {
                finalHeadsUpEntry.cancelAutoRemovalCallbacks("removeEntry");
                finalHeadsUpEntry.cancelAutoRemovalCallbacks("removeEntry");
            } else {
            } else {
                finalHeadsUpEntry.reset();
                finalHeadsUpEntry.reset();
@@ -768,7 +768,7 @@ public abstract class BaseHeadsUpManager implements HeadsUpManager {
        @Nullable private Runnable mCancelRemoveRunnable;
        @Nullable private Runnable mCancelRemoveRunnable;


        public HeadsUpEntry() {
        public HeadsUpEntry() {
            NotificationsHeadsUpRefactor.assertInLegacyMode();
            NotificationThrottleHun.assertInLegacyMode();
        }
        }


        public HeadsUpEntry(NotificationEntry entry) {
        public HeadsUpEntry(NotificationEntry entry) {
@@ -779,7 +779,7 @@ public abstract class BaseHeadsUpManager implements HeadsUpManager {


        /** Attach a NotificationEntry. */
        /** Attach a NotificationEntry. */
        public void setEntry(@NonNull final NotificationEntry entry) {
        public void setEntry(@NonNull final NotificationEntry entry) {
            NotificationsHeadsUpRefactor.assertInLegacyMode();
            NotificationThrottleHun.assertInLegacyMode();
            setEntry(entry, createRemoveRunnable(entry));
            setEntry(entry, createRemoveRunnable(entry));
        }
        }


@@ -976,7 +976,7 @@ public abstract class BaseHeadsUpManager implements HeadsUpManager {
        }
        }


        public void reset() {
        public void reset() {
            NotificationsHeadsUpRefactor.assertInLegacyMode();
            NotificationThrottleHun.assertInLegacyMode();
            cancelAutoRemovalCallbacks("reset()");
            cancelAutoRemovalCallbacks("reset()");
            mEntry = null;
            mEntry = null;
            mRemoveRunnable = null;
            mRemoveRunnable = null;