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

Commit 933dc7cf authored by Kevin Han's avatar Kevin Han
Browse files

Introduce NotifBindPipeline (2/2)

Hook up NotifBindPipeline classes to ExpandableNotificationRow's API,
deprecating some API. Eventually we should remove the ENR middle man
fully and have the clients directly call NotifBindPipeline API so we
can also deprecate ENR's bind-related API.

This also moves NotificationTestHelper to the notification.row package
since it should really be there considering its job of inflating rows
for tests and allows our new class constructors to remain
package-private.

Bug: 145749521
Test: atest SystemUITests
Test: smoke test w/ Notify test apk
Test: "Group Hun Cancel" test in Notify test apk
Change-Id: I1e5ea68006c69332b7e5ae3e274d1deabeba6a70
parent 131f30d1
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -22,11 +22,4 @@ package com.android.systemui.statusbar;
 */
public interface InflationTask {
    void abort();

    /**
     * Supersedes an existing task. i.e another task was superceeded by this.
     *
     * @param task the task that was previously running
     */
    default void supersedeTask(InflationTask task) {}
}
+6 −8
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.NotificationListener;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.InflationFlag;
import com.android.systemui.statusbar.policy.HeadsUpManager;

import javax.inject.Inject;
@@ -64,8 +63,8 @@ public class NotificationAlertingManager {

        notificationEntryManager.addNotificationEntryListener(new NotificationEntryListener() {
            @Override
            public void onEntryInflated(NotificationEntry entry, int inflatedFlags) {
                showAlertingView(entry, inflatedFlags);
            public void onEntryInflated(NotificationEntry entry) {
                showAlertingView(entry);
            }

            @Override
@@ -90,12 +89,11 @@ public class NotificationAlertingManager {
    /**
     * Adds the entry to the respective alerting manager if the content view was inflated and
     * the entry should still alert.
     *
     * @param entry         entry to add
     * @param inflatedFlags flags representing content views that were inflated
     */
    private void showAlertingView(NotificationEntry entry, @InflationFlag int inflatedFlags) {
        if ((inflatedFlags & FLAG_CONTENT_VIEW_HEADS_UP) != 0) {
    private void showAlertingView(NotificationEntry entry) {
        // TODO: Instead of this back and forth, we should listen to changes in heads up and
        // cancel on-going heads up view inflation using the bind pipeline.
        if (entry.getRow().getPrivateLayout().getHeadsUpChild() != null) {
            // Possible for shouldHeadsUp to change between the inflation starting and ending.
            // If it does and we no longer need to heads up, we should free the view.
            if (mNotificationInterruptionStateProvider.shouldHeadsUp(entry)) {
+1 −2
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import androidx.annotation.NonNull;

import com.android.internal.statusbar.NotificationVisibility;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.InflationFlag;

/**
 * Listener interface for changes sent by NotificationEntryManager.
@@ -62,7 +61,7 @@ public interface NotificationEntryListener {
    /**
     * Called when a notification's views are inflated for the first time.
     */
    default void onEntryInflated(NotificationEntry entry, @InflationFlag int inflatedFlags) {
    default void onEntryInflated(NotificationEntry entry) {
    }

    /**
+2 −4
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ import com.android.systemui.statusbar.notification.collection.inflation.Notifica
import com.android.systemui.statusbar.notification.logging.NotifEvent;
import com.android.systemui.statusbar.notification.logging.NotifLog;
import com.android.systemui.statusbar.notification.logging.NotificationLogger;
import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.InflationFlag;
import com.android.systemui.statusbar.notification.stack.NotificationListContainer;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
import com.android.systemui.statusbar.policy.HeadsUpManager;
@@ -318,8 +317,7 @@ public class NotificationEntryManager implements
    }

    @Override
    public void onAsyncInflationFinished(NotificationEntry entry,
            @InflationFlag int inflatedFlags) {
    public void onAsyncInflationFinished(NotificationEntry entry) {
        mPendingNotifications.remove(entry.getKey());
        // If there was an async task started after the removal, we don't want to add it back to
        // the list, otherwise we might get leaks.
@@ -328,7 +326,7 @@ public class NotificationEntryManager implements
            if (isNew) {
                for (NotificationEntryListener listener : mNotificationEntryListeners) {
                    mNotifLog.log(NotifEvent.INFLATED, entry);
                    listener.onEntryInflated(entry, inflatedFlags);
                    listener.onEntryInflated(entry);
                }
                addActiveNotification(entry);
                updateNotifications("onAsyncInflationFinished");
+1 −3
Original line number Diff line number Diff line
@@ -149,9 +149,7 @@ public class NotifInflaterImpl implements NotifInflater {
                }

                @Override
                public void onAsyncInflationFinished(
                        NotificationEntry entry,
                        int inflatedFlags) {
                public void onAsyncInflationFinished(NotificationEntry entry) {
                    if (mExternalInflationCallback != null) {
                        mExternalInflationCallback.onInflationFinished(entry);
                    }
Loading