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

Commit c54a18d1 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes Ide3e8e94,I84e7c06e

* changes:
  Fixed flickering when swiping away last notification
  Fixed the order of notifications when Bubbles are present
parents 0540b09b 3a1d274e
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ package com.android.systemui.bubbles;

import androidx.annotation.Nullable;

import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;

import java.util.Collection;
@@ -29,12 +30,13 @@ import javax.inject.Singleton;
 * Keeps track of active bubbles.
 */
@Singleton
class BubbleData {
public class BubbleData {

    private HashMap<String, Bubble> mBubbles = new HashMap<>();

    @VisibleForTesting
    @Inject
    BubbleData() {}
    public BubbleData() {}

    /**
     * The set of bubbles.
+13 −2
Original line number Diff line number Diff line
@@ -22,8 +22,10 @@ import android.os.Trace;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;

import com.android.systemui.R;
import com.android.systemui.bubbles.BubbleData;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.VisualStabilityManager;
@@ -74,6 +76,7 @@ public class NotificationViewHierarchyManager {
     * possible.
     */
    private final boolean mAlwaysExpandNonGroupedNotification;
    private final BubbleData mBubbleData;

    private NotificationPresenter mPresenter;
    private NotificationListContainer mListContainer;
@@ -85,7 +88,8 @@ public class NotificationViewHierarchyManager {
            VisualStabilityManager visualStabilityManager,
            StatusBarStateController statusBarStateController,
            NotificationEntryManager notificationEntryManager,
            Lazy<ShadeController> shadeController) {
            Lazy<ShadeController> shadeController,
            BubbleData bubbleData) {
        mLockscreenUserManager = notificationLockscreenUserManager;
        mGroupManager = groupManager;
        mVisualStabilityManager = visualStabilityManager;
@@ -95,6 +99,7 @@ public class NotificationViewHierarchyManager {
        Resources res = context.getResources();
        mAlwaysExpandNonGroupedNotification =
                res.getBoolean(R.bool.config_alwaysExpandNonGroupedNotifications);
        mBubbleData = bubbleData;
    }

    public void setUpWithPresenter(NotificationPresenter presenter,
@@ -114,7 +119,8 @@ public class NotificationViewHierarchyManager {
        final int N = activeNotifications.size();
        for (int i = 0; i < N; i++) {
            NotificationEntry ent = activeNotifications.get(i);
            if (ent.isRowDismissed() || ent.isRowRemoved()) {
            if (ent.isRowDismissed() || ent.isRowRemoved()
                    || (mBubbleData.getBubble(ent.key) != null && !ent.showInShadeWhenBubble())) {
                // we don't want to update removed notifications because they could
                // temporarily become children if they were isolated before.
                continue;
@@ -185,6 +191,11 @@ public class NotificationViewHierarchyManager {
            if (v.getParent() == null) {
                mVisualStabilityManager.notifyViewAddition(v);
                mListContainer.addContainerView(v);
            } else if (!mListContainer.containsView(v)) {
                // the view is added somewhere else. Let's make sure
                // the ordering works properly below, by excluding these
                toShow.remove(v);
                i--;
            }
        }

+8 −0
Original line number Diff line number Diff line
@@ -176,4 +176,12 @@ public interface NotificationListContainer extends ExpandableView.OnHeightChange
     * @param row The notification to bind.
     */
    default void bindRow(ExpandableNotificationRow row) {}

    /**
     * Does this list contain a given view. True by default is fine, since we only ask this if the
     * view has a parent.
     */
    default boolean containsView(View v) {
        return true;
    }
}
+7 −1
Original line number Diff line number Diff line
@@ -2482,7 +2482,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
            int minBottomPosition = minTopPosition;
            if (section == lastSection) {
                // We need to make sure the section goes all the way to the shelf
                minBottomPosition = (int) (mShelf.getTranslationY() + mShelf.getIntrinsicHeight());
                minBottomPosition = (int) (ViewState.getFinalTranslationY(mShelf)
                        + mShelf.getIntrinsicHeight());
            }
            minTopPosition = section.updateBounds(minTopPosition, minBottomPosition,
                    shiftPulsingWithFirst);
@@ -3272,6 +3273,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
        });
    }

    @Override
    public boolean containsView(View v) {
        return v.getParent() == this;
    }

    @Override
    @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
    public void applyExpandAnimationParams(ExpandAnimationParameters params) {
+2 −1
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import androidx.test.filters.SmallTest;
import com.android.systemui.Dependency;
import com.android.systemui.InitController;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.bubbles.BubbleData;
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.VisualStabilityManager;
@@ -97,7 +98,7 @@ public class NotificationViewHierarchyManagerTest extends SysuiTestCase {
        mViewHierarchyManager = new NotificationViewHierarchyManager(mContext,
                mLockscreenUserManager, mGroupManager, mVisualStabilityManager,
                mock(StatusBarStateControllerImpl.class), mEntryManager,
                () -> mShadeController);
                () -> mShadeController, new BubbleData());
        Dependency.get(InitController.class).executePostInitTasks();
        mViewHierarchyManager.setUpWithPresenter(mPresenter, mListContainer);
    }